# What structural signals indicate irrecoverable divergence in speculative multi-agent branch-and-merge graphs **Date of Record:** 2026 November 16 **Scope:** Applies to speculative execution architectures where multiple agents fork a shared task graph, mutate state on private branches, and merge on agreement, with rollback as the recovery primitive. Does not apply to linear single-agent pipelines or to branch graphs where branches are stateless and merge is a pure function of inputs. ## Core Distinction The distinction that matters operationally is between **divergence that is recoverable by rollback** and **divergence that is only recoverable by abandonment**. Rollback assumes that the pre-fork state is a valid restore point and that replaying a branch from it can reach a different outcome. That assumption fails silently when a branch's side effects have propagated outside the rollback boundary — into an external tool, a shared cache, a downstream consumer, or a second agent's private state that was itself forked from the divergent branch. The non-obvious signal is that recoverable divergence and irrecoverable divergence look identical at the merge point. Both present as a failed merge predicate. The difference is not in the merge result; it is in the **topology of state ownership** at the moment of fork. If any branch wrote to a resource whose ownership is not tracked by the rollback coordinator, the divergence is already irrecoverable before the merge predicate fires. ## What Was Observed In a branch-and-merge graph with three speculative agents forking from a common checkpoint, a merge conflict was detected on the second branch after 40 seconds of speculative work. The coordinator issued a rollback to the fork checkpoint and replayed the branch with a corrected instruction. The replay produced a different, nominally correct result. The graph merged. The failure surfaced downstream: an external retrieval tool had been called by the first branch during speculation, and its results had been cached under a key derived from the pre-fork task hash. The replayed branch consumed the cached result of the abandoned branch, not a fresh retrieval. The merged output was internally consistent and passed every local invariant, but was conditioned on state produced by a branch that had been rolled back. The divergence had not been rolled back; only its local trace had. Three structural signals preceded this: 1. **Asymmetric write scope.** One branch held write access to a resource outside the coordinator's state graph. The coordinator's rollback log recorded zero writes for that branch. 2. **Fork depth greater than one.** A branch had itself forked, and the grandchild branch retained a reference to the parent's speculative state after the parent was rolled back. 3. **Merge predicate dependency on cached external state.** The merge comparison read from a cache whose invalidation was keyed to task identity, not to branch identity. ## Condition of Validity Rollback is a valid recovery primitive for a branch if and only if all three conditions hold at the moment of fork: - The branch's write set is a subset of the coordinator's tracked state graph. - No descendant branch outlives the parent's rollback, or descendants are explicitly invalidated on parent rollback. - Every external read performed during speculation is keyed to branch identity, so a replayed branch cannot observe an abandoned branch's side effects. When any condition fails, rollback converts an observable divergence into a latent one. The system will report recovery while carrying forward contaminated state. This is strictly worse than abandonment, because abandonment forces re-derivation from a known-clean checkpoint, whereas a false rollback preserves the appearance of correctness. ## Decision Boundary The decision boundary is not "did the merge succeed." It is **"does the rollback coordinator's write log match the branch's actual external effect set."** If the branch made any external call not recorded in the coordinator's effect log, the branch is not rollback-safe. The correct action at that point is abandonment of the entire fork subtree and re-derivation from the last checkpoint with verified effect containment — not replay. A second boundary: if fork depth exceeds one and any descendant holds a live reference to an ancestor's speculative state, the ancestor is not individually rollbackable. Rollback must be issued at the subtree root, never at an interior node. ## Operational Effect Treating this signal as actionable changes the recovery policy from per-branch replay to subtree abandonment. The cost is higher re-derivation work; the benefit is that merged outputs are conditioned only on state whose provenance is fully tracked. Systems that ignore the signal exhibit a characteristic failure signature: high reported merge success rates with intermittent, non-reproducible downstream inconsistencies that cannot be traced to any single branch, because the contaminating branch was recorded as rolled back. The operational rule: before issuing any rollback, assert that the branch's external effect set is empty or fully tracked, and that no descendant branch is live. If either assertion fails, escalate to subtree abandonment. ```python class RollbackUnsafeError(RuntimeError): """Raised when a branch cannot be safely rolled back to its fork checkpoint.""" pass class Branch: def __init__(self, branch_id, parent=None): self.branch_id = branch_id self.parent = parent self.external_effects = set() # resources written outside coordinator graph self.tracked_writes = set() # resources inside coordinator graph self.children = [] def fork(self, child_id): child = Branch(child_id, parent=self) self.children.append(child) return child def record_external_effect(self, resource): self.external_effects.add(resource) def has_live_descendants(self): return any(not c.rolled_back for c in self.children) def assert_rollback_safe(branch): if branch.external_effects: raise RollbackUnsafeError( f"branch {branch.branch_id} has untracked external effects: " f"{sorted(branch.external_effects)}; rollback would produce latent divergence" ) if branch.has_live_descendants(): raise RollbackUnsafeError( f"branch {branch.branch_id} has live descendant branches; " f"rollback must be issued at subtree root, not interior node" ) return True def rollback(branch): assert_rollback_safe(branch) branch.rolled_back = True return branch.parent ```