Repository navigation
Description
What version of Codex CLI is running?
Codex CLI 0.169.0 / 0.170.0
What subscription do you have?
Pro
Which model were you using?
custom
What platform is your computer?
Darwin 27.0.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
Kitty
Codex doctor report
What issue are you seeing?
• Goal active Objective: This is a test
■ stream disconnected before completion: stream closed before response.completed
What steps can reproduce the bug?
- Configure a custom provider with
wire_api = "responses":
model_provider = "dashscope"
[model_providers.dashscope]
name = "dashscope"
base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1"
wire_api = "responses"
env_key = "DASHSCOPE_API_KEY"- Start codex with this provider, set a goal (any objective, e.g.
/goal 这是一个短goal测试). - The goal continuation turn starts automatically. Every sampling request fails immediately; after 5 retries codex shows:
stream disconnected before completion: stream closed before response.completed
Goal becomes "stalled". Without a goal, the same session/model/endpoint works fine.
Root cause
When a goal is active, codex injects the goal objective into the request input as a custom item:
{
"type": "function_call_output",
"id": "fco_01a1f6d0-b42b-7051-ace5-1a3ae4be459a",
"name": "goal_objective",
"namespace": "agent",
"output": "这是一个短goal测试"
}Per the Responses API schema, function_call_output requires a call_id referencing a preceding function_call. This item has none (and there is no matching function_call in the input). Providers that validate the schema reject the request.
The injection is unconditional with goal mode: it happens for short and long objectives alike, regardless of content. Short objectives are additionally inlined in the user_goal context message; long ones are redacted from the rollout, but the malformed item is always sent.
This is a regression: goals completed successfully on 2026-11-17 with the previous binary; the 0.169.0 binary was installed on 2026-11-18; all goal sessions fail from 2026-11-19 onward.
Observed provider error
DashScope returns HTTP 200 with an SSE error event (also see secondary issue below):
event:error
:HTTP_STATUS/400
data:{"code":"InvalidParameter","message":"Invalid 'call_id': call_id is required for function_call_output.","request_id":"0a6f00a1-cbe4-9d27-928a-cea5d65b1c77"}
Minimal reproduction (no codex needed)
POST to /v1/responses on any strictly validating provider:
{
"model": "glm-5.3-prime",
"stream": true,
"input": [
{"type": "function_call_output", "name": "goal_objective", "namespace": "agent", "output": "这是一个短goal测试"}
]
}Result: InvalidParameter: call_id is required for function_call_output.
Control: the same text as a regular user message completes normally. Deleting only the function_call_output item from a captured 335KB real codex goal request and replaying it unchanged also completes normally — this isolates the single offending item.
Secondary issue: SSE event:error not surfaced
Codex does not parse the provider's in-stream error event (event: error with :HTTP_STATUS/400), so a protocol-level rejection is reported as a connectivity problem:
stream disconnected before completion: stream closed before response.completed
This misleads users toward network/moderation/upstream-outage hypotheses (our investigation spent several wrong turns on exactly those). Surfacing the in-stream error payload would make the real cause visible immediately.
What is the expected behavior?
- Goal-mode requests should only contain schema-valid input items (e.g. inject the objective as a message, or a well-formed tool-call pair).
- In-stream
event: errorpayloads should be surfaced to the user instead of being reported as a stream disconnect.
Additional information
No response
Activity
github-actions commentedon Nov 20, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
errorevent is ignored and the turn is retried five times #61547Powered by Codex Action
r266-tech commentedon Nov 20, 2026
I reproduced the request shape on the published Codex CLI 0.171.0 Linux arm64 binary. I ran
codex app-serveragainst a scripted loopback Responses endpoint in a container with networking disabled. The fixture accepts a tool output when itscall_idmatches an input function call and returns HTTP 400 for an unmatched output.call_fixture_echogoal_objectiveoutput withnamespace: "agent"and nocall_idor matching callgoal_objectiveshapeFor each Goal case I completed an ordinary turn on a fresh thread, then set the objective with
thread/goal/setandstatus: "active". The release source adds the objective asAdditionalContextKind::Untrustedwhen it constructs the continuation. Goal continuation in 0.171.0With the fixture's HTTP 400 response,
turn/completedreportedfailedand included the fixture error text. The streamed error path is tracked in #61547.AI-assisted fixture and analysis.
etraut-openai commentedon Nov 21, 2026
(response from codex)
Thanks for investigating this. The current Responses API reference lists
call_idas optional forfunction_call_output. Codex intentionally uses a named output for goal context, but DashScope appears to requirecall_id.You can switch Codex to send that context as a message by adding this to
config.toml: