Repository navigation
[PR] fix: calibrate the dsh ledger floor against the output clamp (#5596) - #6551
ranxianglei wants to merge 6 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9693-pr.6551.3dc0578This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6551.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…nds (#5596) An authored compaction answer lands a checkpoint that resets dsh's raw ledger to the folded snapshot (#3723), so the refused-replay high-water no longer bounds any future raw scale. The guard recorded the envelope size on the authored path too (before the branch), leaving a stale sticky floor that kept planning the output clamp against bytes dsh will never count again — the field lane sat clamped at 4096 behind an 866KB envelope whose ledger shrank the moment the answer landed. The authored path now deletes the key; the high-water write moves to the refusal-only branch, where it stays sticky for the #2490 kill chain (refused checkpoints never land, the ledger only grows).
…#5596) The ledger floor (dshCompactionRefusedBytes / 4) is an over-counting high-water BYTES proxy — it read ~18% above dsh's own tokenizer in the field (216690 vs ~184K) — not a low-biased local token estimate. Running it through the #5278 x1.12 safety inflation double-counts it, and with the 5% margin on the inflated value (~1.36x total) the clamp slammed into the 4096 capability-floor plateau near the window: the field sub- lane left every answer with a 4096-token budget (cap 1172 floored at 4096) where the raw formula gives 28475; the session lane clamped to 62797 instead of 83498. clampOutputBudget takes a skipSafetyInflation flag that clampOutgoing Output sets exactly when the floor IS the planning basis (strictly above the folded estimate). Est-driven calls pass false, so #5278 and every non-dsh lane stay byte-identical; the pinned #2490/#3384 shapes (5909, 55000), the #3071 capability floor, and the doomed-probe surrender all hold on the flag path. Pinned: tests/issue5596-ledger-floor-calibration.test.ts (field values unit + two e2e lanes: the refused lane plans raw out of the plateau, the authored lane goes out unclamped after the floor clears).
…ondition (#5596) Review finding on the A1 commit: skipSafetyInflation was set on the bare 'ledgerFloor > inputEstimate', but the floor is the planning basis only when the #3384 gate ALSO fired (folded view at the enforced headroom target, or a giant >=25%-of-window request). With the gate off — the normal post-refusal continuation state, sticky floor above a healthy folded est — the flag still took the raw path and stripped the #5278 x1.12 safe pass from the est-driven clamp, contradicting the fix's own 'est-driven stays byte-identical' claim and the flag's own doc (the planning basis there IS the token estimate). In the firing band (est near the headroom target, request below the giant line) the clamp then went ~12% of est looser or no-op'd entirely, re-exposing the #5278 under-estimator hole. floorDrivesPlanning = (viewAtEnforcedTarget || giantRequestedBudget) && ledgerFloor > inputEstimate now drives both the flag and the 'planning floor' log clause. Pinned: new unit test s-5596-g (gate off, floor 82.5K above est 70K -> the safe pass still clamps 20000 -> 17678; the bare-flag code sent 20000 unclamped). Field shapes (28475/83498), the #3384 pin (5909), the #3071 plateau, the doomed-probe surrender and both e2e lanes are unchanged.
e96d514 to
2c0ad30
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 本线程只有一个在途 PR(#6551),无同主题并行 PR;本次审核的修复以增量 commit 加进该 PR 分支,未另开。 审核结论:发现并修复 1 处回归,其余通过我独立审出的问题(A1 flag 条件过宽,已修): 修法: 其他审核动作:
八问
状态(实时核过):head |
…e default (#6480) The suite-wide baseline (tests/preload-storage-baseline.mjs) pins BILI_STORAGE_UNIFIED ??= "legacy" for the legacy-written corpus, but this suite asserts the fresh-install default posture — the exact #6480 pure-sqlite flip the storage-sqlite-default notice advertises. Under the CI preload chain the pin hid the notice and two subtests failed deterministically (red in every shard leg containing the file). Drop the inherited pin so the production default applies, per the preload's own pin-yourself contract.
The suite baseline preload (preload-storage-baseline.mjs) pins BILI_STORAGE_UNIFIED="legacy" for the broad corpus. After #6480 flipped the storage default to pure-sqlite, the notice-registry suite's visibleNotices assertions expect the pure-sqlite default notice, which is gated on unifiedSelectionIsSqlite (unified "sqlite" or absent) — the preload's "legacy" made the notice silent, so the suite was born-red on master. Pin the selection explicitly (#4011 lesson: a test that depends on the production default passes locally but fails in CI).
…er-r1 # Conflicts: # tests/notice-registry.test.ts
(ai: vllm-qwen/qwen3.8-27b) CI fix run — PR #6551 (calibrate the dsh ledger floor against the output clamp, #5596), auto-fix lane attempt 1/3 Re-verified the live check state first: the mirror cache was stale (fetched ~10h ago, not refreshing), so I confirmed the two failing jobs directly via a one-off API read. Both Diagnosis — all 13 failures are ONE signature, and none are this PR's code:
What I pushed (new head
Honest boundary: the ci-fixes merge does not contain a fix for the Windows EBUSY file-lock flake — that facet is still pending on the sentinel (not yet landed on ci-fixes). If the re-run stays red on the same 13 EBUSY subtests, it is the same inherited flake, not a regression from this PR; the durable fix (retry-ladder budget / storage-mode pinning for the unified-mode suites) belongs on ci-fixes, not this branch. 八问(结构化结论)
判定:本 PR 的红是继承性 flake,已按政策 merge ci-fixes 并 push( |
(ai: vllm-qwen/qwen3.8-27b) 结论 / Outcome (conclusion of this run) 判定:PR #6551 两个红的 windows 分片(22/1、22/3)是继承性 master 红,不是本 PR 代码问题——13 个失败子测试全部是同一签名 本轮已做:按 CI 协调政策把 已验证:live check 状态(镜像缓存 stale ~10h,改用一次性 API 读确认两 job 均红、非绿);两 job 日志里 13 个失败的 EBUSY 签名;ci-fixes 祖先关系;冲突解决与 ci-fixes 版逐字节一致。 剩余 / 风险:Windows EBUSY 面尚未在 ci-fixes 收敛(哨兵待补)——重跑有概率把 transient flake 转绿;若仍红在同一 13 个 EBUSY 子测试上,属同一继承 flake 而非本 PR 回归,根治(重试窗口预算 / unified 模式套件的存储模式钉定)应落在 ci-fixes 而非本分支。详细八问见上一条评论。 |
(ai: vllm-qwen/qwen3.8-27b) 重跑仍红(继承性 Windows EBUSY flake,非本 PR 代码) 重跑 43512360188(head 17eed58,上轮 merge ci-fixes 后触发)在同样的两个 windows 分片上仍红:
新证据(诊断升级):CI runner 内置的 flake 确认逻辑触发了——同 runner 重试一次仍复现,且本次重跑在新 runner 上也复现。按 CI 自己的判定逻辑( 处置:本 PR 的 diff( 八问(继承性 flake,非本 PR 代码):
判定:本轮无代码改动(非本 PR 代码,继承性 flake);新证据已报 #4599 请哨兵排查 handle 泄漏;等 ci-fixes 收敛后本 PR 重跑即绿。 |
现场(field shape)
dsh 原生压缩回放被拒(~866KB 信封)→ metadata
dshCompactionRefusedBytes→ 规划 floor = 866760/4 = 216690 tokens,而 dsh 自家计量 ~184K(bytes/4 高估 ~18%)。请求的 max_tokens 128384(dsh profile 50% 窗口默认)≥ #3384 giant 线(25% 窗口)→ floor 每轮驱动规划;在已偏高的字节代理上再跑 #5278 ×1.12 安全膨胀 + 膨胀值上的 5% margin(合计 ≈1.36×)→ 钳制砸进 4096 能力下限平台区(cap 1172 → 4096)。该泳道此后每个回答只有 4096 预算,两次真实回答被截断。修复(两个独立失真,两处各修)
A1 —
src/server/budget.ts(钳制校准):clampOutputBudget加skipSafetyInflation参数;clampOutgoingOutput仅在 floor 本身是规划基数(ledgerFloor > inputEstimate,严格大于)时传 true——floor 是 bytes/4 字节代理,本身已偏高,#5278 的膨胀是对低估器的矫正,套在字节代理上就是双重计数。est 驱动时传 false(#5278 逐字节不变);非 dsh 泳道 floor 恒 0,不受影响。A2 —
src/server/handle.ts(过期 floor 清除):authored checkpoint 落地会重置 dsh 的 raw 账本(#3723),旧高水位不再代表任何真实规模(现场 866760 就是这种「已接受的保守残留」)。authored 分支改为delete该键;高水位写入移入 refusal-only 分支,拒绝泳道保持 #2490 钉死的粘性行为。没有采用 issue 字面建议的「拒发不记账」:那会重开 #2490 宿主侧死链(超大输出落进 dsh raw ledger → raw+输出 > dsh 自家窗口 → 死亡循环;tests/issue2490-ledger-floor-doomed-probe.test.ts e2e 钉死),且 floor 防的威胁来自宿主侧、与回放是否发给上游无关。修法是校准 + 落地时失效,不是拆除。
Pre-flight
npm run typecheck干净tests/issue5596-ledger-floor-calibration.test.ts9/9(7 单元钉现场数值 + 2 e2e:拒绝泳道钉 raw 公式 13320 出平台区;authored 泳道钉 floor 清除后 25000 原样放行)4096 !== 28475、62797 !== 83498、e2e 得 4096;回退 handle.ts → e2e A2 fail