fix(responses): accept and ignore include for chat-translated providers - #589
Conversation
Codex 0.122+ attaches include: ["reasoning.encrypted_content"] to every Responses request when wire_api = "responses". Chat-translated providers rejected the whole request, so the DeepSeek setup documented in the Codex guide could not be used at all. include only asks for extra annotations on response items; it never changes what the model does. Chat translation cannot produce those items, so the annotations are simply absent, exactly as they are for a native provider that does not support them. Accept the field and ignore it, including unrecognized future values, so a new include value cannot break clients again. message.output_text.logprobs stays rejected: it requests real model output rather than an annotation, the same reason top_logprobs is rejected. Fixes #532 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughGoModel now accepts annotation-only Responses ChangesResponses include compatibility
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. Accepted values are consistently removed during Responses-to-Chat conversion, unsupported output-logprob requests remain rejected, and the original request is preserved for surrounding gateway behavior.
What T-Rex did
Reviews (1): Last reviewed commit: "fix(responses): accept and ignore includ..." | Re-trigger Greptile |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Fixes #532.
Problem
Codex 0.122+ attaches
include: ["reasoning.encrypted_content"]to every Responses request whenwire_api = "responses". Chat-translated providers rejected the entire request:That made the DeepSeek + Codex setup documented in
docs/guides/codex.mdximpossible to use. I replayed a realistic Codex payload through the decoder and converter:includewas the only blocker — instructions, input items, function tools, reasoning effort and the rest already translate cleanly.Why accepting it does not weaken the compatibility rule
The adapter's rule is "never silently change the meaning of a request".
includedoes not fall under it. Every value in the enum only asks for extra annotations on response items — it cannot alter what the model does. Dropping it produces exactly the response a native provider that does not support that annotation would return: an absent optional field, never a wrong answer.The same line is already drawn elsewhere:
metadatais silently dropped by this converter, andstoreis honored at the gateway layer rather than the provider. Hosted-tool include values are inert here anyway, since hosted tools are rejected at the tools check.message.output_text.logprobsstays rejected — it requests real model output rather than an annotation, the same reasontop_logprobsis rejected.Unrecognized values are dropped too. A strict allowlist buys nothing (no include value can make a response wrong) and would guarantee the next Codex release breaks the integration again — which is exactly this bug.
Changes
internal/providers/responses_adapter.go: blanket rejection replaced withvalidateResponsesIncludeForChatTranslation(). One function, so it covers every chat-translated provider plus Anthropic's direct call into the converter. The caller'sreq.Includeis not mutated —ChatRequestnever carried it — so response snapshots and failover retries see the original request.internal/providers/responses_adapter_test.go: table tests for accepted values (encrypted reasoning, hosted-tool annotations, input echoes, an unrecognized future value) and rejected ones (alone, mixed, whitespace-padded), plus a regression test that decodes a real Codex body from JSON and asserts the full translation.includerow and an explanatory section inresponses-compatibility.mdx; a note in the Codex guide's DeepSeek section.User-visible impact
Codex, and any client that auto-attaches
include, now works over/v1/responsesagainst DeepSeek, Anthropic, Gemini and the other chat-translated providers. Native Responses providers are untouched — they still forwardincludeupstream. Responses simply carry no encrypted-reasoning or hosted-tool annotations on translated routes.Verification
gofmt,go vet,golangci-lint(0 issues), andgo test ./internal/... ./tests/contract/...all green; full pre-commit suite (race tests, perf guard, mint validate) passed.Not covered here: a live Codex → DeepSeek run.
verbosityandprompt_cache_keyare still forwarded verbatim to DeepSeek's/chat/completions, which is the next thing worth checking against the real API — separate from this fix.🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
includefield.Bug Fixes
includevalues.Tests