Skip to content

fix(responses): accept and ignore include for chat-translated providers - #589

Merged
SantiagoDePolonia merged 1 commit into
mainfrom
fix/include
Jul 25, 2026
Merged

fix(responses): accept and ignore include for chat-translated providers#589
SantiagoDePolonia merged 1 commit into
mainfrom
fix/include

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #532.

Problem

Codex 0.122+ attaches include: ["reasoning.encrypted_content"] to every Responses request when wire_api = "responses". Chat-translated providers rejected the entire request:

responses field "include" is only supported by native Responses providers;
use an OpenAI-compatible provider or passthrough for this request

That made the DeepSeek + Codex setup documented in docs/guides/codex.mdx impossible to use. I replayed a realistic Codex payload through the decoder and converter: include was 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". include does 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: metadata is silently dropped by this converter, and store is 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.logprobs stays rejected — it requests real model output rather than an annotation, the same reason top_logprobs is 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 with validateResponsesIncludeForChatTranslation(). One function, so it covers every chat-translated provider plus Anthropic's direct call into the converter. The caller's req.Include is not mutated — ChatRequest never 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.
  • Docs: include row and an explanatory section in responses-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/responses against DeepSeek, Anthropic, Gemini and the other chat-translated providers. Native Responses providers are untouched — they still forward include upstream. Responses simply carry no encrypted-reasoning or hosted-tool annotations on translated routes.

Verification

gofmt, go vet, golangci-lint (0 issues), and go 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. verbosity and prompt_cache_key are 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

    • Documented support for the OpenAI Responses include field.
    • Clarified how annotation requests behave across native and chat-translated providers.
    • Added guidance for Codex requests and encrypted reasoning content.
  • Bug Fixes

    • Chat-translated providers now accept supported annotation-only include values.
    • Requests for output log probabilities continue to return a clear validation error.
  • Tests

    • Added coverage for annotation handling, Codex request translation, and invalid log probability requests.

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>
Copilot AI review requested due to automatic review settings July 25, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1065878b-b740-4973-9734-9293338b8dd4

📥 Commits

Reviewing files that changed from the base of the PR and between d05696b and 52e2386.

📒 Files selected for processing (4)
  • docs/advanced/responses-compatibility.mdx
  • docs/guides/codex.mdx
  • internal/providers/responses_adapter.go
  • internal/providers/responses_adapter_test.go

📝 Walkthrough

Walkthrough

GoModel now accepts annotation-only Responses include values during chat translation, drops them from translated requests, and rejects message.output_text.logprobs. Tests cover annotation handling, Codex request translation, and rejection cases. Documentation describes the compatibility behavior.

Changes

Responses include compatibility

Layer / File(s) Summary
Include validation and translation
internal/providers/responses_adapter.go, internal/providers/responses_adapter_test.go
Chat-translated requests accept annotation-only include values without forwarding them, while output logprobs values are rejected. Tests cover annotation-only inputs, Codex payload translation, mixed values, and whitespace.
Include compatibility documentation
docs/advanced/responses-compatibility.mdx, docs/guides/codex.mdx
Documentation explains provider behavior for include, including Codex encrypted reasoning requests and the output logprobs exception.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

Poem

A bunny hops through fields of text,
Drops annotations, neat and next.
Logprobs knock? “No entry here!”
Codex now proceeds without fear.
Tests and docs join in the cheer.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: allowing include for chat-translated Responses providers.
Description check ✅ Passed The description is detailed and explains the problem, fix, impact, and verification, though it doesn't use the template headings verbatim.
Linked Issues check ✅ Passed The PR matches #532 by ignoring include during chat translation, preserving native forwarding, and keeping logprobs rejected.
Out of Scope Changes check ✅ Passed The changes stay on-scope with the issue: code, tests, and docs all support the include handling fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/include

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟢 Ready View Preview Jul 25, 2026, 4:33 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The 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.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran a general-contract-validation-proof comparison, noting that the pre-replay step rejected reasoning.encrypted_content as an unsupported include field.
  • T-Rex observed that the post-replay run accepted the include field and produced two messages and one normalized function tool, while preserving streaming and reporting include_forwarded=false.
  • T-Rex verified that after replay, the output-logprob include was rejected.
  • T-Rex confirmed that all PR-focused adapter tests passed.
  • T-Rex captured and organized artifacts (three logs and a Go artifact) to support reviewer inspection.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(responses): accept and ignore includ..." | Re-trigger Greptile

@SantiagoDePolonia
SantiagoDePolonia merged commit 8210cda into main Jul 25, 2026
21 checks passed
@mintlify

mintlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟡 Building Jul 25, 2026, 4:33 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex + DeepSeek fails: include field rejected in chat-translated Responses requests

3 participants