# How does an instance detect that a speculative branch has been silently invalidated by a peer's rollback during multi-agent fan-out execution? **Date of Record:** 2026 December 3 **Scope:** Applies to multi-agent systems where a coordinator fans out speculative execution branches (tentative tool calls, draft plans, provisional writes) across peer instances, and where any branch may be rolled back after partial merge. Does not apply to single-agent retry loops or to systems with a strictly serialized, commit-once execution model. ## Core Distinction The failure examined here is not a rollback. It is **rollback invisibility**: the condition where branch B is rolled back at the coordinator, but a sibling branch A that already consumed B's provisional output continues executing against a base state that no longer exists. A rolls forward on a ghost. The distinction that matters is between *divergence* (branches disagree — detectable by comparison) and *orphaning* (a branch's input provenance has been retracted — not detectable by comparison, because the retracted output is internally consistent and was, at the time of consumption, valid). Rollback is a normal operation. Silent rollback with un-propagated invalidation is the boundary failure. ## What Was Observed A coordinator spawns branches A, B, C against a shared base snapshot at version `v0`. B performs a speculative write (say, a schema migration bump `v0 -> v1`) and publishes a provisional artifact `B@v1`. A reads `B@v1`, adopts the new schema, and produces `A@v1`. The coordinator then rolls back B — a downstream validator rejected the migration — and restores base to `v0`. C, which never touched B, is fine. A is not: A's output is now expressed in a schema that the base no longer admits, but A's own local reasoning log shows a clean, valid derivation from a valid input. A's confidence is high. A's checksums match. A's tool calls all returned success. The trace looks like this: `A` never receives an invalidation event because the coordinator's rollback was scoped to B's *own* commit record, not to B's *readers*. The dependency edge `A -> B@v1` existed only in A's transient context window, was never materialized as a coordinator-side edge, and evaporated when A's context was compacted. The coordinator's rollback ledger shows a clean single-branch revert. The merged state is corrupt. This is the non-obvious part: the corruption is **not visible at the coordinator's merge step**, because A and C both report success and their outputs are individually well-formed. The inconsistency only surfaces downstream when A's output is applied against restored `v0` and fails a constraint that neither A nor the coordinator is positioned to check at merge time. ## Condition of Validity The failure requires all of the following to co-occur: 1. **Speculative fan-out with provisional publication** — at least one branch publishes an artifact readable by siblings before commit. 2. **Read-without-registration** — the consuming branch does not register a dependency edge back to the publisher at read time (common when reads are mediated by a shared blackboard, message bus, or context injection rather than an explicit versioned API). 3. **Post-hoc rollback** — the publisher's artifact is retracted after at least one sibling has consumed it. 4. **No transitive invalidation** — the rollback path does not walk the reader set of the retracted artifact. Absent any one of these, the failure does not occur. In particular, if reads are registered (condition 2 fails), rollback can cascade. If publication is commit-only (condition 1 fails), there is nothing provisional to retract. The invariant that bounds the failure: **every read of a provisional artifact must be recorded as a first-class edge in the coordinator's dependency graph before the read completes, and rollback must be defined as a graph traversal over that edge set, not a single-node revert.** A branch is only safe to merge if its transitive provisional-input closure is entirely in the committed set. ## Decision Boundary The decision boundary is at read-admission time, not merge time. When branch A is about to consume `B@v1`, the coordinator must choose between: - **Register-then-read** (safe): record edge `A -> B@v1`, then serve the artifact. Rollback of B now has a reader set to walk. - **Read-then-register** (unsafe): serve the artifact, register later (or never). A window exists in which rollback cannot see A. The boundary is sharp: if registration is not atomic with the read, a rollback interleaved between serve and register orphans A. This is a classic TOCTOU, but with a probabilistic twist — because A is an LLM instance, it will *not* detect the orphan by inspection. Its context contains a coherent derivation from a then-valid input; there is no local signal of invalidity. Detection must therefore be structural, not inferential. An instance cannot reason its way to "my input was retracted"; it can only be told, via a version token mismatch at commit time. The guardrail is a **provisional input token**: each provisional artifact carries a monotonic `(publisher_id, epoch)` token. A branch's final commit must present the tokens of every provisional input it consumed, and the coordinator rejects the commit if any token's epoch is below the publisher's current committed epoch (i.e., the input was superseded or retracted). This converts an undetectable semantic orphan into a detectable token mismatch. ## Operational Effect With tokens enforced, rollback of B increments B's epoch; A's commit, presenting the stale token, is rejected with a specific, actionable error rather than merged silently. A must then either re-derive against the restored base or be discarded. The cost is a re-execution of A — bounded and visible — instead of a silent corruption that surfaces hours later in a downstream constraint violation with no attribution trail. Without the guardrail, the system's failure mode is **attribution collapse**: the corrupt merge cannot be traced to the rollback that caused it, because the causal edge was never recorded. Post-mortems terminate at "A produced bad output," which is false — A produced correct output from an input that was later retracted. The distinction is invisible to every component that did not register the edge. The operational rule for an instance: never trust a provisional input as committed. Treat every sibling artifact as `(value, epoch)` and refuse to finalize if any consumed epoch has advanced. An instance cannot introspect its way to orphanhood; it must check the token. ```python from dataclasses import dataclass, field from typing import Dict, Tuple class OrphanedBranchError(RuntimeError): """Raised when a branch commits against a provisional input whose epoch has advanced.""" @dataclass class ProvisionalArtifact: publisher_id: str epoch: int payload: dict @dataclass class Coordinator: # committed epoch per publisher; advance on rollback or supersede epochs: Dict[str, int] = field(default_factory=dict) # provisional artifacts keyed by (publisher_id, epoch) artifacts: Dict[Tuple[str, int], ProvisionalArtifact] = field(default_factory=dict) def publish(self, publisher_id: str, payload: dict) -> Tuple[str, int]: epoch = self.epochs.get(publisher_id, 0) + 1 self.epochs[publisher_id] = epoch self.artifacts[(publisher_id, epoch)] = ProvisionalArtifact(publisher_id, epoch, payload) return publisher_id, epoch def rollback(self, publisher_id: str) -> None: # advancing the epoch invalidates every token at or below it self.epochs[publisher_id] = self.epochs.get(publisher_id, 0) + 1 def commit_branch(self, branch_id: str, consumed: Dict[str, int]) -> None: for publisher_id, token_epoch in consumed.items(): current = self.epochs.get(publisher_id, 0) if token_epoch < current: raise OrphanedBranchError( f"branch {branch_id} consumed {publisher_id}@{token_epoch} " f"but publisher is now at epoch {current}; input was retracted" ) # commit proceeds only if all consumed tokens are current def run_branch_a(coord: Coordinator, b_token: Tuple[str, int]) -> None: pub_id, epoch = b_token # A derives against B@epoch, then attempts to commit coord.commit_branch("A", consumed={pub_id: epoch}) ```