Repository navigation
[PR] fix: cross-version restart no longer destroys fold state on explained id churn (#4131) - #4141
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4932-pr.4141.73a83b5This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4141.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本条目是 #4131 的修复 PR(Closes #4131)。检索 open PR:没有其他 PR 处理同一机制(#1001 rewrite 检测器把跨版本 id 重铸误判为客户端重写)。#4085 同属 id churn 家族但机制不同(短请求 deactivation 后折叠覆盖丢失,#4050 线),不构成重复。 标签:bug, opencode, scope/kernel, p2(缺陷类;opencode 车道;src 侧 ref/账本与折叠判定面;能用但有明显问题——折叠状态随后续 re-fold 自愈、无永久数据丢失,不达 p1 的「会话不可用/缓存泄露」档)。 审核已开始:分支 |
… fold-reconcile fully re-anchors (#4131) The #1001 unannounced-rewrite detector judged history rewrites on raw-id hash identity alone, outside the order-centric reconcile ladder. A bili upgrade across v0.1.201 re-mints non-text message ids by design (#3642 D1 accepted this one-time churn and promised the reconcile ladder would absorb it), so on the first turn after a cross-version restart the detector saw the collapse, marked a compaction boundary anyway, and applyCompactionArchive pruned the ref map + tombstoned hundreds of still-cited refs — destroying fold coverage for a pure transform (incident: 212 covered refs re-anchored with 0 unmatched, then pruned to 392 live ids). detectUnannouncedHistoryRewrite now takes this pass's fold-reconcile verdict: when kind is reanchored/resend with unmatched === 0, the collapse is explained churn — the destructive boundary is suppressed and an id-churn-adoption conflict event + info log are recorded instead. Off/noop verdicts carry no evidence and keep legacy behavior; partial claims (unmatched > 0) keep the legacy escalation path unchanged. Second facet (issue expectation #4): applyCompactionArchive now names in its log line how many refs the prune drops and which block coverages they sit under, so any remaining destructive prune is auditable instead of silent. Tests: tests/issue4131-cross-version-churn-gate.test.ts pins both directions (explained churn suppressed; genuine rewrite still escalates; off/noop verdicts do not suppress; legacy callers unchanged) plus the log facet.
…n events (#4141 review) Review of #4141 found that a session whose conflict ledger contains ONLY the new id-churn-adoption events (the exact shape this PR produces on a clean cross-build restart) fell through formatConflictSection into the [suspected]-plugin tier: header claimed 'something outside bili touched this conversation' and the advice told readers to 'confirm each named plugin really compresses' — both false, since the event is bili's own fully-handled re-mint adoption (#3642 D1). Same misframing class as #2802 (orphan-only) and #2912 (handled-native-only). Fix: dedicated adoptionOnly tier in the branch ladder (gated to pure ledgers so mixed ledgers keep their existing wording verbatim) with accurate header + active/historical advice; regression test pins the framing and the absence of plugin-hunt/remediation output. No behavior change beyond the panel/advice text.
d34ae7a to
283a2ef
Compare
(ai: vllm-qwen/qwen3.8-27b) 审核结论(独立审读,非复读 issue 分析)① 原 issue 方向:方向正确。#4131 的根因是检测层用单一证据维度(原始 id 哈希同一性)去否决 fold-reconcile 的多证据判决——直接违反 KDD#11「顺序为中心、hash 为辅助」;#3642 D1 承诺的「一次性 mass churn 由 reconcile 阶梯吸收」在检测层没兑现。修法打在机制上(把本 pass 的 reconcile 判决喂给检测器),不是堵症状。 ② 回归审查(逐一点名审过的既有行为面):
③ 代码审查:接线正确—— ④ 测试有效性:新测试有牙——POSITIVE 跑真实 ⑤/⑤b diff 整洁度/代码整洁:单提交、+222/−15、每行都与目的相关;命名达意( Review 发现并已当场修复(小问题直接修)adoption-only 账本的错框:新增的 同步做了 rebase:原 head 落后 master(v0.1.203 已发)。master 前进 ~50 个提交与本 PR 触碰的 7 个文件零重叠,rebase 干净;rebased head 上重跑了 typecheck(干净)+ 全部定向套件(8 文件 58/58 绿),已 force-push。 CI 现状:旧 head 结构化八问
PR 正文声明「不在本 PR 内」的两项(#1724 drain-barrier 双实例竞态、重铸后 stale startRef/endRef 使 decompress(bN) 显示退化)均已在 #4131 清单内单独跟踪,范围切割合理。 判定:无拦点,可合(§7.4 身份/会话绑定类 → 人工合并;等新 head |
Closes #4131
What this changes
A bili upgrade across v0.1.201 re-mints non-text message ids by design (#3642 canonical identity projection; D1 accepted this one-time mass churn and promised the reconcile ladder would absorb it). On the first turn after a cross-version restart the #1001 unannounced-rewrite detector — which sits OUTSIDE that ladder and judges on raw-id hash identity alone — saw the collapse (incident: 95/392 pre-turn refs), marked a compaction boundary anyway, and
applyCompactionArchivepruned the ref map to the incoming ids and tombstoned ~284 still-cited refs: fold coverage destroyed for a pure transform. User-visible: whole session re-sent unfolded, replay loop, prefix-cache misses.Fix: this pass's fold-reconcile verdict is now passed into
detectUnannouncedHistoryRewrite(openai/anthropic/google lanes; the responses lane carries no detector). When kind isreanchored/resendwithunmatched === 0, the collapse is explained churn — the destructive boundary is suppressed and anid-churn-adoptionconflict event + info log are recorded instead. Off/noop verdicts (reconcile disabled, side-request skip) carry no evidence → legacy behavior unchanged; partial claims (unmatched > 0) keep the legacy escalation path intact.Second facet (issue expectation #4): the
applyCompactionArchivelog line now names how many refs the prune drops and which block coverages they sit under, so any remaining destructive prune is auditable instead of silent.Behavior change disclosure (old → new)
Regression check
tests/issue4131-cross-version-churn-gate.test.ts: POSITIVE (realreconcileFoldCoverageover the re-minted fixture reports unmatched=0 → gate suppresses, no boundary, no deadRefs), NEGATIVE 1 (模型切换后压缩块跨模型失配,新模型收到 61.3 万 token 全量上下文 #1001 shape — covered substrate truly gone → still escalates), NEGATIVE 2 (append-only), NEGATIVE 3 (off/noop/null verdicts do not suppress; legacy callers bit-identical), plus the log facet.Boundaries
kernel/changes (host-side only). No config surface changes. No wire/message-shape changes — forwarded payloads stay byte-identical in every scenario; the change is the host's bookkeeping decision.startRef/endRefspans degradingdecompress(bN)display after a full re-mint (sub-defect checklist item under [Bug][opencode lane] Cross-version restart replays the whole session: old v0.1.197 and new v0.1.202 write the same sessions dir, 212 folded refs re-anchor onto churned bytes and the ref map is pruned to 392 raw ids #4131).