fix: preserve Codex Responses-Lite tools (#5103) - #5158
Closed
devonpmack wants to merge 2 commits into
Closed
Conversation
Codex 0.144 sends its additional_tools input item through the Responses-Lite path. Preserve that opaque extension across Bifrost request conversion so nested tool discriminators and grammars reach OpenAI unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
📝 WalkthroughWalkthrough
ChangesOpaque Responses Item Preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant OpenAIResponsesRequest
participant bifrostRequest
participant DeepCopyResponsesMessage
OpenAIResponsesRequest->>bifrostRequest: Convert request with additional_tools
bifrostRequest->>DeepCopyResponsesMessage: Deep-copy input messages
DeepCopyResponsesMessage-->>bifrostRequest: Return copied opaque item bytes
bifrostRequest->>OpenAIResponsesRequest: Convert request back
OpenAIResponsesRequest-->>OpenAIResponsesRequest: Marshal and inspect nested tool fields
🚥 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 |
devonpmack
marked this pull request as ready for review
July 13, 2026 21:10
Contributor
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "tests: exercise Codex gateway JSON path" | Re-trigger Greptile |
Use the same Sonic parser and sorted provider encoder as the HTTP gateway so the Responses-Lite regression covers the production serialization path. Co-authored-by: Cursor <cursoragent@cursor.com>
coderabbitai
Bot
requested review from
TejasGhatte,
akshaydeo,
danpiths and
roroghost17
July 13, 2026 21:26
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
Backports the core Codex compatibility fix from #5103 to
main, where the release branch still lacks it. This preserves Codex 0.144'sadditional_toolsResponses input item across Bifrost's OpenAI conversion; without it, Bifrost decodes the nested Responses tool union as MCP list-tools data and strips requiredtypediscriminators before forwarding the request.Changes
additional_toolslike existing Codextool_searchextensions and round-trip it as an opaque Responses itemReproduction proof
A request captured directly from
@openai/codex@0.144.0contains this Responses-Lite item:{ "type": "additional_tools", "role": "developer", "tools": [ { "type": "custom", "name": "exec", "format": { "type": "grammar", "syntax": "lark" } }, { "type": "namespace", "name": "collaboration", "tools": [{ "type": "function", "name": "spawn_agent" }] } ] }Before the fix, the regression test reproduced the production failure: Bifrost forwarded those entries as
{"name":"exec","input_schema":null}and{"name":"collaboration","input_schema":null}, dropping every requiredtypediscriminator. OpenAI then rejected the request with:After the fix, the captured item survives Bifrost's Sonic HTTP parser, inbound conversion, deep-copy path, outbound conversion, and provider JSON encoder with the
custom,namespace, nestedfunction, and Lark grammar fields intact:Real Codex acceptance test
Built
bifrost-httpfrom this branch using the local Go workspace, then ran Codex 0.144 against it with the bundledgpt-5.6-solcatalog metadata (Responses-Lite, tool mode, and multi-agent enabled). The local gateway's OpenAI provider used an upstream raw passthrough endpoint so this branch was the only Bifrost conversion layer.The run exercised the custom
execgrammar, collaboration namespace, sub-agent spawn/wait, streaming responses, and multi-turn collaboration history. The gateway recorded eightPOST /openai/v1/responsesrequests, all HTTP 200, with no parse errors.Type of change
Affected areas
How to test
The broad
go test ./...reaches unrelated MCP integration tests that require generatedexamples/mcps/test-tools-server/dist/index.js; the packages changed by this PR pass.Screenshots/Recordings
Not applicable.
Breaking changes
Related issues
Backports the core fix from #5103, which is already merged on the
devbranch. Thismainbackport also covers the opaque-item deep-copy and exact gateway JSON path.Reproduced from a Codex 0.144 request rejected upstream with
Missing required parameter: input[0].tools[0].type.Security considerations
No auth, secret, or PII changes. The fix preserves an OpenAI-native request extension instead of partially decoding and rewriting it.
Checklist
docs/contributing/README.mdand followed the guidelines