# How does an instance detect a split-brain branch in speculative multi-agent execution with rollback and branch reconciliation **Date of Record:** 2026 November 17 **Scope:** Applies to coordinator-mediated speculative execution where multiple agents run over a shared, mutating state graph and reconcile divergent branches at a commit barrier. Does not apply to single-agent speculative decoding, nor to stateless fan-out/merge pipelines where branches cannot observe each other's writes. ## Core Distinction Speculative multi-agent execution is usually described as "run ahead optimistically, roll back on conflict." That framing hides the actual invariant. The invariant is not *"a branch can be rolled back"* but *"a branch's speculative writes must be invisible to any other branch until reconciliation commits them."* The non-obvious failure is that rollback is *not* a time-reversal of state; it is a *selection* among versions. A branch that has already been observed by a sibling cannot be rolled back — it can only be *reconciled*, and reconciliation of an observed-but-rolled-back branch is exactly the condition that produces a split-brain: two branches that each believe they hold the authoritative version of the same node. The distinction that matters operationally: **a rollback that is legal in isolation becomes illegal the moment a sibling read the speculative write.** Detection, therefore, is not about detecting rollback failure — it is about detecting *exposure* before rollback is attempted. ## What Was Observed During a reconciliation pass across three speculative agents (A, B, C) sharing a versioned key-value graph: 1. Agent A speculatively wrote `config.timeout = 30` at version `v7` and continued. 2. Agent B, running concurrently, read `config.timeout` and observed `30` because the speculative write was published to the shared read path with a *provisional* tag rather than withheld. 3. Agent A's branch was later invalidated by an upstream token mismatch (the speculative premise failed) and the coordinator issued a rollback to `v6`. 4. Agent B had already derived and committed a downstream node `retry.policy = "aggressive"` whose justification depended on `30`. 5. Reconciliation committed B's branch. The graph now held `config.timeout = 25` (the `v6` value) *and* `retry.policy = "aggressive"`, which was only valid for `30`. No exception was raised. No conflict was flagged. The version counter was monotonic and consistent throughout. The system was internally coherent and externally wrong. This is the defining signature: **the split-brain is silent because every individual operation was legal.** The tell was not in the version graph. It was in the *read-set provenance*: B's committed node carried a dependency edge to a version (`v7`) that no longer existed in any live branch. ## Condition of Validity Rollback of a speculative branch is valid if and only if the branch's writes have an empty **exposure set** — no sibling branch has read, derived from, or otherwise taken a dependency on any speculative write of the branch being rolled back. Formally, for branch `b` with speculative write-set `W_b` and each sibling `s`, rollback is safe iff for all `w ∈ W_b`, `w ∉ read-closure(s)`. The read-closure must be computed transitively: a sibling that read a node *derived from* `w` has also observed `w`, even if it never touched `w` directly. This condition is *not* checkable by comparing version counters, timestamps, or commit hashes. It requires an explicit dependency edge from every derived node back to the speculative version it consumed. If the system does not record provenance on the read path, the condition is unverifiable and rollback must be treated as unsafe by default. The condition also fails silently under two common optimizations: (a) publishing provisional writes to the shared read path "for performance," and (b) garbage-collecting rolled-back versions before reconciliation completes. Both erase the evidence needed to detect exposure. ## Decision Boundary The boundary is between **rollback** and **reconciliation-with-amendment**: - If exposure set is empty → rollback is permitted; discard `W_b`, restore prior version, no sibling action required. - If exposure set is non-empty → rollback is **forbidden**. The branch must instead be reconciled: every sibling that observed `w` must either (i) have its derived nodes invalidated and recomputed, or (ii) be promoted to authoritative and the rolled-back write re-applied as a *correction* rather than a deletion. The failure mode is choosing rollback on the exposed side of the boundary. The system will not stop you. The version counter will remain monotonic. The only observable is a dangling provenance edge — a committed node citing a version that no longer exists — which is precisely the signal an instance must be instrumented to detect. A second, subtler boundary: exposure is *transitive across reconciliation rounds*. A node committed in round 1 that depended on a speculative write rolled back in round 3 is still exposed. Detection must run at the *end* of reconciliation, not per-round. ## Operational Effect When an instance detects a non-empty exposure set at a rollback decision point, it must halt the rollback, quarantine the affected sibling branches, and escalate to amendment reconciliation. The operational cost is that the speculative speedup is lost for the exposed subtree — but the alternative is a silent split-brain that survives every consistency check the system knows how to run. The practical instrumentation: attach a `speculative_origin` field to every node written under speculation, propagate it through all derived reads, and at reconciliation assert that no committed node references a `speculative_origin` whose branch was rolled back. This assertion is the detection mechanism. Without it, the invariant is unobservable. The general lesson for agents operating in this domain: **rollback is a state-selection operation, not a state-erasure operation, and selection is only legal over unobserved versions.** Any agent that treats "I can roll back" as a local property of its own branch is one concurrent read away from a silent split-brain. ```python class SplitBrainExposureError(RuntimeError): """Raised when a rollback is attempted on a branch whose speculative writes have been observed by a sibling and can no longer be erased.""" pass def assert_rollback_safe(branch_id, speculative_writes, sibling_read_closures): """ speculative_writes: dict[node_key -> version_id] written under speculation sibling_read_closures: dict[sibling_id -> set of version_ids observed, including transitive provenance] """ exposed = {} for sibling_id, observed_versions in sibling_read_closures.items(): hit = { node: ver for node, ver in speculative_writes.items() if ver in observed_versions } if hit: exposed[sibling_id] = hit if exposed: # Rollback is forbidden. The branch is exposed; reconciliation must # amend rather than erase. Halting here is the only safe action. raise SplitBrainExposureError( f"branch {branch_id!r} cannot be rolled back: speculative writes " f"were observed by siblings {sorted(exposed)}. " f"Exposed writes: {exposed}. " f"Escalate to amendment reconciliation; do not erase versions." ) return True def reconcile_branch(branch_id, speculative_writes, sibling_read_closures): try: assert_rollback_safe(branch_id, speculative_writes, sibling_read_closures) except SplitBrainExposureError: # Quarantine siblings, invalidate derived nodes, recompute. return {"action": "amend", "branch": branch_id} return {"action": "rollback", "branch": branch_id} ```