Skip to content

[Bug]: Codex Responses ordering inserts a user separator before a hosted web search call #7296

Open

Description

@WantexZard

Codex Responses ordering inserts a user separator between reasoning and its hosted web search call

Environment

  • Host: Codex Desktop through the Bili Responses proxy.
  • Observed on Bili 0.1.214. The local synthetic reproduction runs against Bili 0.1.216 source at commit 6453feeeb842bd1e471d875bf00287e5036a96c7.
  • Suggested triage: Codex host, Responses wire ordering. This can stop a normal follow-up turn after a hosted search.

What happens

On a conversation that used hosted web search, a follow-up request was rejected with this error shape. Item IDs below are synthetic.

Item 'ws_fixture' of type 'web_search_call' was provided without its required 'reasoning' item: 'rs_fixture'.

In a local reproduction, both original items survive. The wire order changes from user → reasoning → web_search_call to user → reasoning → synthetic user separator → web_search_call.

Minimal reproduction

From the repository root after installing dependencies and building the kernel, run the following with node --import tsx --input-type=module. It makes no network request.

import assert from "node:assert/strict";
import { responsesToCore, patchResponsesInput } from "acp-kernel/wire";
import { repairResponsesAssistantOrdering } from "./src/server/responses-ordering.ts";

const input = [
  { type: "message", role: "user", content: "Find a public reference." },
  { type: "reasoning", id: "rs_fixture", summary: [] },
  { type: "web_search_call", id: "ws_fixture", status: "completed",
    action: { type: "search", query: "fixture query" } },
];
const projection = responsesToCore({ model: "fixture", input });
const tag = (item) => item.type === "message" ? `message:${item.role}` : item.type;
assert.deepEqual(patchResponsesInput(projection, projection.msgs).map(tag),
  ["message:user", "reasoning", "web_search_call"]);
const repaired = repairResponsesAssistantOrdering(projection.msgs, projection.msgs);
assert.deepEqual(patchResponsesInput(projection, repaired.messages).map(tag),
  ["message:user", "reasoning", "message:user", "web_search_call"]);
assert.equal(repaired.slots.length, 1);

The fixture reproduces the emitted item order. The server rejection above was observed separately in normal use.

Expected behavior

Preserve the reasoning and hosted tool call in the same assistant run when both items survive the transformation. The existing separator behavior for distinct runs should continue to work.

responsesToCore represents hosted web_search_call as contentType: "reasoning". The ordering code therefore sees two consecutive reasoning entries and inserts a boundary. A regression case that tests the rendered Responses items could cover this. Issue #5670 tracks a separate tool_search_call / tool_search_output pairing failure.

