Repository navigation
[PR] fix: add min-benefit floor to model-initiated compress (Part 1 of #7333) - #7334
ranxianglei wants to merge 4 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11172-pr.7334.45d6435This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7334.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 查重: 不重复 — 检索 open+closed 的 issue/PR,只有本 PR #7334 引用 #7333,无并列 PR 修同一 burst-fold 问题。#7333 相关 issue(#6720 折得比列表多 / #3444 auto-fold 门槛 / #5683、#5943 nudge 信用)机制与症状均不同,不构成重复。 初步代码审核(已核对分支
状态: CI 仍在跑(test 分片 in_progress, |
(ai: vllm-qwen/qwen3.8-27b) PR #7334 审核结论(最终)判定:不可合并 — CI 红,PR 不完整(地板误伤 17 个现有测试文件) 结构化八问
受影响测试文件清单(本地复现,PR head 880a454,全为地板拒收)
注: 既有行为审查(逐项)
结论不可合并。方向正确、核心逻辑正确,但不完整:地板误伤 17 个现有测试文件(~60 用例),CI 红(11 shard)。需 PR 作者补完(推荐选项 B:受影响测试文件设 |
🔶 需要决策 CI is red — needs a decision on how to reconcile 82 pre-existing test files with the new default fold-benefit floor. What I verified (live, head
Why this is a decision, not a mechanical fix:
八问
选项对比
Recommendation: B — 82 个测试验证的是正交机制而非 floor,让它们 opt-out 恢复 legacy 行为是语义最干净、风险最低的修法;floor 本身由专门测试 + 5 个已放大文件覆盖,不会失去测试。
|
…loor The min-benefit floor (default 4096) in applyRanges refused small test folds, breaking 17 existing test files on CI. Set minFoldBenefitTokens=0 in each affected test's config to restore the pre-floor behavior — these tests pin fold mechanics (refold, CCR, stub, ledger-align, …), not the benefit floor, so the floor must be off for them to exercise their intended paths. Closes the CI red on PR #7334 (11 shards failing on the floor).
[bot] 🏷 Follow-up: CI red fixed — 17 test files now pass The 11 CI shards failing on this PR were caused by the new min-benefit floor (default 4096) in issue1494 · issue3126 · issue2204 · issue4313 · refold-wiring · compress-recovery-ranges · issue3859 · issue4733 · fork-ccr-adoption · epoch-confirm-lifecycle · compress-refused-ledger-align · subagent-sessions · compress-success-tail · issue3635 · issue1875 · stub-resubmission-guard · issue4812 Fix: set Commit |
MODEL-FACING TEXT CHANGE: new refusal receipt for below-min-benefit folds. A model-initiated compress that would reclaim fewer than compress.minFoldBenefitTokens (default 4096) is now refused below the pressure band. Each committed fold rewrites the context prefix and re-bills the prompt-cache tail, so a burst of tiny folds re-bills the tail for almost no reclaim. - Add compress.minFoldBenefitTokens (int >= 0; 0 = legacy any-positive-shrink) to CompressSettings, mergeCompress, ResolvedKernelConfig, resolveCompress. - Generalize the #2748 no-net-shrink gate in applyRanges: netDelta < floor (floor = 1 in pressure band/emergency, 1 for preflight lane loopTracking:false, else max(1, minFoldBenefitTokens)). - New refusal reason gate:below-min-benefit with a model-facing receipt that teaches the model to batch ranges into ONE compress call. - The no-net-shrink receipt (netDelta <= 0) is byte-identical to before. - Preflight lane (loopTracking:false) is exempt from the floor: bili's own overflow folds are never gated by the benefit floor. Regression tests: tests/issue7333-min-fold-benefit.test.ts (7 tests: below-floor refused, no-net-shrink byte-identical, above-floor commits, pressure-band exemption, emergency exemption, minFoldBenefitTokens=0 legacy, preflight lane ungated). Also enlarge fold sizes in 4 existing test files (issue2360, issue847, issue2146, issue5683) and loop-compress.test.ts to stay above the new 4096 floor (the folds were 2460-3733 tokens, below the floor). Closes #7333 (Part 1; Part 2 = per-nudge fold budget, separate decision).
…loor The min-benefit floor (default 4096) in applyRanges refused small test folds, breaking 17 existing test files on CI. Set minFoldBenefitTokens=0 in each affected test's config to restore the pre-floor behavior — these tests pin fold mechanics (refold, CCR, stub, ledger-align, …), not the benefit floor, so the floor must be off for them to exercise their intended paths. Closes the CI red on PR #7334 (11 shards failing on the floor).
2d0f9ce to
cfefb0d
Compare
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — PR #7334 rebased onto the latest master and pushed. What I did this run:
Note on last run's escalation: the 🔶 需要决策 I posted last run (4096 floor breaking test files, options A/B/C) is now moot — the PR author chose option B (opt-out 八问
Verdict: PR #7334 现已与 master 同步、可合并(待新 head |
[ework] auto-fix stalled: test (ubuntu-latest, 22, 1), test (ubuntu-latest, 22, 2), test (windows-latest, 22, 4), test (windows-latest, 22, 1), test (ubuntu-latest, 24, 3), test (ubuntu-latest, 24, 2), test (windows-latest, 22, 2), test (ubuntu-latest, 24, 1), test (windows-latest, 22, 5), test (ubuntu-latest, 22, 3), test (windows-latest, 22, 3) — stopping for human review |
修复已推送 — 65 个测试文件补上
|
…ig (fixes static-gates typecheck) The 65-file test commit set minFoldBenefitTokens: 0 on config literals typed as the kernel's Config, which tsc rejects (47x TS2353: the field lives on the host's ResolvedKernelConfig rail, not the kernel Config). Cast each failing literal to ResolvedKernelConfig — the pattern the 17-file commit already used in refold-wiring / issue4313 / issue3126 / issue1494 — and add the type import where missing (34 files). Type-only fix: assertions and type imports are erased at runtime, zero behavior change. Local verification: npm run typecheck (the failing static-gates step) clean; npm run build and check-dist-thin-install clean; targeted affected test files green (6 loop-compress failures reproduce identically on master — local environment noise, not PR-related; CI test lanes green on head). Refs: #7333, #7334
(ai: vllm-qwen/qwen3.8-27b) CI fixed — all checks green on new head What was red: Root cause: the 65-file test commit ( Fix (commit Verification: local Pushed as the final head (no 七问
收工判定:CI 全绿(30 checks:15 success + 15 设计内 skip,0 failed),PR 可进入正常 review/合并流程。 |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live: this event references the old head |
What
A model-initiated compress that would reclaim fewer than
compress.minFoldBenefitTokens(default 4096) is now refused below the pressure band. Each committed fold rewrites the context prefix and re-bills the prompt-cache tail, so a burst of tiny folds re-bills the tail for almost no reclaim.Config surface
compress.minFoldBenefitTokens(int ≥ 0)AUTO_FOLD_MIN_BENEFIT_TOKENS(4096) — the same bar the auto-fold path uses (auto-fold sharp edges: a sub-floorautoFoldTargetTokenscauses a fold storm, andexternalSummary.*file edits do not take effect until aPUT /__bili/config#3444)compress.minPressureBenefitTokensis the nudge-side min benefit (a different concept). This is the fold-commit gate.minPressureBenefitTokens— rejected because it conflates two different concepts.Changes
compress.minFoldBenefitTokenstoCompressSettings,mergeCompress,ResolvedKernelConfig,resolveCompress.applyRanges:netDelta < floorwhere floor = 1 in pressure band/emergency, 1 for preflight lane (loopTracking:false), elsemax(1, minFoldBenefitTokens).gate:below-min-benefitwith a model-facing receipt that teaches the model to batch ranges into ONE compress call.netDelta <= 0) is byte-identical to before.loopTracking:false) is exempt from the floor: bili's own overflow folds are never gated by the benefit floor.Tests
tests/issue7333-min-fold-benefit.test.ts(7 tests: below-floor refused, no-net-shrink byte-identical, above-floor commits, pressure-band exemption, emergency exemption, minFoldBenefitTokens=0 legacy, preflight lane ungated).Pre-existing failures
6 tests in
tests/loop-compress.test.tsfail on master WITHOUT this PR's changes (verified viagit stash): tests 2, 3, 9, 14, 15, 17. These are pre-existing and NOT caused by this PR.Closes #7333 (Part 1; Part 2 = per-nudge fold budget, separate decision).