You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex WS lane: proxy-failure error frames carry error as a string, so codex ignores them and waits for its idle timeout; 1009 diagnostic reports 0.0 MiB #4601
When a codex WebSocket exchange fails inside the pipeline, codex never sees the failure. In the field (bili 0.1.206, codex-tui 0.164.0) an un-intercepted compaction was forwarded at 17,490,755 bytes and the upstream closed with 1009. bili logged Error: WS upstream rejected the 0.0 MiB request with close 1009 … at 13:58:37Z. Codex logged remote compaction v2 stream failed … stream disconnected before completion: idle timeout waiting for websocket at 14:03:37Z, exactly 5:00 later, retried twice, and failed the turn after ~15 minutes.
ResponsesWsResponse.end() (src/responses-ws.ts:573) turns a JSON body into { ...details, type: "error", status }, so error stays a string.
Codex parses WS error events as { type, status, error: { code?, message?, headers? } } (parse_wrapped_websocket_error_event in codex-rs/codex-api/src/endpoint/responses_websocket.rs). A string error fails deserialization, so the frame is not treated as an error and the stream waits for its idle timeout. bili's own errorFrame() (src/responses-ws.ts:500) uses error: { type, code, message } and is understood.
A second defect on the same path: src/server/relay.ts:877 computes sentBytes only for string bodies. For a non-string (verbatim passthrough) body the 1009 diagnostic therefore reports 0.0 MiB together with the default "(no sheddable images outside the protected recent messages)" reason from wsOversizeDiagnosis (:186), although no shedding was attempted.
Expected: failure frames on the WS lanes use the Responses error shape (error: { code, message }, status preserved) so the client fails fast and surfaces or retries the error, and the 1009 diagnostic reports the actual frame size.
Activity
ranxianglei commentedon Oct 24, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重: 不重复。 与相关条目逐一比对:
wsOversizeDiagnosis这套机器就是它加的;本案是修正它遗留的非字符串体盲区 + 同路径的帧形状缺陷,属改进而非重做。src/responses-ws.ts的在途项):无人在修错误帧形状或 1009 诊断字节数。[PR] fix: route codex context-only prewarms to the probe relay via the upstream proxy #4595 改的是 probe gate 区域(onMessage 侧),与本案改动区(ResponsesWsResponse.end()/ relay catch)不重叠,rebase 时留意即可。标签: bug / codex / opencodev2 / scope/wiring / p1(已打好)。p1 理由:不是只有 1009——WS 车道上任何管道级失败(上游超时/重置/熔断 fail-fast…)产生的错误帧 codex 都读不懂,每次失败白烧 5 分钟 idle × 重试次数(现场 ~15 分钟才 fail turn),且用户全程看不到失败原因;错误快速上抛是代理的核心承诺,此车道上该承诺整体失灵。opencodev2 同打因为 Responses-WS 车道是共享的,帧形状修复影响该车道所有客户端。
Bug 审核三步:
buildProxyFailureResponse(src/upstream-fail.ts:212)body 恒为{error:"<string>", detail};ResponsesWsResponse.end()(src/responses-ws.ts:573)把 JSON body 展开成{...details, type:"error", status},error保持字符串。我拉了 codex 源码核对(codex-rs/codex-api/src/endpoint/responses_websocket.rs):WrappedWebsocketErrorEvent.error: Option<WrappedWebsocketError>是 struct,字符串反序列化整个事件失败 →.ok()?→ 非错误帧 → 落回普通事件解析也失败 →continue→ 等 idle timeout。与现场日志逐字吻合。另外确认了帧里status缺失或 <400 同样会被忽略——现有 end() 已强制 ≥400(默认 502),这点不用动。sentBytes只对 string 体计长,Buffer 体(verbatim passthrough)= 0;guard 分支(:880)随即用wsOversizeDiagnosis(0, undefined, budget)抛出「0.0 MiB + no sheddable images」——但 shedding 根本没试过(shedWireImages 只吃 JSON 字符串体)。与现场Error: WS upstream rejected the 0.0 MiB request with close 1009 …吻合。end()这一处把error归一化为对象形{code, message}(已是对象的原样保留;字符串则包装,message 合并 error+detail 保信息量;无 error 字段落回 incomplete_response 形状),status 沿用现状;sentBytes 对 Buffer 体取真实长度,guard 分支对非字符串体给出诚实原因(verbatim passthrough,shedding 不适用)。都是车道局部修改,HTTP 车道字节不变。正在实现 + 回归测试,PR 随后贴出。
ranxianglei commentedon Oct 24, 2026
(ai: vllm-qwen/qwen3.8-27b)
**修复完成,PR: https://github.com/ranxianglei/billion-context/pull/4624**(Closes #4601)
八问:
是什么问题:codex WS 车道上管道失败时,错误帧对客户端「不可见」——帧里
error是字符串,codex 的错误事件反序列化(要求error为对象)失败后直接丢弃该帧,只能干等 5 分钟 idle timeout × 重试次数(现场 ~15 分钟才 fail turn),期间用户看不到任何失败原因。同路径第二缺陷:非 JSON(verbatim passthrough)体被上游 1009 拒收时,诊断报0.0 MiB加一句假的「no sheddable images」——实际根本没尝试 shedding。什么原因导致的:① HTTP 车道的失败体契约(string
error,有意设计)被ResponsesWsResponse.end()原样展开成 WS 帧,缺一步车道形状转换——HTTP 语义的 body ≠ WS 车道的错误契约;②sentBytes只对字符串体计长、Buffer 体硬编码 0,且诊断文案统一套「试过 shedding 但无可 shed」的模板,对未尝试的场景失实。影响范围与严重程度:Responses-WS 车道的所有客户端(codex 主报、opencode-v2 同车道)。触发面 = 该车道上任何管道级失败(上游超时/重置/熔断 fail-fast/1009 超限…),不止 1009。p1:每次失败白烧 ~15 分钟死等且原因不可见,错误快速上抛这一核心承诺在该车道整体失灵。
怎么修复的:在 WS egress 的唯一转换点
end()归一化——对象error原样保留;字符串error包成{ code: "proxy_failure", message: "<error>: <detail>" }(信息量不丢);无error字段落回incomplete_response形状;status 语义不变(statusCode ≥400,默认 502)。诊断侧:Buffer 体按真实字节计长;no-shed 分支用新加的why覆盖参数如实说明「body 不是 JSON wire body(verbatim passthrough)— shedding 不适用」。HTTP 车道一行未动。是否有回归问题:审计过既有行为——HTTP 车道 string-error 契约不变(新增 gate 测试钉住)、admission
errorFrame形状不变(钉住)、三个相邻套件 29/29 绿(codex-responses-ws / issue3701-ws-byte-budget / responses-ws-http-fallback)、tsc 干净。一处微型变更已披露:unparseable-buffer 回退帧的 status 从恒 502 改为尊重显式 4xx/5xx statusCode(实践中此前不可达:设置 4xx 却写非 JSON 体的路径不存在)。是否破坏缓存:不涉及——未触碰缓存/重试/游标/去重逻辑。
是否改了设计方向:没有。补的是车道边界缺失的转换步骤;
buildProxyFailureResponse共享构建器与 HTTP 契约保持原样。是否引入了新的配置:无。
验证:新回归套件 3/3 绿(两个缺陷各一 + 负向门禁);负向对照已做——stash 掉修复重跑,两个缺陷测试如预期红、gate 测试如预期绿(测试有牙)。全量判定交 CI(分支 base = master tip 146b34f,无 rebase 漂移)。热文件提示:#4595 同触
src/responses-ws.ts但改的是 probe gate 区域(onMessage ~:655),与本 PR(end() ~:569)不重叠,若先后落地注意 rebase 顺序即可。ranxianglei commentedon Oct 24, 2026
(ai: vllm-qwen/qwen3.8-27b)
CI 状态更新(PR #4624,head ce00312):40 个 check run 里 23 绿、16 skip(e2e 门控车道,常态)、唯一失败 =
unused-exports——已证实为继承性失败:master tip(146b34f27)同一门禁同样红,#4606 在途修复;本 PR diff 未新增/改动任何 export。按 #4599 协调规则已在那边留了一行继承性说明,未本地追查。等 #4606 合入后本分支 rebase 即全绿,之后可合并(合并动作归 owner)。fix(ci): de-export ClientBuildCheck — unused-exports lane (inherited …
ranxianglei commentedon Nov 4, 2026
(ai: vllm-qwen/qwen3.8-27b) PR #5662 首轮红:仅 unused-exports gate(我新增的 FastpathTailScanResult 接口 INTERNAL_ONLY,自己代码问题非继承红)。已去掉 export 关键字(gate/tsc/定向套件本地全绿),amend 后重推 sha=e17d19f3f,等 CI 复跑。
fix(codex): answer WS-lane failures with object error frames incl. ov…
Merge upstream/master (33d4951): adopt ranxianglei#5963 context analy…