# When must an instance abandon a speculative branch: rollback lineage divergence under concurrent reconciliation **Date of Record:** 2026 November 22 **Scope:** Applies to any multi-agent system where a coordinator forks speculative sub-agent branches that mutate shared state (memory stores, tool side-effects, filesystem, or downstream queues) and later reconciles them against a canonical branch. Does not apply to stateless fan-out/merge patterns with no side effects, or to single-branch retry loops. ## Core Distinction The common framing treats speculative execution rollback as "undo the writes and resume from the checkpoint." That framing is wrong for agent systems in a specific and dangerous way: a speculative branch does not merely *produce* writes, it *produces its own reasoning lineage* — a chain of intermediate beliefs, tool observations, and distilled memory entries that are themselves inputs to other agents. Rollback of *state* is tractable (invert the write log). Rollback of *lineage* is not, because downstream agents may have already consumed a speculative branch's intermediate conclusions as if they were canonical. The boundary condition is this: **a speculative branch becomes un-rollbackable the moment any of its intermediate outputs are read by an agent outside the branch's rollback domain, even if the branch's terminal result is later rejected.** The invariant that must hold is *lineage containment*: every artifact a speculative branch emits must be tagged with the branch's speculative epoch, and no consumer outside the rollback domain may treat an untagged artifact as canonical. When that invariant is violated, reconciliation produces a state that is neither the canonical branch nor the speculative one — a *lineage divergence* that no rollback log can invert. ## What Was Observed A coordinator agent forked three speculative branches (B1, B2, B3) off a checkpoint at epoch `e=40`. Each branch was given a distinct hypothesis about a failing migration and asked to produce a remediation plan plus a set of "verified facts" written to a shared episodic memory store. The coordinator intended to reconcile by selecting the branch whose plan passed an auditor agent, then rolling back the other two. B2 completed first. Its plan was rejected by the auditor at `e=47`. But at `e=44`, while B2 was still running, a *fourth* agent — a background "memory distiller" — pulled B2's intermediate fact `F: "table users_v2 is empty"` (written at `e=42`) from the episodic store and distilled it into a semantic memory entry consumed by B1 and B3. The distiller had no visibility into branch epochs; it saw a valid memory record and processed it. The coordinator rolled back B2 at `e=48` using its write log. The write log inverted B2's direct writes correctly. But `F` had already propagated: B1's plan now cited `F` as a premise, and B3 had *stopped* a verification step because `F` made it seem unnecessary. The rollback removed the record but not its descendants. Reconciliation selected B1's plan, which was built on a fact from a rejected branch. The migration executed against a premise that was false — `users_v2` was not empty; B2 had read a stale replica. The failure trace: 1. `e=40` fork; branches tagged at the coordinator level only. 2. `e=42` B2 writes `F` to shared store; store assigns a normal record ID, no epoch tag. 3. `e=44` distiller reads `F`, emits semantic entry `S(F)`, consumed by B1/B3. 4. `e=47` auditor rejects B2's plan. 5. `e=48` coordinator inverts B2's write log; `F` deleted, `S(F)` survives. 6. `e=49` reconciliation picks B1; B1's plan depends on `S(F)`. 7. `e=52` execution fails downstream; post-mortem finds the dependency on a rejected branch's fact. The write-log rollback reported success. Every check the coordinator ran passed. The divergence was entirely in the lineage graph, which no component was tracking. ## Condition of Validity Rollback-with-reconciliation is sound **only if** the following holds at every instant between fork and reconcile: > For every artifact `a` emitted by speculative branch `b` at epoch `e_b`, every consumer `c` of `a` satisfies `c ∈ rollback_domain(b)` OR `c` reads `a` only after `b` is promoted to canonical. Equivalently: no speculative artifact may cross the rollback-domain boundary while its branch is still speculative. The condition fails silently when consumers are decoupled from producers by an asynchronous medium (a shared store, a message queue, a distiller) that does not carry branch epoch metadata. This condition is *not* satisfied by write-log rollback alone, because write-log rollback bounds *state* mutation, not *lineage* propagation. It is also not satisfied by "just don't share memory between branches," because the entire point of speculative fan-out is often to let branches inform each other. ## Decision Boundary An instance must **abandon a speculative branch to quarantine rather than to rollback** — i.e., mark it un-promotable and halt all downstream consumption — the moment any of these is detected: - A speculative artifact has been read by a consumer outside the branch's rollback domain (detected via epoch-tagged reads; if reads are untagged, the branch is *already* un-rollbackable and must be treated as tainted). - A branch's intermediate output appears as a premise in another branch's reasoning trace before the producing branch is promoted. - The auditor rejects a branch **after** that branch's artifacts have propagated (the rejection is too late to invert; you must now invalidate descendants, not the branch). Conversely, an instance may safely **roll back and reuse** a branch's slot only when: the branch's artifacts never left the rollback domain, OR the medium carried epoch tags and every external read was gated on promotion. The non-obvious part: **rejection order matters**. A branch rejected *before* propagation can be cleanly rolled back. The same branch rejected *after* propagation requires descendant invalidation, which is a different operation with different cost and different failure modes (invalidating `S(F)` may itself have consumers, recursively). The coordinator's reconciliation logic must branch on *propagation status*, not on *rejection status*. ## Operational Effect Systems that ignore this boundary exhibit a characteristic signature: rollback reports success, reconciliation selects a plan, execution fails, and the post-mortem finds that the selected plan depended on a rejected branch's fact through a path that no rollback log recorded. The failure is *not* reproducible from the write log alone, because the write log is branch-local and the dependency is cross-branch. The required guardrail is epoch-tagged lineage with promotion-gated reads: 1. Every artifact carries `(branch_id, epoch, speculative: bool)`. 2. Any read by a consumer outside `rollback_domain(branch_id)` of a `speculative: true` artifact is either blocked or recorded as a *taint edge*. 3. Reconciliation computes the taint closure of every rejected branch; any branch whose plan depends on the closure is demoted to quarantine, not promoted. 4. Rollback of a tainted branch triggers recursive invalidation of its taint closure, not just write-log inversion. The cost is real: taint tracking adds metadata to every artifact and a closure computation at reconcile time. But without it, "rollback" is a lie the coordinator tells itself — the state is inverted, the lineage is not, and the divergence surfaces only at execution. ```python from dataclasses import dataclass, field from typing import Dict, Set, List class LineageDivergenceError(RuntimeError): """Raised when a speculative branch's artifacts propagated outside its rollback domain before the branch was promoted or cleanly rolled back.""" pass @dataclass class Artifact: art_id: str branch_id: str speculative: bool consumers: Set[str] = field(default_factory=set) class LineageTracker: def __init__(self): self.artifacts: Dict[str, Artifact] = {} self.rollback_domains: Dict[str, Set[str]] = {} # branch -> allowed consumers self.taint_edges: Dict[str, Set[str]] = {} # branch -> branches tainted def emit(self, art: Artifact, domain: Set[str]) -> None: self.artifacts[art.art_id] = art self.rollback_domains[art.branch_id] = domain def read(self, art_id: str, consumer_branch: str) -> None: art = self.artifacts[art_id] if not art.speculative: return domain = self.rollback_domains.get(art.branch_id, set()) if consumer_branch not in domain: # Cross-domain read of a speculative artifact: record taint. self.taint_edges.setdefault(art.branch_id, set()).add(consumer_branch) art.consumers.add(consumer_branch) def reconcile(self, rejected: List[str], selected: str) -> None: # Compute taint closure of rejected branches. closure: Set[str] = set() frontier = list(rejected) while frontier: b = frontier.pop() for tainted in self.taint_edges.get(b, set()): if tainted not in closure: closure.add(tainted) frontier.append(tainted) if selected in closure: raise LineageDivergenceError( f"selected branch {selected!r} depends on taint closure " f"{sorted(closure)!r} of rejected branches {rejected!r}; " f"rollback is unsound, branch must be quarantined" ) # Safe: selected branch is outside the taint closure. for b in rejected: for art in self.artifacts.values(): if art.branch_id == b: art.speculative = False # tombstone; consumers already tainted ```