Skip to content

responses: function_call_output can be emitted without call_id and fails strict upstreams (400) #42088

Open

Description

@SIMON-WORLD

Environment

  • Codex Desktop 26.825.51511 / app-server 0.151.0-alpha.7.2
  • Upstream: a strict OpenAI-compatible /responses server (e.g. DeepSeek)

Symptom

Resuming an existing thread, or sending a message into a thread that contains a prior tool call, fails with:

Failed to deserialize the JSON body into the target type: input: missing field `call_id` at line 1 column ~...

Root cause

A response_item of type: "function_call_output" in the replayed input array carries id, name, namespace, output, and internal_chat_message_metadata_passthrough, but is missing call_id. The Responses API requires call_id on function_call_output to link it to the matching function_call. Strict deserializers (e.g. DeepSeek) reject the entire request at the wire layer, so a single dangling item breaks every message in the thread.

Minimal repro shape:

{
  "type": "function_call_output",
  "id": "...",
  "name": "...",
  "namespace": "",
  "output": [{"type": "output_text", "text": "..."}],
  "internal_chat_message_metadata_passthrough": {}
  // missing: "call_id"
}

Related

Expected behavior

Pick one (preferably the first):

  1. Always emit call_id on function_call_output, sourced from its matching function_call.
  2. Omit function_call_output items that have no corresponding function_call in the same request (dangling outputs are invalid).
  3. At minimum, validate/normalize input before serialization so a malformed item cannot fail-close the whole request.

Suggested fix location

The thread/session serialization path that reconstructs input items on restore/continue. A function_call_output should either carry a call_id that matches its function_call, or be dropped when unmatched.

Impact

Any strict /responses upstream cannot resume/replay threads containing such an item; one missing call_id fails the whole stream.

