fix(codex): skip pass-through for unsupported response limits - #2217
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pass-through flow now consults an optional transformer policy before reusing inbound request bodies. Codex Responses requests with token-limit fields reject pass-through. Tests cover rejection and allowed bodies. ChangesPass-through policy
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to The PR limits Codex pass-through for unsupported token-limit request bodies while preserving existing behavior for other channels; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Orchestrator
participant CodexTransformer
participant RequestBody
Orchestrator->>CodexTransformer: Check AllowPassThroughBody
CodexTransformer->>RequestBody: Inspect token-limit fields
RequestBody-->>CodexTransformer: Field presence
CodexTransformer-->>Orchestrator: Allow or reject pass-through
Orchestrator->>RequestBody: Reuse inbound body only when allowed
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
466aec3 to
90b377c
Compare
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
90b377c to
ac93238
Compare
* upstream/unstable: (48 commits) fix(codex): skip pass-through for unsupported response limits (looplj#2217) fix(responses): preserve image tool_choice without pass-through (looplj#2218) chore(actions): upgrade workflows to node24 actions (looplj#2219) fix(prompts): Parse project GUIDs in prompt schema (looplj#2200) feat: add xai_responses channel type (looplj#2212) fix(responses): harden stream terminal, retry, and resource boundaries (looplj#2196) fix(trace): only persist explicitly identified traces (looplj#2208) feat: hide unroutable configured models from public lists (looplj#2215) feat(quota): track OpenCode Go quota via official usage API (looplj#2204) fix: align codex quota bar colors (looplj#2166) feat(quota): add Charm Hyper credit balance checker (looplj#2199) fix(i18n): change currency code example from RMB to CNY (looplj#2202) feat: unify auto-refresh controls and stabilize list animations (looplj#2198) opt: anthropic signature recognization (looplj#2197) fix: model associate condition caused model not found, close looplj#2183 (looplj#2194) fix(responses): retry incomplete streams before done (looplj#2192) feat: show request cache rate, close looplj#2170 (looplj#2193) chore: add log for chat heartbeat (looplj#2191) fix(sqlite-time-format-compat): 兼容 SQLite TEXT 时间戳格式并修复 backup 注册时区退化 (looplj#2189) feat(models): add thinkingmachines as model developer (looplj#2190) ... # Conflicts: # .github/workflows/docker-publish.yml
Summary
Root cause
Codex outbound removes token limit fields before sending upstream, but the generic pass-through middleware could later restore the original OpenAI Responses body. Requests with fields like
max_output_tokensthen reached Codex unchanged and failed with HTTP 400, while fallback OpenAI Responses-compatible channels such as ZenMux succeeded.Current pass-through enablement
Body pass-through is enabled only when all generic orchestrator checks pass: current channel exists, provider request has an API format, inbound LLM API format equals outbound provider API format, original/effective stream semantics match, and channel/global pass-through setting is enabled. After that, an optional outbound policy can veto pass-through for provider-specific incompatibilities.
Tests
go test ./internal/server/orchestrator -run 'TestApplyPassThroughBody(SkipsWhenOutboundPolicyRejects|PreservesMappedModel|PreservesAlignedStreamWithoutPatchingIt)' -count=1\n-cd llm && go test ./transformer/openai/codex -run 'TestCodexOutbound_(RejectsPassThroughBodyWithTokenLimitFields|AllowsPassThroughBodyWithoutTokenLimitFields|StreamAcceptHeader)' -count=1Summary by CodeRabbit