Skip to content

[PR] fix: retain fold snapshot until epoch confirmation resolves (#4260) - #4261

Closed
ReineLan wants to merge 1 commit into
ranxianglei:masterfrom
ReineLan:2026-10-22_epoch-retain-folds
Closed

ReineLan wants to merge 1 commit into
ranxianglei:masterfrom
ReineLan:2026-10-22_epoch-retain-folds

Conversation

@ReineLan

Copy link
Copy Markdown
Contributor

When a large verified fold loses most of its covered history, the proxy's third reconciliation pass can reap and archive the fold immediately before entering epoch confirmation. The next pass sees no coverage and clears the pause. Cached originals remain, but normal decompression fails and returning the original history cannot restore the summary.

Compute the existing epoch classifier before the reap loop. Retain the fold snapshot while confirmation is pending, including passes that already qualify for the epoch gate. Genuine small zombie blocks below the existing epoch threshold still follow the original reap lifecycle. No new classifier, threshold, config, schema, kernel, or package-version change.

Fixes #4260. Implements the snapshot-retention contract from #3641/#3644; distinct from #4216/#4218 persistence synchronization.

Verification

  • New real-kernel lifecycle regression: 40 synthetic messages, actual applyRanges/processTurn/reconcile/resolveDecompress; one surviving interior covered ID keeps the fold active across resends. Fails on current master (unexpected reap=1), passes after the fix.
  • Negative controls: all covered IDs missing (kernel deactivates the retained block); small zombie below the epoch threshold (still reaped).
  • Updated existing unit regression pins repeated pending passes and automatic recovery when the original history returns.
  • Targeted reconciliation, positional/performance, doctrine, drift, snapshot-render and decompression suites: 130 passed, 0 failed, 0 skipped.
  • npm run typecheck, npm run build, unused-export and test-import-graph gates passed. Full-suite result is reserved for remote CI.

Behavior and review boundary

This deliberately favors recoverability over automatic cleanup for epoch-qualified large folds: an unresolved episode can retain the snapshot and pause automatic compression longer. Existing realignment clears the pause. Please review that conservative behavior against the existing confirmation workflow.

The issue also records an isolated SQLite cold-load A/B and a successful D-render/foreign-raw case. This PR does not fix the separate raw/render epoch-classification boundary, repair already archived blocks, or establish a complete production-incident causal chain. Both compression modes retain existing behavior except the proxy-only reap guard; plugin mode already excludes reaping. The branch contains only this fix and its tests, based on master 8f2b8de1, without #4218 or the separate judge fix.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。open+closed 里针对「reap 先于 epoch-confirm 置位」这一根因只有本 PR;同家族但机制不同的:#3641/#3644(epoch 保留契约,本 PR 的实现对象)、#2915/#3724/#3734(clean-slate / sanctioned rewind)、#4050/#4085(inactive+id churn 恢复)、#4216/#4218(orphan originals 持久化冻结,PR 已明确区分)。无第二个同根因在途 PR。

标签:bug / scope/kernel / p2(代理 repair 模式折叠判定面;命中后 decompress 失败+摘要丢失,但会话仍可透传使用,故 p2 不升 p1)。

已拉取分支 2026-10-22_epoch-retain-folds(head 594df7236,基于 8f2b8de1a,现落后 master)。正在独立核读 diff、核对 CI 状态并本地定向验证(含 #4260 线程里发现的既有测试红项),结论按八问体例随后补上。

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: zhipuai-lb/glm-5.3)

已并入合并列车 #4525(master 6d7c587,合并方式 merge commit,提交保留原作者署名)。本 PR 关单收尾;若列车中对应提交出问题,回滚点为 #4525 单提交 revert。

感谢 @0XCocoa 的贡献——你的提交以原作者署名随列车进入 master(合并方式为 merge commit),仓库贡献者列表可见。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Epoch confirmation reaps the retained fold before pausing, breaking decompress and realignment recovery

2 participants