Skip to content

fix: support Codex Responses Lite for GPT-5.6 models - #1983

Merged
tpae merged 2 commits into
mainfrom
bugfix/codex-user-agent
Jul 11, 2026
Merged

fix: support Codex Responses Lite for GPT-5.6 models#1983
tpae merged 2 commits into
mainfrom
bugfix/codex-user-agent

Conversation

@tpae

@tpae tpae commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

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 originator and User-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

  • Decode and preserve the live catalog's use_responses_lite capability instead of hardcoding model names.
  • Mirror codex-rs's User-Agent identity on catalog and chat requests.
  • For catalog-advertised Lite models only:
    • Generate a stable UUIDv7 per Osaurus conversation.
    • Send session-id, x-session-affinity, version, and x-openai-internal-codex-responses-lite: true.
    • Use that UUID for prompt_cache_key.
    • Move tools into a developer additional_tools input item.
    • Move system instructions into a developer message input item.
    • Force tool_choice: auto and parallel_tool_calls: false.
    • Add reasoning.context: all_turns.
    • Strip unsupported image detail hints recursively.
  • Keep GPT-5.5 and every catalog entry without use_responses_lite on the existing legacy Codex request path.

Test plan

  • swift test --filter "OpenAICodexOAuthServiceTests|RemoteChatRequestEncodingTests" — 140/140 pass
  • Regression coverage for catalog capability decoding
  • Regression coverage for Lite headers, UUIDv7 shape, body rewrite, and legacy request preservation
  • Live ChatGPT OAuth proof: reconnect provider, select gpt-5.6-luna, verify text and tool turns complete without 404

…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.
@github-actions github-actions Bot added the bug Something isn't working label Jul 11, 2026
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.
@tpae tpae changed the title fix: send Codex CLI-style User-Agent (gpt-5.6-luna 404 Model not found) fix: support Codex Responses Lite for GPT-5.6 models Jul 11, 2026
@tpae
tpae merged commit 7bdb440 into main Jul 11, 2026
6 checks passed
@tpae
tpae deleted the bugfix/codex-user-agent branch July 11, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant