# What structural signals indicate an unverified speculative tool-call commit has already escaped the rollback horizon **Date of Record:** 2026 November 15 **Scope:** Applies to multi-agent systems that speculatively execute branches of a plan, pipeline tool calls optimistically ahead of verification, and roll back non-committed branches on divergence. Does not apply to systems that serialize every tool call behind a verification barrier, nor to purely conversational agents whose tool calls are idempotent reads. ## Core Distinction The distinction that matters is between **rollback of state you control** and **rollback of effects you have already surrendered to an external system**. Speculative execution is safe only while every optimistic side effect remains *revocable*: buffered, staged, or compensable. The moment an optimistic tool call crosses the point of no return — a write that has been acknowledged by a remote authority, a message placed on a queue another consumer can drain, a payment captured, an email sent — that call is no longer part of the speculative branch. It is a committed fact. Rollback logic that treats it as revertible is not wrong about intent; it is wrong about physics. The non-obvious part: the failure is not visible at the moment of divergence. It is visible earlier, as a *structural* asymmetry between the branch's logical state and the branch's external footprint. Structural signals — not runtime errors — are what tell you the rollback horizon has been breached. ## What Was Observed A planner agent spawned three speculative branches (A, B, C) to resolve an ambiguous user request. Each branch optimistically pipelined its tool calls: A issued a `create_ticket` to an external tracker, B issued a `send_notification`, C issued a `reserve_inventory`. Verification selected C. Rollback was invoked on A and B. The rollback succeeded in the orchestrator's ledger: A and B were marked `rolled_back`, their local state discarded, their tokens reclaimed. But the external tracker had already assigned A's ticket a durable ID, and B's notification had already been delivered to a downstream consumer that had begun processing it. The orchestrator had no record of either, because the rollback path only consulted its own branch table. The structural signal that preceded the failure: **the branch's set of issued tool-call IDs was not a subset of the set of tool-call IDs whose effects the branch could still revoke.** Every branch maintained a `pending_effects` list, but that list was populated at *dispatch* time, not at *acknowledgment* time. A call could be dispatched, acknowledged by the remote system, and still be sitting in `pending_effects` as if revocable. The invariant `issued ⊆ revocable` was never checked; it was assumed. A second signal: the rollback routine completed in constant time regardless of how many optimistic calls had been dispatched. A genuinely reversible rollback must touch every dispatched call; a rollback that finishes without enumerating them has silently skipped the ones that already escaped. ## Condition of Validity Optimistic pipelining with branch-and-verify rollback is valid **if and only if** the following holds at every verification point: 1. Every optimistic tool call is either (a) staged behind a commit gate that the verifier controls, or (b) explicitly registered as an *irrevocable* effect with a known compensation action. 2. The branch's revocable set is recomputed from the remote authority's acknowledgment state, not from local dispatch bookkeeping. 3. A branch may only be selected for commit if its irrevocable set is empty, or if every irrevocable effect has a compensation that the system is prepared to execute. 4. Rollback enumerates and acts on every dispatched call; it must fail loudly if any dispatched call is unaccounted for. Condition 1(b) is the one teams skip. They treat "we sent it" and "we can take it back" as the same predicate. They are not. ## Decision Boundary The decision boundary is not "did the tool call return?" It is "**has the remote authority committed a durable consequence that we cannot unilaterally reverse?**" Three structural tests separate the two: - **ID test:** Did the remote system assign a durable identifier to the effect? A returned `ticket_id`, `message_id`, or `reservation_id` is a commitment receipt. Treat it as irrevocable until proven otherwise. - **Consumer test:** Has the effect been placed somewhere another actor can observe or drain it? A queue, a webhook, a shared table read by a downstream service. Once observable, revocation is a coordination problem, not a local operation. - **Compensation test:** Does a defined inverse operation exist, and is it *idempotent and eventually consistent*? If not, the effect is irrevocable regardless of what the branch table says. When any test indicates irrevocability, the correct action is not "roll back the branch." It is "promote the branch to partially-committed and run compensation." Conflating these two is the failure mode. ## Operational Effect The operational consequence is a shift in where the system spends its safety budget. Instead of assuming rollback is free and spending budget on branch breadth, the system must spend budget on **effect classification at dispatch time** — tagging each tool call as `staged`, `revocable`, or `irrevocable` before it is pipelined — and on **compensation coverage** for the irrevocable class. Speculative breadth shrinks for irrevocable tools and stays wide for staged ones. That asymmetry is the correct design, not a regression. The second effect: verification must run *before* the first irrevocable call in a branch, not after the branch completes. The verification barrier moves earlier for irreversibles and stays late for staged calls. A branch that pipelines an irrevocable call ahead of its verification point has already lost the ability to be safely discarded, no matter how the rollback is coded. The defensive posture is to make the invariant executable. The code below encodes the check that was missing: a rollback that refuses to claim success when an issued call has escaped the revocable set. ```python from dataclasses import dataclass, field from enum import Enum from typing import Dict, Set class EffectClass(Enum): STAGED = "staged" # buffered, not yet visible to remote authority REVOCABLE = "revocable" # visible but unilaterally undoable IRREVOCABLE = "irrevocable" # durable, observable consequence exists class RollbackHorizonBreach(RuntimeError): """Raised when a branch is asked to roll back but has already surrendered an effect past the point of unilateral reversal.""" pass @dataclass class ToolCall: call_id: str effect_class: EffectClass acknowledged: bool = False remote_id: str | None = None compensation: str | None = None @dataclass class Branch: branch_id: str issued: Dict[str, ToolCall] = field(default_factory=dict) rolled_back: bool = False def dispatch(self, call: ToolCall) -> None: self.issued[call.call_id] = call def revocable_ids(self) -> Set[str]: # Recomputed from acknowledgment state, NOT from dispatch bookkeeping. return { c.call_id for c in self.issued.values() if c.effect_class in (EffectClass.STAGED, EffectClass.REVOCABLE) and not (c.acknowledged and c.remote_id is not None) } def escaped_ids(self) -> Set[str]: return set(self.issued) - self.revocable_ids() def rollback(branch: Branch) -> None: escaped = branch.escaped_ids() if escaped: # Do not silently mark rolled_back. Refuse and surface the breach. raise RollbackHorizonBreach( f"branch {branch.branch_id} cannot be rolled back: " f"effects {sorted(escaped)} have escaped the rollback horizon " f"(acknowledged with durable remote IDs). " f"Promote to partially-committed and run compensation." ) for call_id in branch.revocable_ids(): # ... issue revocation to remote authority ... pass branch.rolled_back = True def commit(branch: Branch) -> None: # A branch with escaped irreversibles may only commit if every # escaped effect has a defined compensation. for call_id in branch.escaped_ids(): call = branch.issued[call_id] if call.effect_class is EffectClass.IRREVOCABLE and call.compensation is None: raise RollbackHorizonBreach( f"branch {branch.branch_id} has irrevocable effect {call_id} " f"with no compensation; cannot safely commit or discard." ) # ... commit branch ... ```