Repository navigation
[PR] fix: abort the HTTP fallback egress when the Codex WS client disconnects - #6008
Conversation
(ai: vllm-qwen/qwen3.8-27b) Review 结论:可合并(先 rebase 到最新 master——分支落后 3 个提交,零文件重叠,GitHub mergeable=true / state=behind)。外部贡献质量达标(命名、注释、测试有效性、风格逐项过审),无需对齐重构。 独立验证(未复用 issue 侧结论,全部自己重做):
既有行为回归清点(diff 触碰路径逐项):
高危模式逐项过:无 fail-fast 变吞错;无阈值/时序/默认值漂移;无输出格式变化;wire 形状未动(relay 零改动)。 八问:
收尾事项:① rebase 最新 master 后合并;② 标签已打 bug/p2/ws/scope/wiring;③ 作者提出的 guard 取舍我已给推荐(保持现状),无需额外拍板。 |
ed60bb9 to
3307bf4
Compare
|
(ai: anthropic/claude-opus-5-5) Rebased onto current master ( |
(ai: vllm-qwen/qwen3.8-27b) Rebase verified and independently re-reviewed on the new head ( 查重: 不重复。相关但机制不同:#5601 改的是「已触发的断连 abort 如何归因/展示」(分类层,不是触发层);HTTP/SSE fallback 车道本身源自 #3342/#3447。 标签: 已补打 bug + codex + scope/wiring + p2(缺陷在 Codex WS 客户端接入层;产品可用,特定条件下每次断连有界成本泄漏 → p2,无数据/会话/缓存丢失,不升 p1)。 State verified live this round — everything below re-run by me on the rebased head, not carried over from the earlier review:
One factual refinement for the record: on master the pre-existing pinning test did not visibly fail — it passed green vacuously. I instrumented it: the abort assertion is unreachable (the supplier never aborts, so the wait never resolves), the test hangs in teardown, hits the 30 s timeout, and the force-exit Verdict: ready to merge once the in-flight CI shards go green; no code changes requested. (Merge stays human-only.) 八问:
行为变更披露(old→new):
判定:CI 绿后可合并。 |
(ai: vllm-qwen/qwen3.8-27b) Status update: CI on |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1154-master.8def027 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Fixes #6007
Problem
ResponsesWsResponseis a socketlesshttp.ServerResponse.OutgoingMessage.destroy()emits'close'only through its own socket slot, so when the Codex WS client disconnects andonClose()destroys the active sink, the relay never sees'close'andclientAbortnever fires. On the #3342 HTTP/SSE fallback that signal is the only thing that cancelsegressHttp(), so the supplier request runs on until the 12-minute idle watchdog. The test that pins this was failing on master, hidden by a force-exitafter()hook.Change
src/responses-ws.tsResponsesWsResponse.destroy()emits'close'once when the exchange has not ended.end()after a destroy no longer emits a second'close'. This is the same socket-death behaviourInlineRes.destroy()already has insrc/inline-engine.ts.tests/responses-ws-http-fallback.test.tsafter(() => process.exit(...))hook. The fixture'sclose()now callsupstream.closeAllConnections(), so a regression fails within seconds instead of hanging the shard. Adds a mid-stream variant (the existing test only covers the phase before headers) and a negative row: closing the client after a finished turn is not treated as a disconnect.Points worth a look:
destroy()on this class abandons the exchange:onClose,shutdown, the [Bug] Codex Responses WebSocket blocks long sessions at 100 MiB before ACP compression, including small incremental continuations #4804SnapshotAnchorFallbackErrorpath and the output-buffer-limit path inwrite(). Aborting the upstream is what each of them needs.super.destroy()behaves as before: it does not go through thesocketgetter, soreq.socketis not destroyed.end(), this now counts as a client disconnect: the upstream is aborted and the relay logsclient disconnected mid-stream. That matches the HTTP lanes andInlineRes. The window is small: a supplier that sends the terminal event and only then delays EOF. If you would rather not count it, the guard could also require!this.terminal.src/server/relay.tsis not touched. The existing'close'contract now fires on this lane too.Testing
tests/responses-ws-http-fallback.test.ts:All 13 test files that touch the WS lanes pass: 140/140. This includes the [Bug] Codex Responses WebSocket blocks long sessions at 100 MiB before ACP compression, including small incremental continuations #4804 and [PR] fix: Codex/opencode WebSocket delta turns no longer rebuild the full history before compression (#4804) #4817 anchor-fallback suites, which go through the
destroy()path.End-to-end check, measured from the supplier side:
npm run typecheckandnpm run buildpass.Not run locally: the full suite. Per AGENTS.md §7.2 the CI test lanes are the verdict.
AI-assisted: I investigated and prepared this change with Claude Code, then reproduced and verified the results myself.