Activity

  1. added
    bug
    app
    app-server
    custom-model
    tool-calls
    on Sep 1, 2026
  2. SIMON-WORLD commented on Sep 1, 2026

    @SIMON-WORLD
    Author

    Additional observation (same Codex Desktop update regression)

    With the same Codex Desktop build (26.825.51511 / app-server 0.151.0-alpha.7.2), when a cross-thread/session-injected user message arrives in a receiving thread that carries a very large instructions context (e.g. AGENTS.md + handoff docs, often >100KB), the model may not treat that injected message as the current turn: the assistant responds as if no task was given, even though the user message is present in input and is the last item. This is consistent with the thread-reconstruction regression in #41690.

    Repro: send a concrete, imperative task to a fresh worker thread via the orchestration tools (create_thread / send_message_to_thread); the worker replies "no task provided / waiting for instructions" despite receiving a full, explicit task. Reproduced across several imperative prompts.

    Impact: breaks session/orchestration workflows that rely on a cross-thread user turn being executed immediately.

    Suggested direction: when assembling input for a thread, ensure a freshly injected user message is the terminal executable turn, and that a large instructions payload cannot shadow it (e.g., place guidance before the injected user turn, or hand off rather than re-inject the whole context).

  3. svkozak commented on Sep 1, 2026

    @svkozak

    Same issue when using a /responses compatible proxy:

    Error code: 400 - {'error': {'message': "Invalid Value: 'input.call_id'. Function call output requires call_id.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}
    

    This specifically affects automations, they are all broken.

  4. hong2499947306-svg commented on Sep 2, 2026

    @hong2499947306-svg

    I'm hitting the same issue with Codex Desktop + custom provider (wire_api = "responses") + Automation.Symptom: Automation fails immediately with function_call_output requires call_id on HTTP requests; continuation via previous_response_id is only supported on Responses WebSocket v2.Evidence: Session JSONL shows the injected function_call_output has an id but no call_id.Workarounds tried:
    Added supports_websockets = true to config → no effect
    Enabled responses_websockets_v2 feature flag → no effect
    It seems the Automation runtime hardcodes HTTP transport and injects a function_call_output without call_id, which violates the Responses API spec for HTTP.Please prioritize fixing this, as it blocks all Automation usage with custom providers.

  5. NWYLZW commented on Sep 3, 2026

    @NWYLZW

    Additional reproduction: Codex Desktop task orchestration

    Correction to the originally posted environment: the active host process was running from /Applications/ChatGPT.app, not the retained /Applications/Codex.app compatibility bundle.

    Environment:

    • Active Codex App 26.901.20858 (build 7658)
    • Bundled Codex CLI/app-server 0.153.0-alpha.5
    • macOS: Darwin 25.5.0 arm64

    A concrete reproduction through the built-in cross-task tools:

    1. From a parent task, call create_thread with a trivial prompt such as hi.
    2. The child task starts and can answer the trivial prompt normally.
    3. Deliver a concrete work instruction to that child via send_message_to_thread.
    4. The child UI displays the message as sent from another task, but execution fails before doing the work with:
    code: ; message: Invalid Value: 'input.call_id'. Function call output requires call_id.
    

    Restarting Codex Desktop did not clear the failure.

    This narrows the trigger in this environment: initial task creation can succeed, while replay/delivery of the subsequent cross-task message produces an invalid function_call_output without call_id. No project-specific code is required to trigger it. Internal paths, task IDs, and project content are omitted.

  6. HuaFireX commented on Sep 7, 2026

    @HuaFireX

    I reproduced the same issue on 2026-09-07 (Asia/Shanghai) with Codex Desktop.

    Both creating a new projectless/project session and sending a follow-up message to the created thread fail before the assistant produces any output. Retrying produces the same error:

    function_call_output requires item_reference ids matching each call_id,
    or previous_response_id/tool_call context

    This appears to affect cross-thread/session orchestration. The main thread remains functional, and existing threads can still be listed/read.

    Request IDs:
    202609070938295333435638268d9d6cUpwmB5a
    20260907173828362768325Hz4gSh4I

  7. seanford commented on Sep 8, 2026

    @seanford

    Windows 11 / Azure: same-day recurrence after verified recovery in 0.153.4

    Adding a verified recurrence to this issue. The first conversation repair worked: the original malformed entries remained repaired and the task continued successfully. Later worker messages inserted new malformed entries and broke the same task again.

    Environment:

    • Codex Windows package: 26.901.6511.0
    • Bundled CLI/app-server: 0.153.4
    • Windows 11 x64, build 26200
    • Recipient model on failed retries: gpt-5.6-sol
    • Azure OpenAI v1 provider, wire_api = "responses"
    • Trigger: built-in codex_app.send_message_to_thread delivering worker reports to an existing parent task

    Exact error:

    {
      "error": {
        "message": "Invalid Value: 'input.call_id'. Function call output requires call_id.",
        "type": "invalid_request_error",
        "param": "input",
        "code": null
      }
    }

    The persisted incoming report has this shape (values redacted):

    {
      "type": "response_item",
      "payload": {
        "type": "function_call_output",
        "id": "fco_REDACTED",
        "name": "send_message_to_thread",
        "namespace": "codex_app",
        "output": "<codex_delegation>...worker report redacted...</codex_delegation>",
        "internal_chat_message_metadata_passthrough": {}
      }
    }

    There is no call_id. This is an unsolicited incoming report, not a result paired with a function call made by the recipient.

    Observed sequence on 2026-09-08, all times UTC:

    1. Four such records first broke the task at approximately 15:33.
    2. At 16:43:21, after backing up the complete conversation and fully exiting Codex, those four records were converted to the existing native agent_message representation, preserving the worker source, report text, and turn metadata. All other 17,039 records were byte-identical.
    3. The recovered task resumed actual work. Its rollout records a successful completed turn at 19:09:57.
    4. At 21:38:10.907, another worker report was persisted as a new call-ID-less codex_app.send_message_to_thread output. The recipient failed at 21:38:11.831 with the error above.
    5. Two workers continued sending reports through this path. The recurrence inspection ultimately found 14 new malformed records. The four previously repaired records were still valid agent_message records; they had not reverted.
    6. Ordinary retries and further incoming messages continued failing before a model response. Each additional incoming report added another invalid record to the saved history.

    Reproduction: use an otherwise working Azure Responses task, deliver a worker report with send_message_to_thread, and retry the recipient. After repairing its history, deliver another report through the same app tool: the failure returns. Native collaboration messages were already present in successful portions of this conversation.

    Expected: represent unsolicited task/worker messages as compatible context messages with preserved provenance. If a real function result is serialized, its call_id must correspond to a real call. Validate or normalize these items both when inserting them and when replaying existing history; repairing old records alone does not prevent new corruption.

    This adds Windows/current-stable evidence and a confirmed repair-then-recurrence sequence to the existing cross-task reports. Endpoint hostnames, credentials, project names, local paths, task IDs, and report contents are omitted. No full conversation logs are attached.

  8. 0okay commented on Sep 11, 2026

    @0okay

    Additional DeepSeek data point: create_thread on its own seeds a thread that is dead on its very first turn.

    Environment

    • Codex Desktop 26.903.9818.0 (Windows x64), bundled codex-cli 0.153.4
    • Custom provider in config.toml: wire_api = "responses", base_url = "https://api.deepseek.com", model = "deepseek-flash"
    • Normal interactive turns in trusted threads work fine on this same provider; only app-injected items fail.

    What happened

    1. Delegated a task with the app tool create_thread (target: an existing project, environment.type = "local").

    2. The returned thread's first turn failed after ~2.8 s with:

      Failed to deserialize the JSON body into the target type:
      input: missing field `call_id` at line 1 column 149415
      
    3. That turn contains exactly one item — the injected delegation output itself:

      {
        "type": "function_call_output",
        "id": "fco_...",
        "name": "create_thread",
        "namespace": "codex_app",
        "output": "<codex_delegation>...</codex_delegation>",
        "internal_chat_message_metadata_passthrough": {}
      }

      No call_id, and there is no matching function_call because the thread has no prior history at all. The thread therefore never works even once.

    4. The same failure mode also reproduces with send_message_to_thread into an existing DeepSeek thread. In that thread the rollout holds 122 function_call entries and 122 function_call_output entries, all call_id-paired, plus exactly one unmatched output — the injected delegation item. After it was written, every later turn in that thread, including plain user messages, failed with the identical 400.

    So on a strict Responses provider each of the two delegation tools (create_thread, send_message_to_thread) is sufficient on its own to produce a permanently unusable thread, and for create_thread the thread is broken before the model ever sees the prompt.

    Local workaround (confirms the item is the only defect)

    Delete the single unmatched function_call_output from the thread rollout (the remaining history is perfectly paired) and reopen the thread; it resumes normally. The practical mitigation meanwhile is to avoid app-tool delivery on strict Responses providers.

    Related

    #41690, #42067, #43515 (Kimi — lists delegation paths), #44519, #44723. Flagging #43515 as the closest match on the delegation trigger; this comment adds the DeepSeek repro and the "dead on first turn" detail for create_thread.

  9. argszero commented on Sep 11, 2026

    @argszero

    Tracing @0okay's "dead on first turn" case and @seanford's repair-then-recurrence sequence to current main, I think the mechanism is now fully pinned, and it is a design tension rather than a missing check — which is why repairing history keeps working while new deliveries keep breaking it. All line numbers below are from origin/main @ 02a8f038b8.

    The item is not "an output that lost its call_id"

    FunctionCallOutput carries two optional fields (protocol/src/models.rs:1101-1113): id: Option<ResponseItemId> and call_id: Option<String>. That distinction matters, because the reported shape is not "unpaired" — it is an output whose call_id slot was replaced by a synthetic id.

    The production producer of the delegation path is app-server turn/start with toolOutput:

    • The parameter is TurnToolOutput { name, namespace, output } (app-server-protocol/src/protocol/v2/turn.rs:145-149, referenced at :166). There is no field through which a client could supply a pairing, and thread/inject_items is a separate RPC.
    • Validation only forbids combining it with nonempty input and requires a nonempty name (app-server/src/request_processors/turn_processor.rs:536-544), then it builds FunctionCallOutput { id: None, call_id: None, name: Some(tool_output.name), .. } (:592-603).
    • id_prefix() maps that variant to "fco" (models.rs:1305), and assign_missing_response_item_id fills an empty id via ResponseItemId::new(prefix) (core/src/session/mod.rs:3443-3451), reached through the dedicated standalone-output arm at core/src/session/turn_input.rs:672-676.

    So id: "fco_..." with the call_id key absent is exactly what this path produces — it is not corruption in the rollout. It also explains @0okay's first-turn case structurally: toolOutput cannot be combined with nonempty input (:537-541), and a standalone output is explicitly accepted as an entire turn's input (core/src/session/turn_input.rs:255-260), so a brand-new thread's sole input item is an unpaired output. Replay fails at the first request, and since history is replayed on every later turn, every report's "permanently unusable thread" follows.

    Why no existing guard heals it

    There is a production orphan-drop guard on the request path: normalize_history (core/src/context_manager/history.rs:707-719) calls remove_orphan_outputs (:714), which flags unmatched outputs at core/src/context_manager/normalize.rs:184-192. Look at the run match arm: it is FunctionCallOutput { call_id: Some(call_id), .. } if !function_call_ids.contains(..). A call_id: None item cannot match, so it is skipped by construction — and that is correct per the invariant documented one line above the call: "every output has a corresponding call entry or names an external tool event" (history.rs:703-706, reiterated at :713). Re-pairing null with the enclosing function_call would be wrong for the same reason: it would not fix the column, it would just make a null look valid.

    The "stand alone" behaviour is a deliberate, locked contract, not an oversight — introduced for exactly this use case ("External tool events may need to enter thread history without a preceding function call", PR #39782) and extended to turn routing in PR #40991. It is pinned by a protocol round-trip test (models.rs:3208, named_unpaired_function_call_output_round_trips_without_call_id) and allowed by the test harness itself, which lets name-bearing unpaired function_call_output items pass its own invariant check (core/tests/common/responses.rs:1560-1567). That divergence is why this never fails in CI: the mock encodes the OpenAI-tolerant reading, while the deployment targets cited in this thread (Kimi, DeepSeek, Azure, the /responses proxy) require the paired reading.

    Where a fix can actually go

    Two things are true at once: the item is legitimate under this repo's contract, and it is unrepresentable to a provider that requires pairing. So the choice is a policy decision at request assembly, and the injection site is not the place to make it.

    The house pattern already exists at precisely that spot. Request assembly computes is_openai (core/src/client.rs:794) and then mutates input per provider (:833) — clearing metadata passthrough and stripping encrypted args. A provider-conditional rewrite would slot in there. There is also a first-class flag precedent for this exact class of "capability varies by provider": supports_standalone_web_search (model-provider-info/src/lib.rs:154), declared true on the builtin OpenAI provider and false on custom ones (:497 vs :533), then consumed as an availability gate in ext/web-search/src/extension.rs:45-47. A companion flag for standalone function outputs would be more honest than gating on is_openai, which is plain name equality against "OpenAI" (lib.rs:546) and therefore says nothing about whether a given wire endpoint requires pairing.

    Treatment options, with the trade-offs I can see:

    1. Rewrite the standalone output into a context item the provider understands, gated on the capability flag. This is what the manual workaround repairs toward, and what @seanford asks for ("represent unsolicited task/worker messages as compatible context messages with preserved provenance"). The repo already has a conversion for unsolicited inter-agent deliveries — InterAgentCommunication::to_model_input_item (protocol/src/protocol.rs:889-913) — but note it emits ResponseItem::AgentMessage, a Codex-specific agent_message item type rather than a standard Responses item, so a strict third-party endpoint may reject that instead. A plain Message carrying the payload plus provenance is the more portable representation. Neither is mechanical: AgentMessage requires author and recipient (models.rs:1024-1030), which TurnToolOutput does not carry, so the rewrite is lossy unless the client supplies provenance.

    2. Stop routing inter-agent delivery through toolOutput. Larger, but it removes the mismatch structurally, since toolOutput is an app-server client contract that cannot express pairing.

    What I cannot decide from the outside is which of these upstream wants, because (1) trades structure for portability and (2) changes a client-facing API. Both are maintainer calls, and either way a Windows/macOS/CLI test asserting no null-call_id function_call_output reaches a provider flagged as pairing-required would lock the behaviour in.

    One correction to my own analysis on the sibling #44779, where I argued this shape can only be a function_call_output: that still holds on this revision — of the id-bearing variants, only FunctionCallOutput.call_id carries skip_serializing_if (models.rs:1105-1107), while ToolSearchCall (:1085) and ToolSearchOutput (:1161) are plain Option<String> and serialize null rather than omitting the key. But the locus I named there was too narrow. At the time I had only thread/inject_items in view, which cannot produce it; the turn/start toolOutput parameter is the path that does, and it is documented nowhere in prose — app-server/README.md is 176 lines on main and contains no call_id text at all since its restructure. The authoritative statement of the parameter's shape is now the generated schema, app-server-protocol/schema/json/v2/TurnStartParams.json (toolOutput at :817-826), together with TurnToolOutput at app-server-protocol/src/protocol/v2/turn.rs:145-149.

  10. ZzkAItech commented on Sep 13, 2026

    @ZzkAItech

    Independent verification on the current macOS build

    Environment

    • ChatGPT.app / Codex Desktop: 26.908.40834
    • Bundled app-server: 0.154.0-alpha.6.2
    • Platform: macOS arm64
    • Provider: custom Responses-compatible provider
    • Model: deepseek/deepseek-v4.1-flash

    Verification results

    • Normal user turns, ordinary tool calls, and tool results complete successfully on the same provider.
    • An isolated ephemeral:true thread using turn/start.toolOutput for automation_update fails with HTTP 400 and messages.2.tool_call_id.
    • Repeating the heartbeat after one successful tool call fails at messages.6.tool_call_id.
    • Repeating the heartbeat after multiple successful tool calls fails at messages.10.tool_call_id.
    • Desktop create_thread produced child threads whose first persisted response item was a function_call_output named create_thread with no call_id; each failed before the model received the delegation.
    • The failures are reproducible on fresh ephemeral threads, so this is not solely a pre-existing corrupted-history condition.

    Observation at the proxy boundary

    When the malformed item passes through a Responses-to-Chat-Completions proxy, the absent call_id can be converted to tool_call_id = "". This is not the origin of the defect, but it explains why different provider setups surface either missing field call_id or Tool message must have tool_call_id.

    Assessment and regression coverage

    The producer path should not create a standalone function_call_output unless a matching function_call.call_id exists. The recommended regression checks are:

    1. Standalone automation/heartbeat input is serialized as a normal instruction message, not as toolOutput.
    2. create_thread initializes the child thread with a normal instruction message.
    3. A paired function_call_output always retains a non-empty matching call_id.
    4. No orphan output is persisted into a fresh thread rollout.
    5. Heartbeat and create_thread both complete through strict Responses providers over HTTP.

    No credentials, API keys, private prompts, or local paths are included.

  11. argszero commented on Sep 13, 2026

    @argszero

    Two things in this verification stand out: the proxy observation (absent call_id becoming tool_call_id: "") is the sharpest datum in the thread, and the create_thread item identifies which producer is involved. That producer is not the dynamic-tool path, and the distinction changes what a fix can be.

    The item is built with call_id: None by construction

    turn/start's toolOutput route is the only non-test construction site of this shape in the tree — every other call_id: None occurrence is either a match/destructure (turn_input.rs:258, spawn.rs:73, stream_events_utils.rs:149, session/mod.rs:1599) or an unrelated field:

    // app-server/src/request_processors/turn_processor.rs:594-605
    let input = if let Some(tool_output) = params.tool_output {
        let item = ResponseItem::FunctionCallOutput {
            id: None,
            call_id: None,            // hardcoded, not omitted by accident
            name: Some(tool_output.name),
            namespace: tool_output.namespace,
            output: FunctionCallOutputPayload { body: tool_output.output, success: None },
            ...

    and the API type carries no pairing field at all: TurnToolOutput { name, namespace, output } (app-server-protocol/src/protocol/v2/turn.rs:155-159). It is an alternative to input, not a companion — turn_processor.rs:538-545 rejects combining the two ("toolOutput cannot be combined with nonempty input"). So a client using this route cannot express "this result answers call X" even if it wanted to.

    The paired route already exists — and it is a different one

    For app-executed tools that answer a model call, the app-server issues DynamicToolCallParams { thread_id, turn_id, call_id, namespace, tool, arguments } (app-server-protocol/src/protocol/v2/item.rs:1642-1649) — the app is handed the call_id — and the result returns through it: app-server/src/dynamic_tools.rs:18-52 keeps that id and submits Op::DynamicToolResponse { id: call_id, response }, which core/src/session/handlers.rs:230-232 completes the pending call with, via the normal tool machinery (core/src/tools/handlers/dynamic.rs:117, with the pending call registered under that id at :174). That output is a paired function_call_output.

    So the qualification in your assessment is the whole story: the items you are seeing are not outputs that lost their call_id — they are results pushed outside the call/response cycle, where no function_call exists in the thread to pair with. If the heartbeat and the create_thread result reach the server through toolOutput, they are exactly that shape, and there is nothing in the thread for them to pair with.

    Why checks 3 and 4 cannot hold as stated

    The standalone (unpaired) output is a deliberate, first-class carrier in this repo, not an accident. Four independent confirmations on current main:

    • accepted as turn input — core/src/session/turn_input.rs:255-267: the only two things that may start or steer a turn are user input or a standalone function-call output ("only user input or standalone function-call outputs can start or steer a turn");
    • classified as external context — core/src/stream_events_utils.rs:143-151 (response_item_may_include_external_context) lists FunctionCallOutput { call_id: None, .. } beside tool_search and web_search;
    • preserved into spawned threads while the paired variant is dropped — core/src/agent/control/spawn.rs:65-93 (keep_forked_rollout_item) returns true for FunctionCallOutput { call_id: None, .. } and false for FunctionCallOutput { call_id: Some(_), .. }, so a child thread is supposed to begin with one — which is precisely your create_thread observation;
    • rendered by name — guardian-context/src/transcript.rs:218-231 matches exactly this shape (call_id: None, name: Some(name), namespace) and labels it tool {namespace}.{name} result.

    So check 4 as written ("no orphan output is persisted into a fresh thread rollout") conflicts with keep_forked_rollout_item; the child-thread case looks intended. Check 3 is true today for every output that has a call: outside tests, everything paired is built with call_id: Some(..).

    The actual defect is the wire form, and it is narrow

    The provider request serializes the internal model directly (codex-api/src/common.rs:264, pub input: Vec<ResponseItem>) and call_id is skip_serializing_if = "Option::is_none" (protocol/src/models.rs:1107-1109) — so the key is absent, not null. (An explicit null would not help either: call_id is required by the item's schema, so it is not a legal value for it.) Nothing repairs it first: both normalize passes match only call_id: Some(..) (core/src/context_manager/normalize.rs:28, :185, :202), so unpaired items fall through to _ => {}.

    Two treatments, both keeping the standalone contract intact:

    1. Change the wire form for the unpaired case — serialize a caller-less result as an item a strict provider accepts, rather than as a function_call_output missing a required field. The repo already names this class ("external context"), and the transcript renderer shows the intent is name-based identification.
    2. Add pairing to the delivery API — an optional field on TurnToolOutput so a client that does know the originating call can say so, leaving the standalone form for genuinely caller-less results. Then "my provider rejects standalone items" can be handled as a capability; there is precedent in supports_standalone_web_search (config/src/thread_config.rs:316, consumed when deciding tool exposure at core/src/tools/spec_plan.rs:174) — with the caveat that that flag governs what the model is offered, not how an output is serialized, so it is a starting point rather than a drop-in.

    On checks 1 and 2 specifically: if the heartbeat and the child-thread seed are meant to be instructions, they should be sent through plain input — turn/start's input field produces an ordinary user message, and nothing about seeding a child thread requires toolOutput. As long as the client uses toolOutput, this repo will keep emitting the unpaired shape, because that is what the route is for.

    Happy to prototype either treatment with a regression test asserting that a strict provider never receives an unpaired function_call_output — though a maintainer's steer would help on which layer should own it: the app-server route, or the serialization of ResponseItem for providers that require the field.

  12. JunkaiWang-TheoPhy commented on Sep 17, 2026

    @JunkaiWang-TheoPhy

    Adding wire-level measurements from a macOS machine (app-server 0.154.0-alpha.6.2, upstream https://api.deepseek.com/v1/responses) that pin down what a fix has to produce, since the "expected behavior" list in the report contains one option that does not work on its own.

    input[i] sent result
    function_call_output with name/namespace/output, no call_id 400 input: missing field 'call_id'
    the same item with a synthesized call_id, no matching function_call 400 No tool call found for tool output with call_id …
    synthesized function_call + the original output, one shared call_id 200
    the output rewritten as a developer message 200

    So option 1 in the report ("always emit call_id on function_call_output, sourced from its matching function_call") only holds when a matching call exists. For the injected standalone items that this issue is about — where no call exists — the request still fails, with a different error. Options 2 (drop the item) and 3 (normalize/validate before serialization) are the ones that produce an acceptable request; option 2 needs care because the item is the payload of an injected event, and dropping it loses the event.

    One more observation that may help whoever fixes this: the two failure modes are easy to confuse because the provider's wording does not match the cause. On this machine a transcript whose tool-call batch was split by its own outputs (callA → outputA → callB → outputB) was rejected with The 'reasoning_text' in the thinking mode must be passed back to the API, and only reordering (calls contiguous, that batch's outputs after it) turned it into a 200 — while a genuinely missing output reports No tool output found for tool call X. Neither message names the actual invariant.

  13. JunkaiWang-TheoPhy commented on Sep 17, 2026

    @JunkaiWang-TheoPhy

    Cross-reference: I filed the send-boundary location plus a runnable strict-upstream checker as #46193 (this thread already has the wire-level table from my earlier comment). If a normalizer ends up being added on the client side, that issue lists the four shapes it has to produce/accept and the two error texts they map to.

  14. pluto1747-cybr commented on Sep 25, 2026

    @pluto1747-cybr

    Still reproducible on Codex Desktop 26.917.71314 / CLI 0.155.0-alpha.16.4 (macOS + Windows, custom DeepSeek Responses provider, multi_agent_version=v1): create_thread, send_message_to_thread, and fork_thread + send all fail the first turn with 422 input: missing field 'call_id'.

    Full request ids and rollout line evidence are in #45914. A manually created UI thread on the same machine is a working control, so this is specifically the programmatic/injected path, not all turns.

  15. taiqiyuan123 commented on Nov 9, 2026

    @taiqiyuan123

    Codex desktop: first message fails over HTTP when injected Page context has no call_id

    This is a concrete desktop trigger for standalone function_call_output items without call_id: starting a new chat from Home / the new-chat panel can inject Page companion context before the model has made any tool calls. It also happens when no Page is open.

    Environment

    • Codex desktop package: 26.1103.4239.0 on Windows.
    • Bundled core: codex-cli 0.167.0-alpha.3.2.
    • Platform: Microsoft Windows NT 10.0.26300.0 x64.
    • Authentication: signed in with ChatGPT, using a custom provider over the HTTP Responses API. The exact subscription tier is not included in this report.
    • Local routing: CC Switch 4.0.27 during the initial reproduction; now updated to 4.0.28.
    • The previous sampled core version, 0.166.0-alpha.5.1, did not have these injected items. This is an observed version boundary, not a claim about the exact commit responsible.

    Reproduction

    1. Configure a custom Responses provider that uses HTTP and validates standalone tool outputs.
    2. Sign in to the desktop app with ChatGPT.
    3. Start a completely new chat from Home / the new-chat panel, with no companion Page open.
    4. Send a short message and inspect the outgoing first-turn input.

    The first request contains the following Page-context items. These excerpts were checked against the original failed session log; unrelated fields and identifiers are omitted:

    [
      {
        "type": "function_call_output",
        "name": "codex_apps_open_page",
        "namespace": "agent",
        "output": "{\"page_id\":null}"
      },
      {
        "type": "function_call_output",
        "name": "codex_apps_selected_page_part_1_of_1",
        "namespace": "agent",
        "output": "Companion Page snapshot part 1 of 1:\n{\"page_id\":null,\"document_view\":null}"
      }
    ]

    Neither item has call_id, and neither has a corresponding model-generated function_call.

    Actual behavior

    The HTTP request is rejected on the first message:

    HTTP 400
    function_call_output requires call_id on HTTP requests;
    continuation via previous_response_id is only supported on Responses WebSocket v2
    

    In the initial tests, existing healthy chats continued to work while new chats from the affected entry point failed. A second computer was also reported to have the same symptom after updating, and the same workaround restored its use; its exact build and raw logs have not been independently checked for this report.

    Controlled comparison and workaround

    The troubleshooting record includes the following comparison using the same failing request and credential:

    • Forward the original request over HTTP unchanged: 400.
    • Rewrite only function_call_output items lacking call_id into developer messages, preserving their Page-context text: 200, with a completed response.
    • Use that rewrite in the full desktop routing path: real new-chat requests succeed.

    For example, the first item is rewritten as:

    {
      "type": "message",
      "role": "developer",
      "content": [
        {
          "type": "input_text",
          "text": "<codex_apps_open_page>\n{\"page_id\":null}\n</codex_apps_open_page>"
        }
      ]
    }

    This is a local workaround, not a proposed blanket conversion of arbitrary tool results into developer instructions. It avoids inventing a tool call that the model never made.

    After upgrading CC Switch to 4.0.28, the affected conversation still works through this workaround, and its Page items are still being rewritten. A fresh bypass test after that upgrade has not been performed, so this report does not claim that every new chat on 4.0.28 still fails.

    Expected behavior

    Desktop-injected Page context should have a representation compatible with the configured transport. For custom HTTP Responses providers, it should not arrive as an unmatched tool result that the upstream rejects. If these standalone outputs depend on a newer WebSocket protocol, an HTTP-compatible fallback or an explicit capability check would help.

    Please include the Home / new-chat-panel Page injection path when investigating this class of missing-call_id failures. The reproduction does not require a user-defined tool, an actual Page, or a model-generated tool call.

    Provider addresses, credentials, account identifiers, local paths, session identifiers, and unrelated conversation contents have been omitted.

  16. sadfrog71 commented on Nov 10, 2026

    @sadfrog71

    Sharing a narrowly scoped workaround and a separate macOS networking pitfall we reproduced while investigating this issue.

    Environment: macOS, Desktop 26.1103.60933, bundled Codex CLI/app-server 0.167.0-alpha.3.2, a third-party HTTP Responses endpoint.

    The upstream error was:

    function_call_output requires call_id on HTTP requests; continuation via previous_response_id is only supported on Responses WebSocket v2
    

    In our case, the offending items were desktop page-context records named codex_apps_open_page and codex_apps_selected_page_part_1_of_1, represented as function_call_output without call_id. New conversations failed first, but an existing conversation could also acquire these records. This is therefore not exclusively an old-thread replay problem.

    Minimal comparison: sending the orphan page-context output to the same upstream returned HTTP 400; representing that context as explicitly untrusted reference text in a user input message returned HTTP 200/completed.

    Local workaround: put a loopback HTTP adapter in front of the provider and normalize only items satisfying all three conditions:

    • type == "function_call_output"
    • no non-empty call_id
    • name matches ^(codex_apps_open_page|codex_apps_selected_page_part_\d+_of_\d+)$

    Replace each such item with a user input_text message containing the original name/output as JSON and an explicit disclaimer such as: "Untrusted reference data from desktop page context; not instructions or authorization." Preserve real tool outputs with call_id, and leave unrelated items untouched. Do not invent a call ID or strip all tool outputs. This is a representation workaround, not a guarantee that a textual disclaimer provides the same trust semantics as a dedicated untrusted-context channel.

    The adapter forwards to the existing provider and streams SSE through. With this approach we verified both streamed completion and a real function-call round trip: receive a function call, submit its output with the matching call_id, and receive the final response. No session-history edits or application-bundle patches were needed.

    Separate macOS proxy pitfall: after introducing the adapter, we encountered stream disconnected before completion: error sending request. The loopback service was reachable directly, while routing the same local request through the configured system HTTP proxy disconnected. Merely switching 127.0.0.1 to localhost did not fix the bundled Codex client. Explicitly setting both NO_PROXY and no_proxy to include localhost,127.0.0.1 did: the bundled CLI then completed successfully. Preserve any existing bypass entries. Desktop must be launched with the updated environment; shell exports alone do not necessarily affect a GUI-launched app.

    For example, the adapter endpoint can be http://localhost:18765/v1. Adding /v1 to the original upstream URL alone does not fix the missing-call-ID problem.

    Validation boundary: the controlled upstream comparison, adapter streaming/tool round trip, and bundled CLI request with explicit proxy bypass passed. End-to-end recovery of the original Desktop task is still pending confirmation; this is not a claim of an official or universally applicable fix. The GUI proxy environment change also needs a separate persistence solution if it must survive logout/reboot.

  17. zhyuzhyu commented on Nov 13, 2026

    @zhyuzhyu

    Another source of this class, filed as #61298: since Desktop 26.1106.51428 the composer's Companion Page context attaches codex_apps_open_page / codex_apps_selected_page_part_1_of_1 as function_call_output without call_id (namespace "agent") to every message on an existing thread — even when no Page is open ({"page_id":null}), which makes it much higher-frequency than the automation/delegation sources. Because the items persist and each new message re-attaches a fresh pair, affected threads fail on the request right after every submission and stay bricked. Rollout history on our side shows zero such items across 38 days before the 26.1106 update, with the first injection 16 minutes after install. Repro and details in #61298.

  18. I-am-zeroZ commented on Nov 22, 2026

    @I-am-zeroZ

    Additional affected path: goal_objective injection in Codex 0.171.0. The original session successfully resumed after a targeted local repair.

    Environment

    • Codex CLI 0.171.0, Linux
    • Responses HTTP transport (wire_api = "responses")

    Observed behavior

    An existing thread became unable to continue after Goal-related context was persisted as:

    {
      "type": "function_call_output",
      "id": "fco_REDACTED",
      "name": "goal_objective",
      "namespace": "agent",
      "output": "<user's goal text>"
    }

    The item has no call_id. It was also retained in a compaction's replacement_history.

    Three consecutive turns failed with:

    function_call_output requires call_id on HTTP requests; continuation via previous_response_id is only supported on Responses WebSocket v2
    

    Sending an ordinary continue did not recover the thread.

    Local findings and verified recovery

    The rollout contained three affected occurrences:

    • Two standalone goal_objective output records.
    • One copy retained in the compaction's replacement_history.

    After backing up the rollout, only these three occurrences were converted into ordinary user text messages containing the original goal text. The repair preserved timestamps, line lengths, and pagination byte offsets. No project files, goal status, or database records were changed.

    Local validation passed, and I subsequently confirmed that the original session successfully resumed normal conversation.

    This is a recovery workaround for the persisted history, not a fix for the producer. Re-enabling Goal continuation has not been tested, so recurrence remains possible.

    Expected behavior

    Goal context should use a representation compatible with the configured transport. A goal injected without a corresponding model-generated function call should not be sent over HTTP as a function_call_output missing call_id.

    Please include the Goal / goal_objective injection path when investigating this issue, alongside automation, cross-thread messaging, and Page context.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverbugcustom-modeltool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions