Repository navigation
fix(openai): normalize additional Codex context on HTTP Responses - #8769
Merged
Wei-Shaw merged 1 commit intoNov 16, 2026
Merged
Conversation
This was referenced Nov 16, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Codex 0.169.0 can send additional context as standalone
agentfunction outputs without a model-issuedcall_id. With v0.2.21 / currentmain,browser_info,goal_objectiveanduntrusted_contextare rejected locally with HTTP 400, before an upstream account is selected. This extends the existing page-context normalization from #8622 to those three observed names.Reproduction
Send this to
POST /v1/responses, substituting a configured model and the usual authorization header:{ "model": "<configured-model>", "stream": true, "input": [ {"role": "user", "content": "Reply with the diagnostic marker in external context."}, { "type": "function_call_output", "namespace": "agent", "name": "browser_info", "output": "CONTEXT_MARKER_123" } ] }The response is
400 invalid_request_error:function_call_output requires call_id on HTTP requests; continuation via previous_response_id is only supported on Responses WebSocket v2. The same rejection reproduces withgoal_objectiveoruntrusted_context. Ordinary text succeeds.Codex's v0.169.0 additional-context constructor emits
call_id: None, namespaceagent, and a name supplied explicitly or derived from the caller's context key. openai/codex#60487 enablesuntrusted_as_tool_outputby default. These three names are a bounded observed set, not the complete set of possible names.Configuration investigation
We checked the server's rectifier, account passthrough/protocol options, model/header mappings, retry/fallback, error passthrough and WebSocket settings against the request path. None of the investigated server settings changes this pre-routing HTTP validation for the same incoming request. Merely enabling a server WebSocket option does not switch a client's HTTP request to WebSocket.
There is a working client workaround:
untrusted_as_tool_output=false. A fresh official Codex 0.169.0 session completed two turns through the public gateway with that setting;codex --disable untrusted_as_tool_outputalso worked. That requires changing each affected client. The proposed gateway fallback handles the tested inputs while leaving the client feature enabled.Change and boundaries
agent, a missing or blank stringcall_id, and nonblank textualoutput.input_textwith<external_NAME>…</external_NAME>delimiters, following the existing Pages compatibility strategy. Preserve text, ordering, unrelated history,previous_response_idand numeric precision. Existing Pages formatting is unchanged.This deliberately changes the representation and role of recognized context. Text delimiters are not equivalent to native untrusted-context semantics. It is a narrow compatibility fallback, not a wildcard acceptance of arbitrary function outputs.
Relationship to #8680
#8680 proposes preserving native context instead of converting it to user messages. At its current head (
19b0c17477d2), its allowlist recognizesbrowser_tabsanduntrusted_content, but not thebrowser_infoanduntrusted_contextinputs above;goal_objectiveoverlaps.Our directly tested API-key upstream paths rejected these original shapes with missing-call-ID errors while ordinary text succeeded; another upstream accepted them. This does not imply that every API-key or OAuth upstream rejects native context. This PR offers a minimal extension of #8622 for the observed HTTP compatibility gap; maintainers may prefer to incorporate its cases into #8680 with an appropriate compatibility strategy.
Validation
On this upstream-based branch:
go test -tags=unit ./internal/handler -count=1 -timeout=180sgo test -tags=unit ./internal/handler -run '^TestNormalizeCodex' -count=1 -timeout=120safter adding boundary casesgo test -tags=unit ./internal/service -run '^TestValidateFunctionCallOutput' -count=1 -timeout=120sgofmtandgit diff --checkRegression tests cover the three names, blank call IDs, mixed contexts, idempotence, real/malformed outputs, duplicate members, Pages behavior and history/numeric preservation.
Separately, the same backend implementation was tested through a deployed public gateway using official Codex 0.169.0 on macOS: feature enabled, HTTP 400 before; two completed HTTP 200 turns after, with changing context markers preserved. Public SSE probes for all three names, existing Pages and ordinary text completed. A model-generated tool call followed by its actual
call_idoutput plus standalone context also completed; an unrelated missing-ID ordinary output still returned 400. This validates the tested protocol path, not recovery of any pre-existing affected session.Refs #8609. Follow-up to #8622; alternative/overlapping work: #8680.