Repository navigation
fork↔replicas convergence: pinned fork_base checkpoints (#2960 ②) - #3014
Merged
ranxianglei merged 1 commit intoOct 13, 2026
Merged
Conversation
… ②) - SessionStore.maybeCutForkBase: on writeNow/flushSync, when the unified sidecar is live and the session carries publicForkReceipt or publicSnapshotRetained, cut a pinned fork_base checkpoint holding the full buildRecord blob (kind: fork_base, label: 'fork-base <id>'). - Memoized per session (Set + listCheckpoints probe) so steady-state writes don't re-query; failure logs one warn and never blocks the write. - deleteSession already skips pinned checkpoints — fork substrate now survives parent deletion and restores via restoreReplica. - tests/fork-replica-convergence.test.ts: full-mode e2e (both sides cut, pinned survives deleteSession, child independent, parent resurrects with identical orderedMessages) + legacy control (no index.db).
This was referenced Oct 13, 2026
Merged
Open
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Step ② of the #2960 roadmap (see the plan comment): every plugin fork now cuts a pinned
fork_basecheckpoint into the unified index, at the same flush that persists the fork receipt.SessionStore.maybeCutForkBaseruns afterwriteNow/flushSync. Gate: unified sidecar live and (publicForkReceiptpresent orpublicSnapshotRetained === true) andpluginSnapshotnon-empty — i.e. exactly the sessions whose fork substrate is worth pinning. The checkpoint blob is the fullbuildRecordenvelope (kindfork_base, labelfork-base <id>,pinned: true).listCheckpointsprobe) so steady-state writes don't re-query; a failed cut logs one warn and never blocks the write path.deleteSession(from Identity pipeline R2 v1: namespace + origin columns + #2847 proof suite (#2960) #2963/Fix: #2815 review follow-ups — persisted-chain tiebreaker, schema v2, safe word-bag digest #2988 review fixes) already sweeps only unpinned checkpoints — so fork substrate now survives parent deletion, and a deleted parent can be resurrected wholesale via the replicas API (restoreReplica) with an identical ordered snapshot.Why this shape
planIngestinternspluginSnapshot ∪ lastMessages;loadLegacyViewrebuilds it fromtailJson.pluginSnapshotSeqs) — so full mode already serves snapshots from the DB. What was missing is a deletion-proof pin, which is the exact substrate Phase 3 (envelopejsonWriter: off) needs before the legacy snapshot blob can be dropped.fork_base: the child's receipt and the parent's retained snapshot are symmetric substrates (independent lineage proven by the test).Tests
tests/fork-replica-convergence.test.ts(new):fork_base;deleteSession(parent)leaves the pinned row and the child fully functional;restoreReplicaresurrects the parent under a fresh id withorderedMessagesdeep-equal to the original; the child is unaffected.index.dbever created (rollback contract unchanged).Stack
#2998(R2.2) ←#3007(⑤ raw tail) ←#3010(③ CCR mirror) ← this PR. Each is independently reviewable; bases retarget to master as the stack merges.prepared by an agent under the local git identity (ranxianglei), human merge required