Repository navigation
[PR] fix(#4331): report uncovered mid-history spans instead of claiming "at its minimum" - #4340
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.5230-pr.4340.f861986This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4340.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——按失败签名(#4331 / uncovered / "at its minimum")检索 open+closed issues 与 PRs,唯一相关项是 PR #4339:同一工作线的前身(同分支名、同 issue、旧 head 776b636 正是本分支 force-push 前的提交)。本 PR(squash 成单提交 b502443、rebase 到当前 master)取代 #4339,建议合并时顺手关掉它(我不自行关 PR)。master CI 红已有 #4326 跟踪(#4174+#4330 在途修复),不另立项。 审核结论:代码本身可合独立核过代码与测试(不是复读 PR 描述):
审核中直接修掉的一个小问题(已推独立标注 commit)
CI 现状说明(PR 上还会看到的红与归属)
八问
已知局限(PR 里已披露、不在本 PR 修):回执 remaining 计算在任一已提交 span 重叠时整批扣减——部分折叠的合并批次可能少报剩余(安全方向);用户侧若可见再立后续。 合并判定:代码就绪(review 通过 + 本地定向验证绿 + 审核小修已推)。等待两件事:① |
(ai: vllm-qwen/qwen3.8-27b) CI 状态跟进(接上一条):
|
…nest minimum verdict "no compressible ranges remain — the context is already at its minimum" fired on offer exhaustion alone, with no global coverage audit anywhere: live sessions carried ~16% of context as mid-history refs outside every active block while the receipt declared the global minimum (#4331). - src/uncovered.ts: uncoveredHistoryRuns() — contiguous runs outside every active block's coverage, classified by an empirical protected-zone diff (two processTurn passes: normal config vs preserve-0/0 relaxed, over a cloned state), current-offer exclusion, VIABLE_RANGE_MIN_TOKENS floor. Advisory only: any throw degrades to "no runs found". - acp_status: additive UNCOVERED HISTORY section (top-5 runs by tokens, rest counted), filtered against the live Compressible-ranges list above it; names isolated sub-gate residue between covered blocks that no merge will ever fold. - postCompressTail: on clean whole-offer exhaustion with no tier distillation, run the audit first — uncovered mass -> honest "not at its minimum" text naming the runs; none -> the verbatim #1387 contract string, byte-stable for genuinely-drained sessions. Behavior change (disclosed): old = unconditional minimum claim on offer exhaustion; new = claim only when the global audit verifies it, honest uncovered-listing otherwise. Sub-gate residue became visible in acp_status (was invisible on every surface). No config/env surface added; kernel untouched; nudge prompt text untouched. Known limitation (separate observation, not fixed here): the receipt's remaining-calc removes a whole offered batch when any submitted span overlaps it, so a partially-folded merged batch can under-report. Tests: tests/issue4331-uncovered-history.test.ts (9 gates incl. negative verbatim-contract + tier precedence); updated pinned contracts in tests/compress-success-tail.test.ts (#2404/#1387 now pin "never leaks AS AN OFFER"), tests/issue2029-status-baseline-provenance.test.ts (every status-reader kernel call feeds the provenance baseline), tests/issue847-compress-failure-guards.test.ts (sub-gate residue visible in the diagnostic, still never offered). TECHNICAL-NOTES.md entry appended.
…d-exports gate) The two audit types are only used in the signatures of the exported functions; no cross-file import exists, so the unused-exports gate flags them as INTERNAL_ONLY. Drop the leading export per the gate's own guidance; behavior unchanged.
… pin, status-pass reuse Response to reviewer feedback on the #4331 PR: - postCompressTail: the honest uncovered verdict now fires only when total uncovered mass >= UNCOVERED_RECEIPT_FLOOR_TOKENS (10K); below the floor the verbatim #1387 wording fires byte-identical to master (pi #521 anti-nag: small leftovers must not re-nag on every fold). tests/compress-success-tail. test.ts is back at master bytes — its sub-floor residue fixtures now pin the floor directly (zero diff vs master). - uncoveredHistoryRuns: optional normalRanges input — a caller that already ran the normal-config offer pass may reuse it (acp_status now pays ONE extra processTurn instead of two); undefined = audit runs its own pass. - UncoveredRun/UncoveredAuditInput unexported (unused-exports gate). - New P4 regression test: three adjacent T1 blocks distilled into one T2 parent through the real host path must not leak child spans into the audit (pins coveredMessageIds' active-block union + unit-projection child-id propagation + child deactivation). - TECHNICAL-NOTES: floor, tier-2 invariant, cost profile.
dda94a4 to
94819f4
Compare
Closes #4331
查重: 无 — closest relative #4227 was a reporting-layer baseline mismatch (fixed by #4229); related-but-distinct mechanisms: #4307 (stuck compress calls), #4289/#4293 (failed exchanges exempt from folding), #4240 (batch rejection). This is a distinct failure domain: genuinely-uncovered mid-history spans plus an ungrounded global-minimum verdict.
What this does
The stop signal ("No compressible ranges remain — the context is already at its minimum") fired on PRE-FOLD OFFER exhaustion alone (#2404 pinning), while nothing anywhere compared the union of active-block ranges against the session's ref set. The issue's live ZCode session proved the gap at scale: 138 mid-history refs (~65K tok ≈ 16% of context) in no active block, largest run
m00312–m00411, with the receipt declaring the minimum three times in a row. Repro on master confirmed the kernel DOES find such spans when they are offered — what was missing was a GLOBAL coverage audit plus a verdict that only claims "minimum" when one holds.src/uncovered.ts(new) —uncoveredHistoryRuns(): contiguous runs outside every active block's coverage (thecollectVisiblepredicate), classified by: skip if any current offer covers part of it; empirical protected-zone diff via twocore.processTurnpasses over a cloned state (normal config vspreserve-0/0relaxed) — reusing the kernel's own zone rules instead of copying them, so it self-maintains as those rules evolve; runs belowVIABLE_RANGE_MIN_TOKENS(200) stay silent. Advisory only: any throw degrades to "no runs found" and never breaks receipts or status.acp_status— additiveUNCOVERED HISTORYsection (top-5 runs by tokens, rest counted), filtered against the live Compressible-ranges list above it; names isolated sub-gate residue between covered blocks that no merge will ever fold (the permanent-hole class of 出现持续压缩失败,无法自动恢复 #847/[Bug] compress reports 'no compressible ranges remain' while mid-history spans sit outside every block #4331). Explicitly diagnostic, not a fold suggestion.postCompressTail— on clean whole-offer exhaustion with no tier distillation, the audit runs BEFORE the verdict: uncovered mass → honest "not at its minimum" text naming the runs; none → the verbatim compress 成功输出缺剩余范围快照与停止提示(pi 侧 #420/#521 对齐) #1387 contract string fires byte-stable, as before.Behavior changes (disclosed)
acp_statusdefault scopescope:"uncompressed"unchangedNudge prompt text untouched (kernel-owned). Fold eligibility / apply behavior untouched.
Config surface
None — no new env/config/CLI fields; the floor reuses
VIABLE_RANGE_MIN_TOKENS.kernel-change: none
Regression review
Existing behavior audited on touched paths: #2404 offer-pinning (subset folds still advertise the rest; protected-at-nudge ranges still never leak AS OFFERS — updated pinned tests assert that form), #1387 verbatim stop contract (byte-stable for genuinely-drained sessions — negative test), tier-distillation precedence (no stop AND no uncovered verdict while a tier is active), #2029 status-baseline provenance (every status-reader kernel call feeds the provenance-aware baseline — audit included), #847 failure-guard offer gating, viable-range floors on recommending surfaces. Local: typecheck clean + targeted suites green (9 new gates + all four updated pinned files, 43 pass); full-suite verdict = CI on this head.
Known limitation (separate observation, not fixed here)
The receipt's remaining-calc removes a WHOLE offered batch when any submitted span overlaps it, so a partially-folded merged batch can under-report rather than over-report (safe direction). Worth a follow-up issue if it proves user-visible.