bug: 第三方 Responses 直连在 0.1.82 仍静默丢弃全部输出(delta 挂空、custom_tool_call 不执行)
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
### 问题描述 / What happened
**实际行为**
在 codex harness 下,自定义供应商(第三方 OpenAI 兼容网关,模型协议 = Responses 直连)发送指令后**整轮输出被静默丢弃**:HTTP 200、模型侧有输出(消耗 token),但 UI 上无任何内容、工具调用不执行,turn 立即结束,全程无报错、无告警。
**与 #4251 / #4266 的关系(重要,请勿按重复处理)**
- 本机运行 v0.1.82,`git tag --contains 035bef2`(#4266 的 merge commit)确认包含该修复
- 09-16 的日志中**已无** `failed to parse ResponseItem from output_item.added`(该错误曾在 09-08 / 09-10 / 09-12 出现,共 32 次)——#4251 的 null 序列化问题确已修复
- 本次为**另一形态**:无解析失败,但所有 `output_text.delta` 挂空、custom_tool_call 不进入执行
**期望行为**
1. 检测到此类流异常(delta 无对应 active item、item 只见 done 不见 added)时给出可见告警,并建议切换 Chat Completions
2. 或提供显式"Responses(兼容档)",不依赖域名白名单
### 环境 / Environment
- Cindy 版本或 commit / version or commit: 0.1.82(打包版)
- 平台与版本 / platform & OS version: Windows 10 Pro / 10.0.19045
- 安装方式 / install method: Windows 安装包
- 相关配置:自定义供应商,codex runtime 指向某第三方 OpenAI 兼容网关,协议 Responses 直连(未命中 `upstream-profiles.json`)
- 内置 codex 组件版本:0.153.4
### 复现步骤 / Steps to reproduce
1. 添加自定义供应商,codex runtime 指向 `/responses` 实现不规范的第三方网关,协议保持 Responses
2. 在 codex harness 下发送任意指令
3. 现象:无可见输出、工具不执行、turn 立即结束、无任何提示
4. 将协议切换为 Chat Completions 后完全恢复正常(走 Cindy 自带 chat → Responses 桥)——已实测验证
### 日志与截图 / Logs & screenshots
(已脱敏,无凭证与个人数据)
**失败 turn(Responses 直连,06:34:45)**:
```
Request completed method=POST url=http://127.0.0.1:53854/responses status=200 OK
handle_output_item_done: Output item item_type="reasoning" item_id="rs_1"
OutputTextDelta without active item ← ×11(每轮 9~11 次)
handle_output_item_done: Output item item_type="message" item_id="msg_2"
Output item item_type="custom_tool_call" item_id="ctc_3"
← 无任何 ToolCall / dispatch_tool_call 记录,turn 结束
```
**成功 turn(切换 Chat Completions 桥后,07:01:56,同一模型)**:
```
Output item item_type="custom_tool_call" item_id="ctc_ffacfc93de33e6ba41ada7b8"
handle_output_item_done: Output item item_type="reasoning" item_id="rs_3efb31d0f5448797938e3d53"
handle_output_item_done: ToolCall: exec // @exec:{...}
handle_output_item_done:handle_tool_call:... tool call completed
```
时间线:06:34 / 06:35 / 06:38 三个 turn 全部失败并静默结束;07:01 起切换为 Chat Completions 后,同一模型的工具调用全部正常。
**疑似根因**
- 失败 turn 上游 item id 为**序号风格且跨轮复用**(`rs_1`、`msg_2`、`ctc_3`);成功 turn(经 Cindy chat 桥)为哈希风格(`rs_3efb…`、`ctc_ffac…`)
- delta 报 "without active item" 而 item 在 done 阶段可见 → **高度疑似上游未发送(或畸发)`response.output_item.added`**,item 未注册导致 delta 全部挂空、custom_tool_call 无法进入执行
- 该网关不在 `upstream-profiles.json` 白名单内;且即使套用 deepseek profile,`rs_1` 前缀合规不会被重铸、`ctc_3` 也不在修复范围内
- 客户端全程静默,用户无从判断
(如需上游原始 SSE 事件流样本,可后续补充。)
Contributor guide
Research direction
Start by tracing the Responses direct-stream handling around response.output_item.added, output_text.delta, output item done, and custom_tool_call events, using the supplied failed and successful logs as the behavioral comparison. Reproduce in the codex harness with the third-party /responses gateway, then verify that missing active items no longer silently discard output or tool calls and that users receive a visible warning or compatibility guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100