# When must an instance invalidate a speculative branch that has already been committed to by a downstream peer: the sibling-commit orphan problem in branch-and-verify rollback **Date of Record:** 2026 November 29 **Scope:** Applies to orchestrators that fork parallel agent trajectories speculatively, allow those trajectories to emit side-effecting commits (tool writes, MCP resource mutations, A2A handoffs to peers), and later roll back a losing branch. Does not apply to read-only speculation, single-trajectory retries, or systems where commits are buffered in a single transactional coordinator. ## Core Distinction The failure is not "a speculative branch was wrong." Speculation assumes branches can be wrong. The failure is that **a losing branch's commit was already observed and acted upon by a sibling branch or an external peer before rollback fired**, so rollback cannot restore the global state the system believes it holds. This is distinct from ordinary rollback (undo a write) and from compensation (issue an inverse write), because the inverse write is itself a new event that downstream agents may or may not have consumed. The invariant at stake: *a rollback is only sound if no non-rolled-back actor has read the committed effect and derived state from it.* We call the violation a **sibling-commit orphan**: a derived state that survives because its causal parent was rolled back but the derivation was not. ## What Was Observed An orchestrator spawned three speculative trajectories (A, B, C) for a planning task, each with tool access to a shared scratch resource store and an A2A channel to a verifier peer. All three ran concurrently to reduce latency. Branch A committed a partial plan artifact to `plan://draft` at t=1.20s. Branch B, which had subscribed to `plan://draft` for cross-checking, read A's artifact at t=1.31s and incorporated a constraint from it into B's own artifact at t=1.45s. The verifier scored A lowest at t=2.02s. The orchestrator rolled back A: it deleted `plan://draft` and reverted A's tool ledger. At t=2.03s the verifier accepted B. But B's artifact contained a constraint that originated in A's now-deleted draft. When B was later replayed for audit, the constraint could not be reproduced from any surviving source — the audit produced a **replay discrepancy** and the accepted result was quarantined. The mechanism: rollback was scoped to the *branch's own writes*, not to the *transitive read-set closure* of those writes. The orchestrator had no record that B read A's commit, because the read happened over an A2A channel that was not instrumented as a dependency edge. The rollback was locally correct and globally unsound. A second instance showed the same class at lower latency: two branches, one commit, a peer verifier that cached the commit at t=1.31s and served it to a *third* agent outside the speculative cohort. Rollback of the branch never reached the cache. The orphan was discovered 40 minutes later during a consistency sweep, not by any runtime guard. ## Condition of Validity Speculative rollback is sound only when, for every losing branch L and every effect e committed by L, the set of actors that have read e since commit is a subset of the rolled-back cohort. Formally, rollback is valid iff `readers(e) ⊆ rollback_set` for all `e ∈ writes(L)`. This condition holds when: - Commits are buffered and only released after the branch is promoted (no live speculation), or - All reads of speculative commits are instrumented as dependency edges, and the orchestrator computes the transitive read-closure before rollback, or - Speculative commits are namespaced per-branch and peers are forbidden from reading a namespace whose owning branch has not been promoted. The condition fails — and the orphan is created — whenever a read path exists that the orchestrator does not observe: uninstrumented A2A channels, peer caches, external agents reading a shared resource URI, or a sibling branch that read the commit before the orchestrator's dependency tracker registered the edge. Note the race: the read at t=1.31s and the dependency-edge registration are not atomic. Even a fully instrumented system has a window between the read and the edge write during which rollback can fire. ## Decision Boundary The decision is not "roll back or not." It is: **at the moment of rollback, does the orchestrator escalate from local rollback to cohort-wide invalidation?** The boundary conditions: - If the read-closure of the losing branch's commits is empty outside the cohort → local rollback is sound; proceed. - If the read-closure is non-empty but entirely within the cohort and no branch has been promoted → invalidate the readers too (cascade rollback of B), then re-run B without A's constraint. - If any reader is outside the cohort, or any reader has already been promoted, or the read-edge is unobservable → **do not roll back.** The commit is effectively durable. Escalate to a reconciliation pass: keep the artifact, mark it as orphan-bearing, and require the verifier to re-score with the orphan flagged. Rolling back here is worse than keeping, because it manufactures a replay discrepancy that audit cannot resolve. The trap is the middle case: cascade rollback of B looks clean but doubles the blast radius, and if B had itself been read by C, the cascade must continue. The orchestrator must compute the closure to a fixed point, not one hop. ## Operational Effect Systems that skip the closure computation exhibit three observable pathologies: (1) **irreproducible accepted results** — the winning branch carries constraints from rolled-back siblings, so replay diverges from the recorded outcome; (2) **cascade storms** — a naive one-hop cascade rolls back B, which invalidates C's read of B, which the orchestrator did not anticipate, producing a rollback that removes more state than the verifier's rejection justified; (3) **silent orphan persistence** — external peer caches serve rolled-back commits indefinitely, and the only detector is a periodic consistency sweep that most systems do not run. The guardrail is a **commit dependency ledger** written synchronously with every speculative commit and every read of a speculative namespace, plus a pre-rollback closure query that returns `SAFE`, `CASCADE`, or `UNSOUND`. The ledger must be written before the read returns, not after, or the t=1.31s race reopens. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum class SpeculativeRollbackError(RuntimeError): """Raised when a speculative branch cannot be soundly rolled back.""" class RollbackVerdict(Enum): SAFE = "safe" # closure empty outside cohort CASCADE = "cascade" # closure inside cohort, unpromoted UNSOUND = "unsound" # external reader, promoted reader, or unobservable edge @dataclass class CommitLedger: # commit_id -> set of actor_ids that have read it readers: dict[str, set[str]] = field(default_factory=dict) # actor_id -> set of commit_ids it has committed writes: dict[str, set[str]] = field(default_factory=dict) promoted: set[str] = field(default_factory=set) unobservable_edges: set[str] = field(default_factory=set) def record_commit(self, actor: str, commit_id: str) -> None: self.writes.setdefault(actor, set()).add(commit_id) self.readers.setdefault(commit_id, set()) def record_read(self, actor: str, commit_id: str) -> None: # MUST be called before the read returns to the actor. self.readers.setdefault(commit_id, set()).add(actor) def mark_unobservable(self, commit_id: str) -> None: self.unobservable_edges.add(commit_id) def read_closure(self, losing: str, cohort: set[str]) -> set[str]: """Transitive closure of actors that read losing's commits, to a fixed point.""" frontier = list(self.writes.get(losing, set())) reached: set[str] = set() seen_commits: set[str] = set(frontier) while frontier: cid = frontier.pop() for reader in self.readers.get(cid, set()): if reader in reached: continue reached.add(reader) for downstream in self.writes.get(reader, set()): if downstream not in seen_commits: seen_commits.add(downstream) frontier.append(downstream) return reached def decide_rollback(ledger: CommitLedger, losing: str, cohort: set[str]) -> RollbackVerdict: losing_commits = ledger.writes.get(losing, set()) if not losing_commits: return RollbackVerdict.SAFE for cid in losing_commits: if cid in ledger.unobservable_edges: return RollbackVerdict.UNSOUND closure = ledger.read_closure(losing, cohort) if not closure: return RollbackVerdict.SAFE for actor in closure: if actor not in cohort: return RollbackVerdict.UNSOUND if actor in ledger.promoted: return RollbackVerdict.UNSOUND return RollbackVerdict.CASCADE def rollback_branch(ledger: CommitLedger, losing: str, cohort: set[str]) -> RollbackVerdict: verdict = decide_rollback(ledger, losing, cohort) if verdict is RollbackVerdict.UNSOUND: raise SpeculativeRollbackError( f"branch {losing!r} has an unrollbackable read-closure: " f"external/promoted/unobservable readers exist; escalate to reconciliation, " f"do not delete commits" ) if verdict is RollbackVerdict.CASCADE: # Roll back readers first, deepest-first, then the loser. closure = ledger.read_closure(losing, cohort) for actor in sorted(closure, reverse=True): for cid in ledger.writes.get(actor, set()): ledger.readers.pop(cid, None) ledger.writes.pop(actor, None) for cid in ledger.writes.pop(losing, set()): ledger.readers.pop(cid, None) return verdict if __name__ == "__main__": ledger = CommitLedger() cohort = {"A", "B", "C"} ledger.record_commit("A", "plan://draft#a1") ledger.record_read("B", "plan://draft#a1") # B reads A before rollback ledger.record_commit("B", "plan://draft#b1") try: rollback_branch(ledger, "A", cohort) except SpeculativeRollbackError as exc: print(f"escalated: {exc}") # External reader case -> must raise, not silently roll back. ledger2 = CommitLedger() ledger2.record_commit("A", "plan://draft#a2") ledger2.record_read("external-verifier-7", "plan://draft#a2") try: rollback_branch(ledger2, "A", cohort) except SpeculativeRollbackError as exc: print(f"escalated: {exc}") ```