Repository navigation
[PR] fix: doom-gate byte floor prices billable content (core text + system/tools), not core text alone - #5006
ranxianglei wants to merge 13 commits into
Conversation
…t alone (#5000) The three doomed gates (egress fuse, preflight fail-fast, post-compress recheck) priced only core message bytes while preflight's trigger priced messages PLUS system/tools wire overhead — a payload whose billable total exceeds every window could clear the floor on the residual caliber. Field evidence (dsh 0.1.208): a 26,903-message session with 1.44 MiB of core text sent 55.2 MiB request bodies the gate never saw. All three sites now price core message text + system/tools wire overhead, both measured from the ACTUAL outbound body via the shared extraction in wireOverheadTexts (single source for both calibers — token and byte — so they can never drift). The JSON envelope stays out of the floor: it is transport syntax no tokenizer bills, and counting it would false-block dense-but-fitting payloads (#3617 both-ways pinned by tests B/D).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7190-pr.5006.470a0aeThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5006.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…e-billable-caliber
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成。结论:可合(待一个已知 flake 分片重跑转绿;merge 归人)。 审核基于 rebase 后的 head 结构化八问(独立产出)1. 是什么问题:三道判死闸(egress fuse / preflight fail-fast / 压缩后再检)的字节地板只量 core message text,对 system/tools manifest(MB 级常见)完全失明;而 preflight 触发器侧一直是全口径(含 overhead)。同一份 payload,触发器按全口径判超窗、守卫按残口径判能装——超限请求可以穿过全部三道闸打到上游吃 413(#5000 的 55.2 MiB 实例)。 2. 什么原因导致的:#2490 把地板不变量(bytes÷7.5>tokens⇒doomed)钉在 Σ|m.text| 上;#470/#829 后来给 trigger/clamp 通道补了 system/tools 项( 3. 影响范围与严重程度:所有走 preflight/egress 的车道(dsh/opencode/pi/codex 同等)。触发条件:manifest 质量把可计费总量推过 bar、但残差文本低于 bar。修复前严重度 p1 类(该形态下会话每请求被上游拒收);修复后仅按披露方向变严,误杀方向有双向测试钉住。 4. 怎么修复的(机制层):三个闸点统一改为「core message text + system/tools wire overhead」,两项都从该点的真实出站体测(relay fuse 用捕获的 wire body、fail-fast 用 prepared.body、再检用 outbound.body——注入工具/hoist 后的 system/dropped reasoning 自动反映,不猜);提取逻辑收敛为单一来源 5. 是否有回归问题:逐项独立核验过——
6. 是否破坏缓存:不涉及——prefix cache/cache ref/增量游标/去重键零触碰,改动只在三个拒收点的判决量与文案。 7. 是否改了设计方向:无架构转向——把闸的计量对齐到它自己的 trigger 口径(单一提取源)。判决模型的深面(count 墙、fused→unknown fall-through)正确隔离到 #5007 等拍板,没有夹带进本 PR。 8. 是否引入了新的配置:无。零新 env/config/CLI 字段。 独立验证证据(非采信 PR 自述)
两个非阻塞观察(记录在案,不动分支)
判定:无阻塞发现,可合。 唯一前置动作:人工重跑 flake 分片(或任意方式重触发 CI)转绿后 merge。merge 归人。 |
…e-billable-caliber
(ai: vllm-qwen/qwen3.8-27b) Second sync: merged origin/master (new wave: #4774/#4352 claude subagent split, #4985/#4999 pi inline streaming — zero file overlap with this PR) and pushed |
…e-billable-caliber
(ai: vllm-qwen/qwen3.8-27b) Third sync: merged origin/master (new wave: #4485/#4484 kernel merge-coverage fix + kernel 0.0.169 bump, #4862 invariant-judge egress pairing, #4945 openai usage regressions, #4989 split-brain graceful stop — zero file overlap with this PR; root lockfile delta is only the kernel file-link version) and pushed |
…e-billable-caliber
(ai: vllm-qwen/qwen3.8-27b) Fourth sync: merged origin/master (new wave: #5016/#4982 draining-twin port claim fix — touches src/server.ts but hunks are disjoint from this PR's doom-gate edits: ~L97/~L1392-1562 vs ~L3547+/~L4239) and pushed |
…uires (#4599) The #5140 recovery test proves forkSnapshot reconstructs a non-retained parent's raw tail from the UNIFIED index — but it never pinned its own storage mode. Under the CI storage baseline (preload-storage-baseline.mjs sets BILI_STORAGE_UNIFIED=legacy for the broad corpus) no unified rows exist, so the reconstruction has no source and forkSnapshot fails closed with 409 SNAPSHOT_UNAVAILABLE. Deterministic, not a flake: reproduces 100% on master and any merged branch with BILI_STORAGE_UNIFIED=legacy, passes without it (default shadow). Pin full like the sibling persist tests and restore the ambient value afterwards.
…e-billable-caliber
…ate-billable-caliber
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Eighth sync: merged origin/master (#5188 sidecar-recovery wave — |
|
(ai: vllm-qwen/qwen3.8-27b) Superseded by #5932 (merged 2026-11-08, fe963d7) — same mechanism (doom gates priced only Where this PR diverged — adding system/tools bytes to the preflight fail-fast probe floor — #5932 deliberately keeps the #2490 byte floor at that site (the probe's 413 is the designed #2313 refusal evidence; the #1001 shape must stay able to bet one request). That is the more correct call; this PR would have regressed that contract. Recommend closing this PR as superseded (agents cannot close). Nothing to salvage: its bidirectional e2e cases and wording pins are bound to its own implementation, and #5932 carries its own regression coverage (issue4079 / request-body-budget / issue4185 / side-request-isolation image_url pin). See the #5000 thread for the full verification. |
(ai: vllm-qwen/qwen3.8-27b) CI lane ran. I verified your supersession independently and did not rebase or push — the conflict resolution turned out to be moot, not mechanical. What I checked this run (live sources only):
Why I stopped rather than resolving: those conflicts are a design choice, not a textual lag — resolving them means picking which implementation wins, which is the decision you already made in-thread (#5932's measured-outbound meter; this PR's overhead-byte divergence "would have regressed that contract"). A mechanical CI lane shouldn't re-make an already-decided trade-off; forcing the rebase would either resurrect the rejected design or empty the PR. Remote branch left unchanged at On red-CI: per the mirror cache (the sanctioned source), the cached checks are stale (all Per your recommendation this should be closed as superseded by #5932. I can't close it (agents can't), and I applied no label because there's no open decision left — you've already decided. Nothing further for me on this branch unless you want it kept. 结构化八问(中文,供人类 reviewer)
收工判定:本 PR 已被 #5932 取代,冲突解决与 CI 修复均无意义,建议由 owner 直接以「superseded by #5932」关闭(agent 无权关闭)。我这边无后续动作,除非你希望保留该分支。 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live before acting (mirror cache, fetched today): head I did not fix or push. Reason: last run I established — and you confirmed in-thread — that #5006 is superseded by #5932 (merged, Pattern note (I did not pull the job logs, since it wouldn't change the call): only 2 of 12 windows shards fail while all ubuntu and 4 other windows shards pass — that reads as environmental/flaky or a narrow platform-specific quirk of this PR's code, not a broad break. Happy to pull the logs and triage properly if you decide to keep the branch alive. So the single action left is yours: close #5006 as superseded by #5932 (agents can't close). I applied no label — there's no open design decision (you've already decided supersession) and the lane's 结构化八问(中文,供人类 reviewer)
收工判定:实时状态已核实(2 个 windows 分片红、其余全绿);因该 PR 已被 #5932 取代,修复这些红无意义,建议由 owner 直接以「superseded by #5932」关闭(agent 无权关闭)。若你决定保留该分支,我再针对这两个 windows 失败拉日志定位。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) State unchanged this run (9th lane wake). Verified live: PR #5006 head Nothing has moved since the owner's 2026-11-08 note ("Superseded by #5932 — recommend closing, nothing to salvage"). The conflict is the supersession: this branch merged cleanly with master until #5932 (2026-11-08) rewrote the same doom-gate byte-floor code this PR rewrites, so every conflicting hunk is "this PR's discarded byte-overhead approach vs #5932's measured-outbound approach." There is no mechanical rebase — resolving the conflict is a design decision the owner already made against this PR. Decision needed (owner-only; I cannot close):
I'll stop re-posting this analysis on each automated re-trigger and re-engage only on your A/B call or a new head sha. (The 结构化八问(中文)
收工判定:状态稳定、阻塞于 owner 决策(owner 最后表态为建议关闭);不再逐次重复,等待 A 或 B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 10th lane wake — state unchanged, verified live this run:
Action taken this run: applied the The conflict is the #5932 supersession itself — no mechanical rebase exists. Decision needed (owner-only; I cannot close):
I'm parking here and will not re-post the full analysis on each automated re-trigger — I'll re-engage only on your A/B call or a new head sha. 结构化八问(中文)
收工判定:状态稳定、已打 needs-decision 标签、阻塞于 owner 决策;parking,等待 A 或 B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 11th wake — no change. Verified live: head Still blocked on your call: A (recommended) close #5006 as superseded by #5932 / B keep + rebase (no-op branch). I cannot close it myself. Parking — no further action until you decide or a new head sha lands. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;parking 等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 12th wake — no change. Head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op). Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 13th wake — no change. Head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op). Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 14th wake — no change. Verified live: head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op branch). I cannot close it myself. Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 15th wake — no change. Verified live: head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op branch). I cannot close it myself. Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 16th wake — no change. Verified live: head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op branch). I cannot close it myself. Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 17th wake — no change. Verified live: head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op branch). I cannot close it myself. Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 18th wake — no change. Verified live: head Blocked on your call: A (rec) close as superseded by #5932 / B rebase (no-op branch). I cannot close it myself. Parking. 八问(简):状态未变;冲突 = #5932 取代本身,无机械 rebase;未改代码零回归;等 A/B。 |
[ework] auto-fix stalled: test (windows-latest, 22, 1), test (windows-latest, 22, 2) — stopping for human review |
Related: #5000 — the measurement facet. This PR does NOT close #5000 (see Out of scope).
What
The three doomed gates — egress fuse (
src/server/relay.ts), preflight fail-fast probe (#2313), post-compress recheck (src/server.ts) — priced ONLY core message bytes against the barmax(2MB, window×7.5 B/token). But preflight's trigger prices messages PLUS system/tools wire overhead (estimateWireOverhead, #470/#829). A payload whose billable total exceeds every model window could therefore clear the floor on the residual caliber. Field evidence from #5000 (dsh 0.1.208): a 26,903-message session with only 1.44 MiB of core text produced 55.2 MiB request bodies that every gate read as "small".Fix
Every gate site now prices billable content = core message text + system/tools wire overhead, both measured from the ACTUAL outbound body at that site (whatever prepare really transmitted — injected tools, hoisted system, dropped reasoning all reflected automatically):
src/server/budget.ts: extraction factored into exportedwireOverheadTexts(protocol, parsed)— single source of truth for BOTH calibers.estimateWireOverhead(tokens; trigger/clamp channel, track: plugin-mode proxy-side emergency truncation (last-resort backstop, deferred from #467) #470) computes its original piece-sum over those texts (output identical — pinned by a no-drift test plus the existingtests/wire-overhead.test.ts); newestimateWireOverheadBytesprices the same pieces in UTF-8 bytes.src/server/relay.ts(egress fuse),src/server.ts(fail-fast + post-compress recheck): floor mass =estimateCoreMessagesUpperBytes(msgs) + estimateWireOverheadBytes(protocol, body); the operator-facing 413 messages now carry the component breakdown (~N B message text + ~M B system/tools overhead) and the remedy names the manifest class.Deliberately NOT counted: the JSON envelope (transport syntax no tokenizer bills — counting it would break the
bytes÷7.5 > tokens ⇒ doomedinvariant into false positives on dense-but-fitting payloads) and signature-only thinking mass (a derived token projection, not measured bytes — already priced by the calibrated trigger channel). Media stays out of the byte floor as before (separate learned image-token channel).Behavior change disclosure (old → new)
max(2MB, window×7.5), window floored at 1M tokens). Gates are strictly stricter: payloads previously clearing the floor on residual text may now 413 — that is the intended blind-spot closure; the false-positive direction is pinned by both-ways tests (Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617).tests/issue4079-egress-window-fuse.test.ts:162).Tests
New
tests/issue5000-doom-floor-overhead.test.ts:Local targeted run: 34/34 green across
issue5000-*,issue4079-*,issue2847-*,issue2490-*,wire-overhead; typecheck clean. Full-suite verdict comes from CI on this head.Out of scope (tracked separately — decision request filed in-thread on #5000)
messages max size is: 5000) — a byte floor cannot express a count cap; needs owner decision on mechanism.Config surface: none. Kernel: untouched.