fix: support Codex Responses Lite for GPT-5.6 models - #1983
Merged
Conversation
…s (gpt-5.6-luna 404) The Codex backend routes some models (gpt-5.6-luna in particular) to internal engines based on the originator + User-Agent identity. Osaurus sent originator: codex_cli_rs but left the default CFNetwork user agent, so luna requests resolved to a missing engine cohort and failed with HTTP 404 "Model not found gpt-5.6-luna" (openai/codex#31967; live A/B in Wei-Shaw/sub2api#3983 shows adding the two identity headers fixes it). Mirror codex-rs's get_codex_user_agent() format (codex_cli_rs/<version> (<os> <ver>; <arch>) <terminal>) on both the /models catalog fetch and /codex/responses chat requests.
GPT-5.6 models require a different request contract, not only Codex identity headers. Preserve the live catalog's use_responses_lite capability and use it to add UUIDv7 session affinity, Lite headers, and the required developer-item payload rewrite while leaving legacy Codex models unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1981. The authenticated Codex catalog correctly lists GPT-5.6 Sol, Terra, and Luna, but those models use Codex's Responses Lite contract. Sending a legacy Responses request causes Luna to fail with
HTTP 404: Model not found gpt-5.6-luna.The first version of this PR only mirrored Codex's
originatorandUser-Agent. That was incomplete. Live A/B evidence from anomalyco/opencode#36143 shows identity headers alone still return 404; the request succeeds only after the full Responses Lite rewrite.Changes
use_responses_litecapability instead of hardcoding model names.session-id,x-session-affinity,version, andx-openai-internal-codex-responses-lite: true.prompt_cache_key.additional_toolsinput item.tool_choice: autoandparallel_tool_calls: false.reasoning.context: all_turns.detailhints recursively.use_responses_liteon the existing legacy Codex request path.Test plan
swift test --filter "OpenAICodexOAuthServiceTests|RemoteChatRequestEncodingTests"— 140/140 passgpt-5.6-luna, verify text and tool turns complete without 404