Commit Graph
17 Commits
Author SHA1 Message Date
Yanzhe LeeandGitHub 77ba9e728d Merge branch 'Wei-Shaw:main' into fix/openai-gateway-content-session-hash-fallback 2026-04-02 01:56:18 +08:00
YanzheL cf9efefd96 fix(lint): satisfy errcheck for strings.Builder.WriteString calls 2026-04-02 01:03:22 +08:00
YanzheL 4fb1603001 test(gateway): add tests for content-based session hash fallback
- 20 unit tests for deriveOpenAIContentSessionSeed covering:
  - Empty/nil inputs, model-only, stable across turns
  - Different model/system/first-user produce different seeds
  - Tools, functions, developer role, structured content
  - Responses API: input string, input array, instructions, input_text typed items
  - JSON canonicalization (whitespace/key-order insensitive)
  - Prefix presence, empty tools ignored, messages preferred over input
- 3 integration tests for GenerateSessionHash content fallback:
  - Content fallback produces stable hash
  - Explicit signals override content fallback
  - Empty body still returns empty hash
2026-04-02 00:11:17 +08:00
YanzheL c5aac1251d fix(gateway): add content-based session hash fallback for non-Codex clients
When no explicit session signals (session_id, conversation_id, prompt_cache_key)
are provided, derive a stable session seed from the request body content
(model + tools + system prompt + first user message) to enable sticky routing
and prompt caching for non-Codex clients using the Chat Completions API.

This mirrors the content-based fallback already present in GatewayService.
GenerateSessionHash, adapted for the OpenAI gateway's request formats (both
Chat Completions messages and Responses API input).

JSON fragments are canonicalized via normalizeCompatSeedJSON to ensure
semantically identical requests produce the same seed regardless of
whitespace or key ordering.

Closes #1421
2026-04-02 00:11:06 +08:00
YanzheL 649afef512 fix(handler): fallback known gemini models on v1beta 404 2026-04-01 02:20:13 +08:00
YanzheL 4514f3fc11 fix(gemini): resolve customtools alias in mapping lookup 2026-04-01 02:19:42 +08:00
YanzheL 095bef9554 fix(gemini): add customtools fallback metadata 2026-04-01 02:19:10 +08:00
YanzheL f00351c106 fix(openai): sanitize empty base64 input images 2026-04-01 00:46:38 +08:00
YanzheL 936fce68d0 fix(apicompat): skip empty base64 image URLs 2026-04-01 00:46:16 +08:00
YanzheL d978ac97f1 test(antigravity): cover mixed web search transforms 2026-04-01 00:46:14 +08:00
YanzheL dd5978f222 fix(gemini): normalize ai studio google search tools 2026-04-01 00:45:56 +08:00
YanzheL 0ebe0ce585 fix(gemini): preserve google search in Claude compat tools 2026-04-01 00:33:39 +08:00
YanzheL c8cfad7c00 fix(antigravity): preserve google search with function tools 2026-04-01 00:33:16 +08:00
YanzheL f2c2abe628 fix(openai): keep xhigh normalization scoped to messages 2026-03-29 21:09:19 +08:00
YanzheL ff5b467fbe fix(handler): normalize compat model for message routing 2026-03-29 20:53:14 +08:00
YanzheL 8c10941142 fix(openai): normalize gpt-5.4-xhigh compat mapping 2026-03-29 20:52:29 +08:00
YanzheL 1bff2292a6 fix: extract and log Claude output_config.effort in usage records
Claude's output_config.effort parameter (low/medium/high/max) was not
being extracted from requests or logged in the reasoning_effort column
of usage logs. Only the OpenAI path populated this field.

Changes:
- Extract output_config.effort in ParseGatewayRequest
- Add ReasoningEffort field to ForwardResult
- Populate reasoning_effort in both RecordUsage and RecordUsageWithLongContext
- Guard against overwriting service-set effort values in handler
- Update stale comments that described reasoning_effort as OpenAI-only
- Add unit tests for extraction, normalization, and persistence
2026-03-15 12:55:37 +08:00