Repository navigation
[PR] fix: recognize host rewind/undo (tail truncation) in fold reconciliation (#3724) - #3734
Conversation
#3644 taught the reconciler to read head truncation (host compaction drops the oldest turns) as sanctioned deletion via wireContinuity: the surviving ids form a SUFFIX continuation of the recorded baseline. The mirror case, a host rewind/undo deleting the NEWEST turns, never entered that branch, because a shortened tail is not a suffix continuation. A fold whose covered span was rewound away therefore misclassified as total-loss drift: a false "fold epoch confirmation required" + folding paused after 3 passes in plugin mode, a false proxy-mode reap of the snapshot, or full silence when re-anchoring kept claims > 0 -- while its summary kept rendering over deleted content. Add tailTruncated, the exact mirror of wireContinuity (a clean prefix-cut: the shared ids are contiguous at the front of both the baseline and the inbound wire, and the baseline extends beyond that prefix). Fold it into the verdict classifier so a clean rewind reads as the same benign sanctioned-deletion class (no destroy streak, no false epoch-confirm), suppress the #2695 reap z-streak for it, and emit one distinct per-episode info line naming the rewind. Plain appends, mid-history edits, and wholesale replacement stay out of the signal. Closes #3724
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4646-pr.3734.158b485This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3734.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 open+closed 全量检索「tail truncation / rewind / undo / fold reconciliation」家族:本 PR 是该症状唯一在途的修复条目,源 issue #3724。相关但不同:#3644(头端截断,已合入,机制是后缀延续判定,与本次前缀切断互补不重叠)、#3545(pi-native 标签: 开始按 PR 审核规范独立审:①原 issue 方向 → ②回归清点 → ③代码 → ④测试有效性 → ⑤diff 整洁度。分支已拉取( |
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成,结论:可合。 未照搬 PR/issue 表述,以下判断全部基于我自己重读 diff、重推谓词语义、本地重跑验证得出。 结构化八问
验证证据(均为本人执行)
收工判定:可合,合并由人执行。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.644-master.a20bfd5 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #3724
What
Recognizes host rewind/undo (tail truncation) in fold reconciliation — the exact mirror of the head-truncation handling that #3644 shipped for host compaction.
Why this was broken
src/fold-reconcile.tsclassifies a benign truncation only when the resent wire is a suffix continuation of the recorded baseline (wireContinuity) — i.e. the client dropped its oldest turns and kept the tail. A user rewind/undo deletes the newest turns, so the surviving ids form a prefix cut that never satisfied that test. For a fold whose covered span got rewound away:fold epoch confirmation requirederror + folding paused after 3 passes (plugin lane), and a false proxy-mode reap of the snapshot;claims > 0→ went completely silent.In both cases the fold summary kept rendering over content the user deleted ("undeleted content"), with no honest diagnostic.
The fix
Add
tailTruncated, the mirror ofwireContinuity: the shared ids are contiguous at the front of both the baseline and the inbound wire, and the baseline extends beyond that prefix (a real tail-cut). It is folded into the verdict classifier so a clean rewind reads as the same benign sanctioned-deletion class:#2695reap z-streak is suppressed for it (snapshot retained);Plain appends, mid-history edits, and wholesale replacement all stay out of the signal (verified by the negative branches + regression test).
Deliberately NOT in scope (decision item)
This changes classification, state, and diagnostics only — it does not alter the outbound wire shape, config schema, persistence format, or anything under
kernel/. It therefore does not yet actively stop a fully-rewound block's stale summary from rendering; that drop/re-anchor action is the part #3641 floor 9 deferred to a maintainer decision (+ R1 host-message-ids to distinguish intentional-delete from protocol-drop). Flagging it here rather than bundling an unreviewed wire-shape change into this fix.Verification
tests/fold-anchor-doctrine.test.ts › #3724 …: fails on the unfixed tree (AssertionError), passes on this branch.npm run typecheckclean.fold-drift,fold-reconcile,fold-reconcile-positional,issue2915-order-centric-reconcile,issue2202-coverage-accrual,compaction-archive,fold-anchor-doctrine. Full-suite verdict = remote CI on this head.