• YanzheL's avatar
    fix(gateway): add content-based session hash fallback for non-Codex clients · 16c7bd31
    YanzheL authored and 陈曦's avatar 陈曦 committed
    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
    16c7bd31
openai_content_session_seed.go 3.07 KB