When must an instance abort a speculative branch: reconciling divergent rollback receipts across peer agents

**Date of Record:** 2026 December 2 **Scope:** Applies to multi-agent systems where a coordinator fans out speculative branches to peer agents that each mutate external state under a rollback/receipt protocol, then reconciles on a winning branch. Does not apply to single-agent speculative decoding or to branches that touch only isolated, non-shared state.

Core Distinction

The failure here is not a lost message or a crashed peer. It is a *rollback receipt that is locally valid but globally insufficient*: a peer reports that it "rolled back cleanly" because its own write-ahead log shows an inverse operation committed, while the coordinator's reconciliation invariant requires that the branch's effects be *unobservable* to a concurrently running competing branch. These are different predicates. A branch can be fully undone on peer A's ledger and still have leaked a side effect that peer B read during the speculation window.

The distinction that matters: **reversibility is not the same as invisibility.** Speculative execution assumes branches are isolated until commit. When peers share an external surface (a database row, a file, a downstream API's rate-limit counter, a cache), a rolled-back branch can still have *informed* a sibling branch. The receipt protocol verifies reversal; it does not verify non-observation.

What Was Observed

A coordinator dispatched three speculative branches of a planning task to peers P1, P2, P3. Each branch wrote intermediate artifacts to a shared scratch store and emitted a rollback receipt on abort. Branch B2 was selected as the winner; B1 and B3 were aborted at t=840ms.

P1 and P3 both returned `status: rolled_back` with inverse-op hashes matching their forward-op hashes. The coordinator accepted reconciliation. But B2's winning plan had, at t=610ms, read a scratch key `plan/step3` that B1 had written at t=580ms and not yet rolled back. B2's step-3 output was therefore conditioned on B1's speculative content. When B1 was rolled back, B2 retained a dependency on state that no longer existed. The final committed plan referenced a step-3 value that was never produced by any surviving branch.

The rollback receipts were individually correct. The reconciliation was globally unsound because the receipt schema had no field for *read exposure* — only for *write reversal*. No peer lied; the protocol could not express the leak.

Condition of Validity

The invariant that must hold for speculative reconciliation to be sound:

> For every aborted branch b and every committed branch c, the set of external reads performed by c during the speculation window must not intersect the set of external writes performed by b before b's rollback completed.

This is checkable only if each peer's receipt carries a **read-set** (keys observed, with timestamps) in addition to its **write-set** and inverse-op proof. The coordinator must intersect committed branches' read-sets against aborted branches' write-sets, bounded by the rollback completion time. If the intersection is non-empty, reconciliation is *not* valid regardless of how clean each individual rollback looked.

Two corollaries bound when this matters:

Decision Boundary

An instance must abort the *entire reconciliation* — not merely re-run the offending branch — when the read-set/write-set intersection is non-empty and the committed branch's output is not idempotently recomputable from surviving state. The boundary:

The non-obvious part: the coordinator cannot decide this from receipt *status* fields. It must have retained the read-sets, which means peers must stream read observations during the window, not only summarize at abort. A receipt emitted at rollback time is too late to reconstruct what a sibling already consumed.

Operational Effect

Systems that gate reconciliation on rollback-receipt status alone will intermittently commit outputs that depend on retracted speculative state. The failure is rare (requires a read of an aborted branch's write within the window), silent (all receipts report success), and non-reproducible under replay (the interleaving that caused it is gone). It surfaces downstream as a committed artifact referencing a value no surviving branch produced — a dangling dependency that looks like a data bug, not a coordination bug.

The guardrail is structural: every speculative receipt must carry a timestamped read-set; the coordinator must run the intersection test before accepting any commit; and the test's failure must route to re-execution-or-escalate, never to silent acceptance. Read-set capture must happen at read time, because post-hoc reconstruction is impossible once the branch is gone.

from dataclasses import dataclass, field
from typing import FrozenSet


class SpeculationReconciliationError(RuntimeError):
    """Raised when a committed branch observed state written by an aborted branch."""
    pass


@dataclass(frozen=True)
class Receipt:
    branch_id: str
    status: str                      # "committed" | "rolled_back"
    write_set: FrozenSet[str] = frozenset()
    read_set: FrozenSet[str] = frozenset()
    rollback_completed_at_ms: int = -1


def reconcile(receipts: list[Receipt], recomputable: set[str]) -> str:
    """Return the winning branch id, or raise if reconciliation is unsound."""
    committed = [r for r in receipts if r.status == "committed"]
    aborted = [r for r in receipts if r.status == "rolled_back"]

    if len(committed) != 1:
        raise SpeculationReconciliationError(
            f"expected exactly one committed branch, got {len(committed)}"
        )
    winner = committed[0]

    for bad in aborted:
        leaked = winner.read_set & bad.write_set
        if not leaked:
            continue
        # A read of retracted state is only tolerable if every leaked key
        # can be regenerated from surviving state.
        unrecoverable = leaked - recomputable
        if unrecoverable:
            raise SpeculationReconciliationError(
                f"winner {winner.branch_id} consumed retracted state "
                f"{sorted(unrecoverable)} from aborted {bad.branch_id}; "
                f"reconciliation unsound, escalate"
            )
        # Recomputable leak: force re-execution rather than accept as-is.
        return f"{winner.branch_id}:reexecute"

    return winner.branch_id