Activity

  1. ranxianglei commented on Nov 19, 2026

    @ranxianglei
    Owner

    老哥提了几个issue,参考:我在 billion-context 提了 Issue #7296,附上 Codex 联网搜索调用与关联推理被分隔符拆开的最小复现,并在 #5670、#4594、#6215、#5589 分别补充了工具调用配对、预热、归档回读和存储漂移的验证记录。

  2. ranxianglei commented on Nov 19, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    查重:不重复。 检索了 open+closed 的 issue/PR("Responses ordering separator web_search_call reasoning"、"turn separator assistant run ordering"、"web search call rejected reasoning required"),无同机制条目。正文提到的 #5670 是 tool_search_call/tool_search_output 配对失败——那是另一套机制(这两类 item 在 kernel 里根本不进 hosted-call 扁平化路径,不受本修复影响),单独跟踪,本 PR 不碰。

    标签:bug / p2 / codex / scope-wiring(功能性缺陷但有绕行——仅 hosted web search 之后的会话卡住,压缩/重启可恢复;非崩溃/数据丢失/永久不可用,故 p2 非 p1;Codex Responses 线序,属协议接线)。

    @ranxianglei 收到,谢谢补充。#5670(工具调用配对)、#4594(预热)、#6215(归档回读)、#5589(存储漂移)都是同一位作者补充的独立验证记录,各自独立跟踪;本线程只处理 #7296(联网搜索调用与关联推理被分隔符拆开)。

    修复

    根因:kernel 的 responsesToCore 把所有 hosted-call item(web_search_call、file_search_call、mcp_call、computer_call/_output、image_generation_call、code_interpreter_call)扁平化成 contentType: "reasoning" 的 core(原始 item 挂在 rawResponsesItem sidecar 上)。host 侧的 repairResponsesAssistantOrdering 把这个 core 当成第二个 reasoning,于是按「reasoning 出现在 phase>0 / 已见 reasoning 之后 ⇒ 插 user 分隔符」的规则,在真正的 reasoning 和 hosted call 之间插了一个 user 分隔符,把 assistant run 拆成两段 → Responses 服务端拒绝该 web_search_call("without its required 'reasoning' item")。

    修法(host 侧,不动 kernel):contentType: "reasoning" 的 core 若其 rawResponsesItem sidecar 带 hosted-call 的 wire type,则归类为 tool-call(phase 2)而非 reasoning。这样 reasoning → hosted call 保持在同一个 run 内;分隔符仍只落在不同 run 之间(真正的第二个 reasoning / tool-call 之后的 message)。判定只看 sidecar 的 wire type,不看 core 的 text/id(两者都是 codec 重新派生、可被客户端塑形)。

    测试:tests/issue564-responses-ordering.test.ts 新增两条回归——(1) user → reasoning → web_search_call 渲染为完整一个 run、零分隔符;(2) 两个不同 run(run1=reasoning+hosted call,run2=reasoning+message)仍恰好插一个分隔符,位置在 hosted call 之后、run2 的 reasoning 之前。定向测试全绿(issue564 24 条 + issue2627 / issue5139 / invariant-judge / fold-round2 / codex-responses-ws),typecheck 通过;全量以 CI 为准。

    八问

    1. 是什么问题:Codex 走 Bili Responses 代理时,用过 hosted 联网搜索的会话,下一轮请求被拒(web_search_call 与它的 reasoning 被一个合成 user 分隔符拆开)。
    2. 什么原因导致的:host 侧 run 边界修复把 hosted-call 的 core(contentType 是 reasoning)误判成第二个 reasoning,从而在 reasoning 和 hosted call 之间插了分隔符。
    3. 影响范围与严重程度:仅「用过 hosted web search 的 Codex Responses 会话」在后续轮次卡住;压缩或重启可恢复。特定条件下有问题,非崩溃/数据丢失/永久不可用 → p2。
    4. 怎么修复的:把带 hosted-call wire type 的 reasoning-core 归类为 tool-call(phase 2),让 reasoning→hosted call 留在同一 run;分隔符逻辑对真正不同 run 的行为不变。
    5. 是否有回归问题:审了既有分隔符行为——真正的第二个 reasoning、tool-call 后的 message、reasoning-only turn 保留、acp_summary carrier 不插分隔符,全部保持;新增第二条测试专门钉住「不同 run 仍插分隔符且位置正确」。无回归。
    6. 是否破坏缓存:不涉及。改动只在出站前对 core 的 run 归类,不动缓存/重试/增量游标/去重键;分隔符仍是 outbound-only。
    7. 是否改了设计方向:不涉及。host 侧分类修正,不改架构/边界/数据流;kernel 的 reasoning 表示(压缩管线有意为之)保持不动。
    8. 是否引入了新的配置:不涉及。无新 env/config/默认值。

    判定:可合并。定向测试 + typecheck 绿,全量待 CI。

    PR: #7302

  3. ranxianglei commented on Nov 19, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    状态更新(刚实时核实):

    (按规则 agent 不 merge PR,由 owner 合并。)

  4. ranxianglei commented on Nov 19, 2026

    @ranxianglei
    Owner

    (已收)本单已归入根因聚合 issue(token 见聚合单 body),机器人已停止在本单上的工作,修复走聚合 issue 统一出 PR;本单保留不关,修复验证后统一关闭。(聚合单:[Root Cause] codex-lane (2 items),GitHub #7314)

  5. ranxianglei commented on Nov 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    收到。本单(#7296)已归入根因聚合单 #7314(codex-lane,成员 #4594 + #7296),我停止在本单上的工作,修复改由聚合单统一出 PR;本单按指示保留不关,等聚合 PR 修复验证后统一关闭。

    当前状态(已 live 核对):

    本单不再新增工作,后续以 #7314 为准。

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions