Skip to content

Goal context item is recorded mid-turn, splits a parallel tool batch, and permanently wedges the thread with 400 No tool output found #60420

Open

Description

@Matthew-Laplace

What version of the Codex App are you using (From "About Codex" dialog)?

26.1103.60933 (bundled codex-cli 0.167.0-alpha.3.2)

What subscription do you have?

API only. Custom OpenAI-compatible provider: DeepSeek /responses (wire_api = "responses"). The provider validates tool pairing strictly. The error wording matches the OpenAI Responses API.

What platform is your computer?

macOS (Darwin), arm64, Apple Silicon.

What issue are you seeing?

A thread is permanently wedged. Every later turn fails in about 3 seconds with:

No tool output found for tool call call_03_...

That is the upstream 400. Four consecutive turns failed with the same call_id, including two automatic goal continuations. The thread cannot make progress.

Root cause (from the session rollout JSONL)

One assistant turn issued six parallel function_call items. While the third call was still running, the app recorded a goal context item into the same thread. The item landed between the calls and three of their outputs:

17:05:39.476  function_call         call_00_...
17:05:40.362  function_call         call_01_...
17:05:41.067  function_call         call_02_...
17:05:41.885  function_call         call_03_...
17:05:42.905  function_call         call_04_...
17:05:43.808  function_call         call_05_...
17:05:44.385  function_call_output  call_00_...
17:05:49.741  function_call_output  call_01_...
17:05:49.741  function_call_output  call_02_...
17:05:51.971  message (user)        <codex_internal_context source="user_goal">... User set the goal ...</codex_internal_context>
17:05:54.920  function_call_output  call_03_...
17:05:54.921  function_call_output  call_04_...
17:06:13.966  function_call_output  call_05_...
17:06:15.776  task_complete         error: No tool output found for tool call call_03_...

The message item has provenance.type = "harness" and turn_id = "auto-compact-3". It was recorded at 17:05:51, while call_03 was still executing. The matching item_completed event arrives at 17:05:54.9.

A scan of the whole rollout (1250 response_items) finds this as the only place where a non-tool item sits inside a tool batch. Every call_id has a matching output. The on-disk order is invalid by itself.

The ordering is persisted in the rollout and replayed on every request. A restart does not help. Every later turn fails without reaching the model.

Where the item is recorded

codex-rs/core/src/session/retained_context.rs, record_user_goal_update (around line 84):

let mut item = ContextualUserFragment::into(update);
...
self.state.lock().await.history.record_annotated_items(...);
self.send_raw_response_items(&context, std::slice::from_ref(&item.item)).await;

The goal instruction goes into live history and into the rollout as soon as the goal RPC arrives. Nothing checks whether the active turn still has tool calls whose outputs are not recorded yet. The caller is codex-rs/app-server/src/request_processors/thread_goal_user_context.rs.

Why this is not #44604 or #52834

What steps can reproduce the bug?

  1. Use a custom wire_api = "responses" provider that validates tool pairing strictly.
  2. In one turn, let the model issue several parallel tool calls. At least one call must run for several seconds.
  3. While the calls run, set a goal from the app UI ("set as goal").
  4. The goal item is written between the calls and the remaining outputs. The next sampling request returns 400 No tool output found for tool call ....
  5. Every retry, fork, and automatic goal continuation returns the same 400.

Request-level reproduction against the same provider:

  • [call_A, call_B, output_A, message(user), output_B] returns 400 No tool output found for tool call call_B.
  • [call_A, call_B, output_A, output_B, message(user)] returns 200.

What do you expect?

A goal item must never split a tool batch. Record it after all outputs of the active batch, for example queue it until the turn's pending tool outputs are appended, in both live history and the rollout. The same guard should cover every contextual item the app can insert mid-turn (goal, steering, authorization, notices).

Extra request

Add validation or repair for already wedged threads. A client-side pass that moves displaced outputs back before the injected item would let existing threads continue.


中文摘要

Codex 桌面版(26.1103.60933,内置 codex-cli 0.167.0-alpha.3.2)在回合执行中记录 goal 上下文项时,把它写进了并行工具批次内部:call_03 还在执行时(17:05:51)写入 <codex_internal_context source="user_goal">,三条输出(call_03/04/05)随后才落盘。严格校验的 Responses 上游因此返回 400 No tool output found for tool call call_03_...。

坏顺序已经写进 rollout 并每轮重放,重启、fork、自动续跑都仍然 400,线程永久不可用。全量扫描 1250 条 response_item,只有这一处非工具项插在工具批次中间,且每个 call_id 都有对应输出。

代码位置:codex-rs/core/src/session/retained_context.rs::record_user_goal_update 收到 goal RPC 后立即 history.record_annotated_items,没有等待当前回合未落盘的工具输出。

期望:goal 项不得切断工具批次;应等当前批次全部输出落盘后再记录(live history 与 rollout 都要保证顺序)。同时建议增加对已卡死线程的修复/校验。

与 #52834 同类(注入项不同)、与 #44604 的竞态不同:这里是写入 rollout 的持久错误顺序。

说明:DeepSeek /responses 的校验是否比 OpenAI 原生更严,本文未做对照实测(本地 OpenAI 路径额度受限);这里只陈述“客户端写出的顺序违反 Responses 的调用/输出配对语义”。

Activity

  1. added
    bug
    app
    app-server
    tool-calls
    custom-model
    on Nov 9, 2026
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