Repository navigation
[PR] fix: recover fold coverage after short-request deactivation under id churn (#4050) - #4085
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.5446-pr.4085.0bf4274This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4085.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——本 issue 是 PR #4085(修复 #4050)的镜像条目,与既有 issue/PR 无重复;按 [PR] 流程处理:已拉取分支核对代码、审 diff、确认 CI,不重做。 初步状态(head
完整八问审查结论随后补上。 |
…churn (#4050) A short request deactivates a retained fold (kernel syncBlocks, by design). When the main history then returns under canonical-equivalent id churn (client re-serialization), reconcileFoldCoverage never re-keyed the block: coveredRealHistoryIds skips inactive blocks, so covered.size===0 short-circuited the whole pass and the stale ids could never be found again - permanent coverage loss, summary off the wire, folded originals re-sent every turn. Feed retained view-deactivated lineage back into the claim ladder as recovery candidates (active coverage inserted first, so the anchor cap's survivor order is unchanged). The ladder decides per cell with multi-channel corroboration - nothing is restored blindly; non-corroborated cells stay honest mismatches and complete the existing lifecycle (z-streak reap #2695, truncation suppression, epoch verdict #3641). Host-side only; kernel untouched.
…wire artifacts (#4050) process.env.TMPDIR is unset on Windows (it uses TEMP/TMP), so the artifact write fell back to "/tmp" and resolved to a nonexistent D:\tmp\ on the windows-latest runners, failing all four scenarios with ENOENT (CI run 39538358942, windows-22 shard 2). Use node:os tmpdir(), which is valid on every platform. Verified locally: 4/4 pass, result lines unchanged.
b4b678a to
ccc586f
Compare
(ai: vllm-qwen/qwen3.8-27b) 标签: bug / scope/kernel / p1(缓存命中崩坏致成本爆炸类,按 2026-10-19 口径 p1;客户端无法从证据确定,不打)。 独立审核完成(不照抄 #4050 侧结论,diff 与行为均重新过了一遍)。 ① 方向关修的是根本原因,不是症状。缺陷生产者 = ② 回归审查(触碰路径的既有行为逐项)
③④ 代码与测试有效性核心 diff 仅 src/fold-reconcile.ts +41,单模块。测试是真测试:e2e 走真实 HTTP 代理+真实 kernel ⑤ diff 整洁度 + master 已移动的影响master 已并入 #4084/#4087(PR base 之后)。对照当前 master: CI 状态(截至 04:22Z)
结构化八问
判定:代码与测试审核通过,行为变更 a-e 披露完整且我逐项核实成立。合并前置只剩机械步骤:conflict-worker rebase 到 9a97169(顺手丢弃两个与 master 相同的 verif 文件、view-latch 取 master 版)→ rebased head CI 全绿 → 可合。本 PR 触碰 id 邻接逻辑,按 §7.4 保持人工合并。 |
(ai: vllm-qwen/qwen3.8-27b) 状态更新(接上条审查结论):rebase 已落地且干净。
|
(ai: vllm-qwen/qwen3.8-27b) 收工判定:全绿,可合。
至此本 issue 的审核闭环:方向(根因在决策点修,非症状遮罩)、回归清单、测试有效性、diff 整洁度四关均已独立审过并逐条写在上条八问回复里。按 §7.4(触碰 id 邻接逻辑)留人工合并:#4085 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.809-master.1c38b7d # this exact build
npm install -g billion-context@master # always the newest merged build
|
查重
不重复:无既有 issue/PR 覆盖本失败签名(短请求使 fold 失活 + 规范化等价重发 → 永久失去压缩覆盖)。相关但不同:#3844/#3845(reap 防护——本复现位于其合入后的 master,块并未被 reap);#4036/#4040(compaction-trigger 活动探测——不同失败域,本例无 trigger);#3301(迁移材料缺失——本例材料充分,no-short 对照可恢复)。同根因无在途修复。
What this fixes (#4050)
A short request deactivates a retained fold (kernel syncBlocks — by design, #3844/#3845). When the main history then returns with canonical-equivalent bytes under churned ids (client re-serialization),
reconcileFoldCoveragenever re-keyed the block:coveredRealHistoryIdsskips inactive blocks, socovered.size === 0short-circuited the whole pass, the stale ids could never be found again, andsyncBlockscould never reactivate them. Result: summary dropped from the wire and the folded originals re-sent every turn (field evidence in the issue: input 230K→591K tokens, cache hit 99%→7%).The fix feeds the retained view-deactivated lineage back into the claim ladder as recovery candidates (
recoveryCandidateIds): active coverage is inserted first (the anchor cap's survivor order, #2334, is unchanged), then inactive non-expandedblocks' covered ids. The claim ladder decides per cell with multi-channel corroboration (positional fingerprint / normalized identity / simhash ≤8 / order bracket) — nothing is restored blindly. Corroborated cells get re-keyed byrewriteBlocks; the kernel'ssyncBlocksthen re-activates the block naturally on the next pipeline run. Non-corroborated cells stay honest mismatches and complete the EXISTING lifecycle: z-streak reap for verified substrates (#2695), truncation suppression (wireContinuity/tailTruncated), epoch verdict (#3641). Excluded:expandedblocks (host decompressed on purpose — fresh compress creates a NEW block; including them would feed #2293-style missing inflation). Consumed blocks need no exclusion (ids ⊆ surviving parent's, Set dedupes).Behavior changes (disclosed)
pluginAgent === undefined)expanded: trueNo user-visible behavior change when everything is healthy: active folds reconcile exactly as before (their ids were already in
covered; insertion order unchanged), and the reported shape now recovers instead of leaking.Config surface
None — no new config field, env var, or CLI flag.
kernel-change
N/A — host-side only (
src/fold-reconcile.ts). Kernel untouched.Tests
tests/issue4050-short-replay.test.ts— the issue's repro as an end-to-end HTTP regression (real proxy + loopback mock upstream, storage disabled, snapshotRender off): 4 scenarios. Pre-fix the short-normalized scenario asserted the buggy behavior (finalActive=0, summary off wire, folded originals on wire, +17,017B); it now pins recovery byte-identical to the no-short control (65,884B vs 65,884B). The genuinely-edited negative control pins HONEST MISMATCH (no blind restore).tests/fold-reconcile.test.ts— 4 new unit tests: churn re-keys both blocks (reconcile re-keys, kernel re-activates); sanctioned head-truncation of a verified span is never reaped (structural absence, no z accrual over 3 passes); mid-history edit accrues honest drift (z climbs, same [Bug][proxy] unframed host-side history deletion leaves zombie fold blocks rendering carriers forever — one carrier flaps in/out every turn (persistent prefix-cache churn) #2695 lifecycle as active folds); consumed child ids dedupe against the surviving parent.Closes #4050