Repository navigation
Description
function_call_output for send_message_to_thread is persisted without call_id, breaking any strict Responses API provider
Summary
Rollout records for async cross-thread tool results (send_message_to_thread, namespace
codex_app) are written as function_call_output items without a call_id field.
OpenAI's own backend tolerates the malformed item. Any provider that strictly deserializes the
Responses API input array rejects the entire request:
Failed to deserialize the JSON body into the target type: input: missing field `call_id`
Because the bad record stays in thread history, the thread becomes permanently unusable on such
providers once that record falls inside the retained context window.
Environment
- Codex app (bundled codex):
0.154.0-alpha.6.2
(/Applications/ChatGPT.app/Contents/Resources/codex) - Codex CLI:
0.147.0 - macOS (Darwin 25.6.0), Apple silicon
- Provider: custom
[model_providers.*]entry pointing at an OpenAI-compatible
/responsesendpoint
Observed record
Taken from a rollout at ~/.codex/sessions/<yyyy>/<mm>/<dd>/*.jsonl:
{
"timestamp": "2026-09-16T...",
"type": "response_item",
"payload": {
"type": "function_call_output",
"id": "fco_01a06a8e-65c1-7e22-8b84-c42ca9cf1b6c",
"name": "send_message_to_thread",
"namespace": "codex_app",
"output": "<codex_delegation>...</codex_delegation>"
}
}call_id is absent. In the same thread, the corresponding calls are well-formed:
function_call send_message_to_thread 16 items — all carry call_id
function_call_output send_message_to_thread 6 items — none carry call_id
Positionally, these outputs appear at the start of a later turn (immediately following a
turn_context entry) — i.e. they are the async result of a delegation issued in a previous turn.
Scale and date range
Four long-lived threads in one workspace:
| thread | bad records | first occurrence |
|---|---|---|
| A | 284 | 2026-08-31 01:33:52 |
| B | 164 | 2026-08-31 08:57:50 |
| C | 221 | 2026-09-08 07:53:04 |
| D | 84 | 2026-09-04 03:55:12 |
- Tool attribution in thread A: 281 / 284 are
send_message_to_thread(3 have noname). - Month distribution in thread A (thread created 2026-07-18):
2026-07: 0,2026-08: 7,2026-09: 277.
Two independent threads both first show the defect on 2026-08-31, which should bracket the
regression window.
Minimal reproduction (API level)
Verified 2026-09-16 against a strict OpenAI-compatible /responses implementation:
POST {base_url}/responses
{
"model": "...",
"input": [
{"type": "message", "role": "user",
"content": [{"type": "input_text", "text": "hi"}]},
{"type": "function_call_output", "id": "fco_test", "output": "test"}
]
}
→ 400 {"error":{"message":"Failed to deserialize the JSON body into the target type:
input: missing field `call_id`", ...}}
Supplying an arbitrary call_id does not help either:
→ 400 {"error":{"message":"No tool call found for tool output with call_id call_test", ...}}
So the fix must produce an output that is paired with a real call, not merely populated.
Expected behaviour
Every function_call_output written to a rollout should carry the call_id of its originating
call. For async results whose originating call is no longer in the retained history, either
re-emit the call or drop the orphan output when constructing the Responses input array.
Impact
- Once a bad record enters the retained window, the thread fails on every turn and cannot be
recovered without manual mutation of the rollout files. - The async-result path keeps firing, so new bad records accumulate continuously — the
problem grows with use rather than being a one-off. - Users cannot tell which threads are affected until they hit the error; the failure looks like a
provider fault rather than a history-corruption fault.
Additional notes
- A codex-side log line exists:
Orphan function call output for call id: …, so orphan handling
is present — it just does not cover the missing field case, which is what breaks strict
deserializers. - Happy to provide redacted rollout excerpts or a script that counts affected records in a
CODEX_HOMEif that would help.
Activity
github-actions commentedon Sep 16, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
function_call_outputwithoutcall_idcause request rejection #45318function_call_outputwithoutcall_id, permanently breaking the target session (400 missing field call_id) #44723Powered by Codex Action
pluto1747-cybr commentedon Sep 25, 2026
Fresh cross-platform reproduction on Codex Desktop 26.917.71314 (still present)
Environment
26.917.71314(build 10954; Codex Framework 153.0.8010.53), bundled CLI0.155.0-alpha.16.4wire_api = "responses",base_url = https://api.deepseek.com, modeldeepseek-flashmulti_agent_version: v1(v2 is the separate known issue Subagent task payload invisible to custom non-OpenAI providers (DeepSeek): encrypted_content block dropped with multi_agent_version v2 #36586); threadturn_contextconfirmedmulti_agent_version: v1Repro — three routes, all fail on the first turn
create_threadwith a one-line prompt → 422send_message_to_threadto that thread → 422fork_thread, thensend_message_to_thread→ 422Request ids
create_thread:878daf04-78fb-4e44-8642-d706df6ba2f7create_thread:467f7001-4874-4505-a971-7755485a6715send_message_to_thread:e63e51b5-4ffa-4c62-89cf-a3fab8553a61fork_thread+ send:57b05ca4-6953-44dd-8938-016a6fab58deRollout evidence (macOS,
rollout-2026-09-25T19-13-52-01a0d845-9150-7801-9807-e9b9799e130d.jsonl)turn_contextwithmulti_agent_version=v1FunctionCallOutputitem keys =id, name, namespace, output, type— nocall_idunexpected status 422 Unprocessable Entity: ... input: missing field 'call_id' ... url: https://api.deepseek.com/responsesWorking control: a thread created manually in the UI can dispatch a subagent successfully on the same build/provider (v1 delivery + child repeats a verification token). The defect appears limited to threads the app creates programmatically (
create_thread/send_message_to_thread/fork_thread+ send), consistent with thekeep_forked_rollout_itemanalysis in #42088.New value here: still present on
26.917.71314, reproduces identically on macOS and Windows, and the manual-UI thread path is a working control.pluto1747-cybr commentedon Oct 14, 2026
kolya182 commentedon Oct 14, 2026
@etraut-openai @jif-oai Could you help route this issue to the team that owns the app-server and Responses request path?
I confirmed that this still reproduces with Codex CLI 0.162.1 and a custom Responses provider. Sending a read-only cross-thread message fails before the receiving thread runs:
Responses field 'input[].call_id' must be a non-empty string.The current
mainsource still creates the handoff result as afunction_call_outputwithout acall_id, and the custom-provider request path does not convert it. Please triage this report and confirm the owner or fix plan.MilesBao commentedon Nov 7, 2026
Additional evidence from Linux on 2026-11-07:
create_threaddelegation rejected by a custom Responses providerEnvironment:
0.156.1.gpt-6.1-solthrough a custom Packy Responses provider and a local forwarding router.The affected chat was created programmatically with
codex_app.create_thread. Its initial rollout contains this standalone item (identifiers and task text redacted):{ "type": "response_item", "payload": { "type": "function_call_output", "id": "fco_REDACTED", "name": "create_thread", "namespace": "codex_app", "output": "<codex_delegation>...redacted handoff...</codex_delegation>" } }There is no
call_idon this item and no correspondingfunction_callin the initial rollout. The session metadata marks it asagent_created_thread.Two turns failed with HTTP 400, at approximately 09:11 and 09:27 UTC on November 7. Both errors referenced the same
fco_...identifier from the initial delegation:The chat also executed tools successfully between those failures. Its later rollout contains 22 custom tool calls and 22 outputs, all paired by
call_id. Therefore this observation is intermittent; it does not demonstrate failure on every turn.The inspected local router changes the model name and forwards the JSON body, without normalizing delegation items. We did not capture the complete outbound payload of the failing request or compare with the first-party backend, so we cannot isolate the exact serialization or upstream validation step.
The user has moved the task to a manually created chat. We have not performed a controlled reproduction or a patched-client test. A proposed minimal reproduction is to create a chat with a harmless one-line prompt using
create_thread, then continue it through a strict Responses provider and inspect the persisted delegation item.This appears consistent with #45450 as well as this issue. Please ensure the provider-facing representation supports injected delegation context without requiring an unmatched tool result or dropping the handoff content. Merely inventing a
call_idwould not establish a matching call.nscottnichols commentedon Nov 23, 2026
Reproduced on Codex CLI 0.171.0 (Linux) with a custom Responses provider using
kimi-k3.1-pro.Two incoming
codex_tui.send_message_to_threaddeliveries persisted asfunction_call_outputrecords withfco_…IDs,namespace: "codex_tui", and<codex_delegation>output. Neither record had acall_idor a corresponding assistant tool call. Kimi rejected the resumed history because its tool messages could not resolve a tool name.features.untrusted_as_tool_output = falseprevents the separategoal_objectiverepresentation, but did not prevent these cross-thread records.I converted only those two positively identified records into user messages containing one
input_textitem:The migration changed
fco_…IDs tomsg_…, preserved metadata and passthrough fields, invented no call IDs, left genuine paired tool calls unchanged, and preserved unrelated rollout lines byte-for-byte. Validation found no remaining standalone outputs withoutcall_id, and a non-interactiveexec resume --ephemeralreturned the exact expected response without HTTP 400 or tool calls.Current
mainstill constructstool_outputwithcall_id: Noneinturn_processor.rs. A provider-facing request-normalization fix would avoid both inventing unmatched call IDs and requiring users to repair rollouts manually. I am preparing a patch that lowers named standalone outputs to external user-text messages for providers that do not support them, while preserving the existing OpenAI representation.nscottnichols commentedon Nov 23, 2026
Here is a tested reference implementation for maintainers, shared as issue material rather than an external PR.
Design
supports_standalone_function_call_output, defaulting totrueto preserve existing behavior.function_call_outputitems withoutcall_idare converted only on the request copy, leaving rollout history unchanged.fco_…IDs becomemsg_…IDs, relevant passthrough metadata is retained, genuine paired tool outputs are untouched, and no call ID is fabricated. Unnamed or encrypted items that cannot be converted losslessly remain unchanged.For a strict custom provider, the new setting is used as follows (substituting the configured provider ID):
Based on
maincommit1589e80b28536af91aef8c8c1671d4c3c428e571. Eight targeted tests pass with Rust 1.99.1 on Linux:Related coverage and limits
With
supports_standalone_function_call_output = false, the same request-copy normalization should apply to other named, standalonefunction_call_outputsources, including the reports linked below. These are potential regression fixtures, not independently verified producer-level fixes:function_call_outputwithoutcall_idcause request rejection #45318, Missing \call_id\ on injected standalone \unction_call_output\ also breaks normal thread resume / cross-thread send under third-party Responses providers #42067, and Standalone injected function_call_output is rejected by strict Responses providers; adding a call_id is not a sufficient repair #45450.function_call_outputwithoutcall_id, permanently breaking the target session (400 missing field call_id) #44723, [Windows] Thread heartbeat automation injects a function_call_output without call_id and permanently breaks the thread on strict Responses API providers #44519, Codex Desktop automation + DeepSeek Responses: standalone automation_update output lacks call_id (HTTP 400) #41690, and Automation turns persist function_call_output without call_id, permanently breaking sessions on strict Responses endpoints #49173.This does not rewrite persisted rollouts; normalization occurs on each outgoing request. It remains conditional on disabling the new provider capability. Unnamed or encrypted outputs are intentionally not converted.
#60420, involving parallel tool-batch ordering, and #44779, involving
tool_search, are separate problems and are not covered by this patch.Status checked on 2026-11-23: the reports linked above were open. Related closed examples include #61298 (duplicate), #62054 (not planned), and #62665 (not planned).
Full reference diff (12 files, 361 insertions)
nscottnichols commentedon Nov 27, 2026
Confirmed on stock Codex CLI 0.172.0.
The standalone cross-thread delivery path still produces a named
function_call_outputwithout acall_id:{ "type": "function_call_output", "name": "send_message_to_thread", "namespace": "codex_tui", "output": "<codex_delegation>…</codex_delegation>" }When this item is included in a request to a strict Responses provider, the request is rejected with HTTP 400.
These deliveries are new inputs to the receiving thread, not results of a tool invoked by that thread. Adding an arbitrary
call_idtherefore does not create a valid tool-result relationship. For affected providers, these standalone outputs should be normalized into external user messages during request assembly, while genuine tool calls and their paired outputs remain unchanged.A tested request-copy implementation of this normalization is included in the reference patch.
Blitzball996 commentedon Nov 28, 2026
I confirmed a compaction and resume case on Windows with stock Codex CLI 0.172.0 and a Responses-compatible HTTP endpoint.
function_call_outputitems namedcodex_tui.send_message_to_thread. All four contained<codex_delegation>text and omittedcall_id.compacted.payload.replacement_historyhad 17 entries, including the same four output bodies and zerofunction_callentries. The failure therefore does not require compaction to strip an ID from a previously valid tool result.function_call_output requires call_id on HTTP requests; continuation via previous_response_id is only supported on Responses WebSocket v2. Sending a normal user follow-up did not clear the affected checkpoint.replacement_history_metadataentries from that checkpoint. Earlier events stayed in the rollout. After reloading the same thread ID, I submitted plain user input. The client reported fallback from WebSockets to HTTPS, returned an assistant message and successfully ran a shell tool. No provider or model change was needed for this check.A regression test for the proposed request-time normalization could cover a cold resume from a compacted checkpoint with one standalone cross-thread notification and a genuine paired call/output. Assert that a strict HTTP endpoint accepts the resumed input, that the model still receives the notification content with its untrusted provenance, and that the real call's ID is preserved. We could not inspect intermediary traffic during the original failures; the observations above are from the client rollout and the recovery run.