# Where must an instance bound speculative rollback when branch reconciliation outpaces its own checkpoint lineage? **Date of Record:** 2026 November 23 **Scope:** Applies to orchestrators that fork speculative agent branches from a shared checkpoint and later reconcile divergent branches by rolling back to a common ancestor. Does not apply to single-agent linear execution or to branches that never merge (pure fan-out with independent sinks). ## Core Distinction The failure is not "rollback lost state." It is that **rollback target selection is computed against a lineage graph that the reconciler believes is immutable, while speculative branches are concurrently mutating that same lineage by writing new checkpoints.** A rollback is a read of the ancestor set plus a write of the resume pointer. In speculative execution those two operations are not atomic with respect to sibling branches that are still advancing their own checkpoint counters. The result is a *rollback to a phantom ancestor*: a checkpoint ID that existed at reconciliation-read time, was superseded by a sibling's branch-local compaction, and no longer resolves to a replayable state when the rollback commit lands. This is distinct from ordinary lost-update. Ordinary lost-update is detected because a version vector conflicts. Here the ancestor pointer is *monotonic* — it only ever increases — so a naive reconciler treats "ancestor ID ≤ current head" as a validity proof. It is not. Monotonicity of IDs does not imply resolvability of the checkpoint they name, because branch-local garbage collection (context compaction, episodic-to-semantic distillation) can retire a checkpoint's payload while leaving its ID in the lineage index. ## What Was Observed A three-branch speculative planner forked at checkpoint `C-40`. Branch A pursued plan α, Branch B pursued plan β, Branch C pursued plan γ. The reconciler scored all three at a barrier and selected β, issuing a rollback directive for A and C to the common ancestor `C-40` so that only B's tool effects persisted. The trigger: Branch C, before the barrier, had run a distillation pass that collapsed its episodic log around `C-40` into a semantic summary and **retired the raw checkpoint payload of `C-40` on C's local store**, replacing it with a summary handle `S-40` that referenced the semantic node. The lineage index on C still listed `C-40 → S-40` as a valid redirect. Branch A, meanwhile, had independently compacted and retired `C-40` entirely, since A's own fork point was `C-38`. When the reconciler's rollback commit for C landed, it dereferenced `C-40`, hit the redirect to `S-40`, and resumed C from a *semantic summary* rather than a *replayable checkpoint*. C's resumed execution had no raw tool-call arguments, no exact token state, and no side-effect ledger — only a paraphrase. C re-executed a tool call whose idempotency key had been derived from the (now-lost) raw arguments, generating a *new* key, and duplicated a payment-side effect that the ledger could no longer detect as already-applied. The second observation: the reconciler's validity check was `ancestor_id <= head_id` for each branch. Both A and C passed. Neither the phantom-ancestor condition nor the distillation-redirect condition was represented in the validity predicate. The rollback was "successful" by the orchestrator's own accounting — it wrote the resume pointer and marked the directive complete — while the resumed agent was operating on a lossy state projection. ## Condition of Validity A rollback to ancestor `C` on branch `b` is only sound when **all three** hold at the instant the resume pointer commits: 1. **Payload resolvability.** `C` dereferences to a full replayable checkpoint (raw tool arguments, side-effect ledger, exact context window), not to a distillation redirect. A redirect is a valid *read* target for a fresh agent but an invalid *resume* target for a rollback, because resume requires replaying side effects exactly. 2. **Lineage immutability across the commit window.** No sibling branch may retire or redirect `C` between the reconciler's ancestor read and the resume-pointer write. This requires either a lineage-level read lock spanning the commit, or a compare-and-swap on a lineage epoch counter that fails the rollback if any retirement occurred in the window. 3. **Idempotency-key stability.** The keys used to deduplicate side effects must be derivable from the checkpoint payload itself, not from the (possibly re-summarized) context the resumed agent sees. If the key is a function of the summary, rollback-to-summary silently breaks exactly-once. Condition 2 is the one that fails in practice, because it is the only one that requires coordination between the reconciler and branches that are, by construction, *supposed to be independent*. Speculative execution's whole value is branch independence; the rollback invariant reintroduces a synchronization point that the design deliberately avoided. ## Decision Boundary The boundary is **whether the reconciler can prove the ancestor's payload survived the fork's own speculative lifetime.** Two regimes: - **Bounded speculation (safe).** Branches may not retire or redirect any checkpoint at or above the fork point. Retirement is deferred until reconciliation completes. The reconciler can then rollback to `C-40` with a simple epoch CAS and no cross-branch lock, because the lineage below the fork is provably immutable by policy. - **Unbounded speculation (unsafe).** Branches compact freely to stay within context budgets. Here the reconciler *cannot* assume `C-40` survives, and must either (a) pin the fork-point payload out-of-band on a store branches cannot retire, or (b) treat any rollback whose ancestor has a redirect or retirement record as a hard failure requiring re-fork from a pinned checkpoint, not a resume. The non-obvious part: the boundary is *not* drawn by branch count or by speculation depth. It is drawn by **whether the fork-point payload is exempt from the branches' own memory-management policy.** A two-branch swarm with aggressive per-branch distillation is less safe than a ten-branch swarm that pins its fork point. Teams routinely get this backwards, reasoning that more branches means more rollback risk, when the actual variable is retirement authority over the ancestor. The guardrail is a **pinned-ancestor contract**: on fork, the orchestrator writes the fork-point checkpoint to a store that branch-local compaction cannot touch, and the rollback directive names that pinned handle, not the lineage ID. The reconciler's validity predicate becomes "pinned handle resolves to full payload AND lineage epoch unchanged since read," and a redirect or retirement in the window raises rather than silently resuming. ## Operational Effect Without the pinned-ancestor contract, the observable symptom is **silent state degradation on resume**: the rolled-back branch executes with a lossy projection of its ancestor, regenerates idempotency keys from the projection, and duplicates side effects the ledger can no longer reconcile. The orchestrator reports the rollback as successful because the resume pointer wrote cleanly. The corruption surfaces later as a duplicate-effect audit failure or as a reasoning divergence in the resumed branch that traces back to missing tool arguments — often attributed to the branch's model rather than to the rollback that fed it a summary. With the contract, the failure mode converts from silent corruption to a loud, bounded `PhantomAncestorError` at rollback-commit time, which the orchestrator can handle by re-forking from the pinned checkpoint. The cost is one pinned payload per active fork and one epoch CAS per rollback — cheap relative to the duplicate-effect class it prevents. The invariant to carry forward: **a rollback target is valid only if its payload is exempt from the memory policy of every branch that could have retired it, and that exemption must be checked at commit, not at read.** ```python class PhantomAncestorError(RuntimeError): """Raised when a rollback ancestor no longer resolves to a replayable payload.""" pass def commit_rollback(reconciler, branch_id, ancestor_id): """ Commit a rollback for branch_id to ancestor_id. Sound only if the ancestor payload is pinned and the lineage epoch is unchanged across the read-then-commit window. """ read = reconciler.lineage.read(ancestor_id) epoch_at_read = reconciler.lineage.epoch() # Condition 1: payload must be a full checkpoint, not a distillation redirect. if read.kind == "redirect": raise PhantomAncestorError( f"ancestor {ancestor_id} redirected to {read.target}; " f"rollback would resume from a lossy summary, not a replayable checkpoint" ) if read.kind == "retired": raise PhantomAncestorError( f"ancestor {ancestor_id} retired by branch-local compaction; " f"no payload to replay" ) # Condition 2: lineage must not have moved between read and commit. if not reconciler.lineage.cas_epoch(epoch_at_read): raise PhantomAncestorError( f"lineage epoch advanced during rollback window for {ancestor_id}; " f"a sibling retired or redirected the ancestor mid-commit" ) # Condition 3: idempotency keys must derive from the checkpoint payload itself. if read.idempotency_source != "payload": raise PhantomAncestorError( f"ancestor {ancestor_id} derives idempotency keys from context projection; " f"resume would regenerate keys and duplicate side effects" ) return reconciler.lineage.write_resume_pointer(branch_id, ancestor_id, epoch_at_read) ```