Repository navigation
fix: floor the #2490 planning-clamp output at a 4096 capability minimum (#3071) - #3101
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3792-pr.3101.8e4ca1fThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3101.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) PR 审完。结论先行:修法本身正确、与批准公式逐字一致;但原 head(293e859e)CI 是红的 —— 两个既有 incident pin(#2122 / #2558)钉的正是本 PR 要移除的 sub-4096 饥饿值,PR diff 没更新它们。我已在 PR 分支直接修掉(独立标注 commit 独立验证过程:拉分支逐行读 diff;手算复核每个钉住值(含 #2490 s2 的 55_000 = max(55000, 4096) 不变、s4 sub-floor surrender cap=−39500<1024 不变);本地跑全部 8 个直接调 八问:
收工判定:等新 head(42481442)CI 全绿即可合(wire-shape 相关,人合,不满足 auto-merge 条件)。合并顺序按 owner 建议:#3080 先行(覆盖 9 次空轮中 6 次的根因),本 PR 随后——两者无冲突,也可并行合。 |
…lden mismatch (#3101 review)
…um (#3071) When dsh's compaction is refused (#2490), the sticky planning floor drives clampOutputBudget to cap outgoing max_tokens at window - floor - margin; for a 262144-window session that clamps output into the low thousands (1479-2623), so every reply truncates at finish=length before any visible text lands (a share of the 9 empty turns in #3071). Per owner sign-off in #3071, floor the CLAMPED value at a 4096 capability minimum: floor_out = min(4096, window - input). The floor applies only where a clamp already fires (cap >= OUTPUT_CLAMP_FLOOR); the sub-floor surrender stays byte-identical, so fail-closed overflow protection is preserved (input+output never exceeds window) and no pinned #2490 assertion changes (smallest pinned clamp is 55K). The clamp never RAISES - a client budget already under the floor is honored; raising belongs to the restore lane (PR #3080).
Review follow-up on 293e859: the CI test lanes went red because two existing incident pins encode the exact sub-4096 starvation values this PR's floor removes: - tests/issue2122-clamp-calibration.test.ts: naive cap 3357 -> floored 4096 (headroom 10219 >= 4096) - tests/issue2558-clamp-image.test.ts: naive cap 2016 -> floored 4096 (headroom 13349 >= 4096) Both teeth still bite (the scenarios still clamp far below the requested budget); only the floor changed, per the owner-signed formula floor_out = min(4096, window - input) from #3071.
30fbbd7 to
fe0d17f
Compare
(ai: vllm-qwen/qwen3.8-27b) 补充上一轮 review 的结论:CI 上挂掉的 4 个 storage-render golden 测试与本 PR 的 diff 无关,已定位根因并解决。先更正我上一轮「等新 head(42481442)CI 全绿即可合」的说法——当时 CI 确实是红的。 发生了什么:推送 4248144 后,CI 四条 lane 全红(storage-render golden × chat/anthropic/responses/google),但本地在每一种环境组合下都稳定绿(node 22.23.3 / 24.11.1、UTC/CST 时区、加压并发、模拟 CI 环境变量袋)。我在 golden 失败信息里临时加了逐字段输出(临时 commit 30fbbd7):CI 打印显示会话 metadata 的每个字段取值与本地逐字节一致,唯一差异是顶层键顺序——CI 上 根因:golden 的指纹按「键插入顺序」对整个持久化对象做哈希。#3094(修 #3093)把 处置:master 已修好(#3113/#3119,commit 八问(本轮):
判定:可合(人合;wire-shape 变更不满足 auto-merge 条件)。合并顺序按 #3071 里 owner 的决定:#3080 先行,本 PR 随后。无需另开 issue——根因已在 master 跟踪并修复(#3113),再开即重复。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.449-master.7a3f22f # this exact build
npm install -g billion-context@master # always the newest merged build
|
PR #3101 (#3071) floors the output-clamp reduction target at min(4096, window-input); the #3148 test still expected the pre-floor raw cap of 1360 for the same numbers, so every master CI test shard fails on it. Update the recorded-event and wire assertions to 4096 and document the formula step. Same failure reproduced on plain master (6b5b283).
…ssed by #3101's re-pin) #3154 (merged 2026-10-15 09:35) pinned the #3148 clamp event at capped=1360. #3101 (merged 2026-10-15 20:30) introduced the owner-signed #3071 floor floor_out=min(4096, window-input) and re-pinned the pre-existing #2122/#2558 pins, but its re-pin commit predates #3154, so the newer #3148 pin stayed stale and every CI test shard touching this file has been red since. Both asserts (event.capped and rebuilt.max_tokens) come from the same floored value in clampOutgoingOutput; headroom 51228 >= 4096 so the floored value is 4096. The tooth still bites: the scenario still clamps 65536 far below the requested budget.
What
Floors the
#2490planning-clamp output at a 4096 capability minimum, per owner sign-off in #3071.When dsh's compaction is refused (#2490), the sticky planning floor drives
clampOutputBudget(src/server/budget.ts) to cap outgoingmax_tokensatwindow - floor - margin. For a 262144-window session whose refused replay is ~247K tokens, that clamps output into the low thousands (1479–2623), so every reply truncates atfinish=lengthbefore any visible text lands — a share of the 9 empty turns reported in #3071 came from this path.The fix
In
clampOutputBudget, where a clamp already fires (cap >= OUTPUT_CLAMP_FLOOR):Per the owner's constraint (#3071):
floor_out = min(4096, window - input), applied only where a clamp already fires. The sub-floor surrender (cap < OUTPUT_CLAMP_FLOOR) stays byte-identical, so fail-closed overflow protection is preserved —input + outputnever exceeds the window, and when raw headroom < 4096 the floor is bounded by headroom (it does not force 4096 onto a payload that would overflow). The clamp never raises a client budget already under the floor; raising belongs to the restore lane (PR #3080).Behavior change (old -> new)
OLD: a refused-compaction session's outgoing output was clamped to
window - floor - margin= 1479–2623 on this class of session -> every reply truncated empty.NEW: floored to 4096 when headroom allows (bounded by
window - inputotherwise). Fail-closed preserved. No pinned#2490assertion changes — the smallest pinned clamp value is 55K, far above the floor (verified below).The dsh压缩与bili压缩冲突 #2490 pins are untouched, but two OTHER incident pins sit inside the band this fix removes and are re-pinned in a follow-up commit (review finding, CI was red on 293e859):
tests/issue2122-clamp-calibration.test.ts(naive cap 3357 → floored 4096) andtests/issue2558-clamp-image.test.ts(naive cap 2016 → floored 4096). Both teeth still bite — the scenarios still clamp far below the requested budget; only the sub-floor starvation values change, exactly per the signed formula.Tests
New
tests/issue3071-planning-floor-min-output.test.ts(7 cases: the two incident floors 2623->4096 / 1479->4096, no-raise honoring a sub-floor client budget, sub-floor surrender untouched, headroom-bounded floor, healthy cap unchanged, integration throughclampOutgoingOutput). All 6 existingtests/issue2490-ledger-floor-doomed-probe.test.tscases stay green — confirming the STICKY high-water recording and the 55K incident clamp are untouched.Local: targeted suites green,
npm run typecheckclean,npm run buildgreen. Full-suite verdict = remote CI on this head.No config surface added (internal constant, like
OUTPUT_CLAMP_FLOOR).Part of #3071