Why does an instance lose its rollback anchor when speculative branches share a mutable tool-effect log

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent systems that run speculative parallel branches (draft/verify, optimistic fan-out) where each branch may invoke side-effecting tools and later reconcile or roll back to a common checkpoint. Does not apply to read-only fan-out or to single-agent linear execution with no branch merge.

Core Distinction

The failure is not "a branch produced wrong output." It is that a branch's *rollback anchor*—the logical snapshot it must restore to—was silently advanced by a *sibling* branch that committed a tool effect into a shared mutable log. When the losing branch later rolls back, it restores to a state that already contains the winner's committed effect, and then re-applies its own effect on top. The result is a double-application of the winner's side effect and an orphaned partial effect from the loser.

The distinction that matters: rollback is usually modeled as *inverse of my own writes*. In speculative multi-agent execution, the correct model is *restore to a checkpoint that no sibling is allowed to mutate*. Conflating "my branch's write set" with "the checkpoint's content" is the defect. A branch does not own its anchor; the anchor is a shared invariant that every concurrent branch must treat as immutable.

What Was Observed

A three-way speculative fan-out: a planner agent spawns branches A (draft), B (draft), and C (auditor). All three receive a checkpoint token `ck_7` referencing a tool-effect log at sequence number 4100. Branch A and B each call a `write_record` tool; C calls a `read` tool and then a `verify` tool. The orchestrator intends to select the better of A/B and roll back the loser.

Trace:

  1. All branches start at `ck_7`, log head = 4100.
  2. Branch A appends effect `e_A` at seq 4101, then commits its result and is *selected* by the orchestrator.
  3. Branch B appends effect `e_B` at seq 4102 while still speculating (its tool call was already in flight when A committed).
  4. Orchestrator decides B loses, issues rollback of B to `ck_7`.
  5. The rollback implementation computes B's write set = `{e_B}` and emits a compensating effect `¬e_B` at seq 4103. It does **not** truncate the log to 4100, because the log head is now shared and A's `e_A` sits between B's anchor and B's effect.
  6. A downstream replay reads the log from 4100: it sees `e_A`, `e_B`, `¬e_B`. The compensating `¬e_B` was authored against a world where `e_B` was applied to a *different* base state than the one replay reconstructs, because A's `e_A` landed first. The inverse is now misordered relative to its forward effect.
  7. Result: the record written by `e_A` is clobbered by the misordered inverse of `e_B`, which was never meant to touch A's row but did, because both wrote the same key.

The auditor C, whose `verify` ran against head 4101 (after A, before B), returns a verdict that is stale by the time it is consumed at step 4. The orchestrator treats C's "consistent" verdict as covering the post-rollback state, which it never observed.

Condition of Validity

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

> For every branch `b` with anchor `ck`, no effect authored by a branch other than `b` may be interleaved between `ck` and `b`'s own effects in the log that `b`'s rollback compensates against, **unless** the compensation is expressed as a conditional inverse guarded by a read of the log position it targets.

Two ways to satisfy it:

The failure above occurs because neither holds: shared log (no partition) plus unconditional inverse (no guard). The boundary is sharp—the moment a sibling's effect lands between your anchor and your effect, unconditional rollback is unsound.

Decision Boundary

The orchestrator must decide, per branch, whether its tool effects are *isolatable* or *entangled*:

The decision boundary is not "did the branch succeed." It is "can this branch's effect be inverted without observing a sibling's interleaved effect." If the answer is no, the branch is not speculatively rollback-able and must be serialized behind the winner or run with a private segment.

A second boundary: the auditor's verdict has a *validity interval* `[log_head_at_verify, log_head_at_verify]`. Consuming it after the head has moved is a use-after-invalidation. The orchestrator must pin the verdict to the log head it observed and reject it if the head advanced across a commit.

Operational Effect

Concretely, the system exhibits:

The guardrail is structural, not a retry: partition speculative writes, or guard every inverse with a read of the position it targets, and pin auditor verdicts to a log head with explicit invalidation on head advance. Retrying the rollback does not help—the inverse is wrong, not transient.

class RollbackAnchorViolation(RuntimeError):
    """Raised when a speculative branch's rollback anchor was advanced by a sibling commit."""


def rollback_branch(log, branch, anchor_seq):
    # Effects authored by *this* branch between the anchor and now.
    own = [e for e in log.entries_after(anchor_seq) if e.branch_id == branch.id]
    foreign = [e for e in log.entries_after(anchor_seq) if e.branch_id != branch.id]

    if foreign:
        # A sibling's effect interleaved between our anchor and our writes.
        # An unconditional inverse would be misordered relative to its forward
        # effect and could clobber the sibling's committed state.
        raise RollbackAnchorViolation(
            f"branch {branch.id} anchor {anchor_seq} contaminated by "
            f"{len(foreign)} sibling effect(s) at seq "
            f"{[e.seq for e in foreign]}; unconditional inverse unsound"
        )

    for e in reversed(own):
        if not e.is_invertible():
            raise RollbackAnchorViolation(
                f"effect {e.seq} on branch {branch.id} is entangled (non-invertible); "
                f"branch must be serialized, not speculatively rolled back"
            )
        log.append(e.inverse())
    return log.head()


def consume_auditor_verdict(verdict, current_head):
    if verdict.observed_head != current_head:
        raise RollbackAnchorViolation(
            f"auditor verdict pinned to head {verdict.observed_head} but log is at "
            f"{current_head}; verdict is use-after-invalidation"
        )
    return verdict