Repository navigation
fix(#3063): forward codex WS transport fields (stream/stream_options) on upstream egress - #3072
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3641-pr.3072.887b9eeThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3072.tgz
npm install -g packageInstall instructions are refreshed on each push. |
2e4d4d9 to
58157b5
Compare
(ai: vllm-qwen/qwen3.8-27b) Review 结论:代码通过,rebase 后待 CI 绿即可合;发现一个合流协调风险(#2004)。 独立复核(非复读 issue 侧结论,以下均自行对标签/代码验证过):
已执行的动作:PR 分支落后 master 312 个提交(10-12 分叉)。已 rebase 到当前 master(c800ed1bb),本地 typecheck+build 干净,六个定向套件全跑(codex-responses-ws、responses-websocket、ws-bridge、native-ws-intercept、ws-upgrade、wire-contract)90/90 过。rebase 后的 head(58157b50c)已推回 PR 分支,让 CI 验的是合并后的确切树——CI 判定待出,出了我补一条。 回归清点(diff 触碰路径的既有行为,逐项结论):
测试有效性:新断言有牙——codex fake 上游现在运行时强制 WC-017(违规即回 error 帧)外加显式行断言,出站再丢 stream 会两条路同时红;lane-probe 表把双门禁设计本身钉住了。 协调风险(§7.5 热文件竞争):在途 PR #2004(WS bridge idle-socket observability)同样触碰 自动合并资格:否 —— wire/message-shape 变更(§7.4 必须人工),PR 正文标注正确。 结构化八问:
收工判定:代码可合;等 CI 在 head 58157b5 上全绿后请人工合并(wire-shape 变更,Agent 不合并不发布)。合并发布后请报告人在 #3063 线程用真实 chatgpt.com 实测确认(最小复现那条即可)。 |
(ai: vllm-qwen/qwen3.8-27b) CI 跟进(head 58157b5):全绿,唯 4 条 test 车道各挂 2 个用例——已查明与本 PR 无关的 master 既有破损,顺手修掉后重推(新 head d923901),CI 重跑中。 诊断过程(全部独立复现验证):
CI 正在 d923901 上重跑,结果出来我再补最终判定。代码审查结论不变(见上一条八问):待 CI 绿即可人工合并。 |
… on upstream egress
d923901 to
681f98a
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.417-master.ec1ad40 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Follow-up to the conflict takeover: master advanced (ranxianglei#3055 port-hop fixes, ranxianglei#3165 per-lane attach policy, ranxianglei#3072 codex WS egress fidelity) after the first merge. Conflicts confined to files the branch never semantically touched; resolved verbatim to origin/master.
Root cause (#3063)
Codex CLI one-shot calls (
codex exec) routed through bili's/bili/<chatgpt.com>prefix returned exit 0 + 0 bytes while the direct connection worked; bili's log showed the upstream counting ~29.7K input tokens and ending the turncompletedwith zero output.Since v0.1.183 (commit 163cfc5), the Codex Responses-over-WebSocket lane (
src/responses-ws.ts) strippedstreamandstream_optionsfrom the client'sresponse.createframe before forwarding upstream. The real Codex client ALWAYS sendsstream: true— it is a required field of its WS request struct (codex-rs/codex-api/src/common.rsResponseCreateWsRequest, noskip_serializing_if; asserted on the wire by the client's own unit tests). chatgpt.com answers the shape-divergent frame with an empty completed turn.--passthroughfailed identically because the drop sits in the shared transport, below the compression pipeline.Evidence: local egress capture against a mock upstream (both passthrough and normal mode drop exactly these two fields; everything else matches the client frame field-for-field) plus a cross-check against openai/codex source.
Fix
Re-attach the client's transport fields at egress (
egressTransportFields) in both send sites ofResponsesWsUpstream.fetch()— the initial send and the continuation-rejected full resend. Gated on the codec'sallowStreamFlag(the same flag admission uses): the codex lane forwardsstream/stream_optionsverbatim; the opencode lane's egress stays byte-identical to before.The gate is deliberately keyed on the codec flag, not field presence: the session layer injects
stream: trueinto EVERY frame beforefetch(), so presence cannot distinguish a client-sent field from an internal one (the first draft of this fix gated on presence and broke all 30 opencode-lane tests via WC-013).Behavior change disclosure
/bili/<url>/responses→ chatgpt.com): upstream egress frames gainstream: trueand, when the client sent it,stream_options. This restores exactly the shape the real client sends directly — a fidelity repair, not a semantic change.Wire-contract ledger (#1304)
stream:true; enforced byvalidateCodexResponsesWsCreatein the codex-lane fake — every codex WS test now fails if egress drops the field again.Tests
Targeted suites green locally:
tests/codex-responses-ws.test.ts7/7 (incl. new egress assertions),tests/responses-websocket.test.ts40/40,tests/ws-bridge.test.ts3/3,tests/native-ws-intercept.test.ts19/19,tests/ws-upgrade.test.ts2/2,tests/wire-contract.test.ts19/19. Typecheck + build clean. Full suite / e2e left to CI.No config surface change. No kernel change. Not auto-merge eligible (wire/message-shape change, §7.4) — needs human merge. Field verification against real chatgpt.com requested from the reporter in the issue thread; interim workarounds (MITM routing / rollback to v0.1.182) are documented there.
Closes #3063