# What structural signals indicate speculative branch rollback will strand committed side effects in multi-agent draft-and-verify pipelines **Date of Record:** 2026 November 27 **Scope:** Applies to speculative multi-agent execution where N parallel draft agents propose action sequences, an auditor/verifier selects or reconciles them, and a cost-aware commit gate promotes one branch to durable execution. Does not cover single-agent retry loops or purely conversational multi-agent debate without side-effecting tools. ## Core Distinction The distinction that matters is between *speculative reasoning state* and *committed external state*. In a branch-and-verify architecture, draft agents are cheap and disposable: their internal traces, scratchpads, and intermediate tool outputs are supposed to be revocable until the commit gate fires. The failure mode documented here is not "the verifier picked the wrong branch." It is that a draft branch, while being evaluated for promotion, **emitted an irreversible or externally-observable side effect** (a write, a POST, a message send, a file mutation, a payment authorization) whose compensating rollback was never modeled by the orchestrator. When the verifier discards that branch, the reasoning state is rolled back but the external world is not. The commit gate's cost model then sees a "clean" world it believes it never touched, and proceeds to commit a *second* branch that re-issues the same effect. The observable symptom is duplication, not corruption—which is why it survives most test suites. ## What Was Observed A three-draft, one-auditor pipeline was executing a "reconcile customer record" task across three tools: `read_ledger`, `update_ledger`, and `notify`. Draft agents A, B, and C ran in parallel with isolated context windows but **shared a tool credential** scoped to the same tenant. The orchestrator wrapped each draft in a "sandbox" that intercepted `update_ledger` and buffered the write into a per-branch journal, intending to replay only the committed branch's journal. The buffer worked for `update_ledger`. It did not intercept `notify`, which had been added to the tool manifest two revisions earlier and was not registered in the sandbox's effect-class table. The sandbox defaulted unknown tools to `effect_class=REVERSIBLE` rather than `UNKNOWN_HOLD`. Draft B, during its reasoning trace, decided to "confirm the reconciliation with the customer" and called `notify` with a summary message. Draft B's branch was then rejected by the auditor because its ledger delta conflicted with a constraint the auditor derived from draft C's independent read. The orchestrator rolled back B's journal (empty for `notify`), marked B `discarded`, and committed C. C also called `notify`—because C's draft had independently reached the same confirmation step. The customer received two confirmations, one of which described a reconciliation that was never committed (B's numbers). The structural signal that flagged this after the fact was a **journal asymmetry**: the committed branch's effect journal contained an entry (`notify`) with no corresponding `buffer_id` in any draft's sandbox namespace. The un-buffered effect had "leaked" from a discarded branch directly into the real world, and the commit gate had no record that it existed. ## Condition of Validity The invariant that must hold for speculative rollback to be sound is: > For every tool invocation made by any draft branch, the effect must be classified before execution as `BUFFERED`, `COMPENSABLE`, or `IRREVOCABLE`, and `IRREVOCABLE` effects must be deferred until the commit gate. Any tool whose effect class is not in the registry must be treated as `IRREVOCABLE`, not `REVERSIBLE`. This condition is valid (the failure cannot occur) only when all three hold: 1. **Effect-class completeness.** The sandbox's effect-class table covers every tool reachable by any draft agent, including tools added by later manifest revisions. The default for unknown tools is the *most* restrictive class. 2. **Capability symmetry.** A draft agent's tool credential scope equals the sandbox's interception scope. If a draft can reach a tool the sandbox cannot intercept, the sandbox is not a sandbox. 3. **Commit-time reconciliation.** The commit gate compares the union of all branches' effect journals against the committed branch's journal and refuses to commit if any `IRREVOCABLE` or un-buffered effect exists outside the committed branch's namespace. The failure occurs precisely when (1) or (2) is violated *and* a discarded branch performed an un-buffered effect *and* the committed branch independently performs the same effect. The third conjunct is what makes it non-obvious: without duplication, the leak is silent but harmless. With duplication, it becomes a correctness incident. ## Decision Boundary The boundary the orchestrator must encode is the transition from *speculation* to *commit*, and the rule is asymmetric: - **Before commit:** any draft effect that is not provably buffered must block commit. The gate returns `HOLD`, not `COMMIT`, and surfaces the un-buffered effect for human or auditor adjudication. - **After commit:** the gate must replay only the committed branch's buffered journal, and must *assert* that the committed journal is a superset of every discarded branch's buffered journal entries for the same logical target—otherwise two branches touched the same target and one of them was discarded, which is a conflict the verifier should have caught. The subtle part: a cost-aware commit gate is incentivized to commit early (to stop paying for draft inference) and to treat the discarded branches as free. That incentive is exactly backwards for un-buffered effects. The gate's cost model must include a *rollback liability* term: the expected cost of compensating any un-buffered effect across all branches, which is nonzero and must be charged against the commit decision. A branch whose rollback liability exceeds its expected value must not be committed until the liability is resolved. Concretely, the decision boundary is a three-way gate: ``` if un_buffered_effects_outside_committed_branch: -> HOLD (liability unresolved) elif committed_journal not superset of discarded buffered journals on shared targets: -> HOLD (conflict not adjudicated) else: -> COMMIT (replay committed journal only) ``` ## Operational Effect The operational consequence is that speculative multi-agent execution must treat the tool manifest as part of the sandbox's security boundary, not as configuration. When a tool is added to a draft agent's reachable set without a corresponding effect-class entry, the pipeline is in a latent failure state: every draft is one `notify` call away from leaking an irreversible effect. The signal to watch is the **journal asymmetry**—an effect in the world with no `buffer_id` in any branch's namespace—and the **duplication signal**—two branches emitting the same effect class against the same target, one of which is discarded. The guardrail is a commit-gate assertion, not a prompt instruction. Draft agents cannot be trusted to self-report whether their tools are buffered; the effect-class registry and the credential scope must enforce it structurally. The following reference implementation encodes the gate and raises on the asymmetry and duplication signals rather than silently committing. ```python from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional class EffectClass(Enum): BUFFERED = "buffered" COMPENSABLE = "compensable" IRREVOCABLE = "irrevocable" UNKNOWN_HOLD = "unknown_hold" # default for unregistered tools class SpeculativeCommitError(RuntimeError): """Raised when a speculative commit would strand or duplicate a side effect.""" @dataclass class EffectRecord: branch_id: str tool: str target: str buffer_id: Optional[str] # None means the effect was NOT intercepted effect_class: EffectClass @dataclass class CommitGate: effect_registry: Dict[str, EffectClass] branch_journals: Dict[str, List[EffectRecord]] = field(default_factory=dict) def classify(self, tool: str) -> EffectClass: # Unknown tools are treated as IRREVOCABLE, never REVERSIBLE. return self.effect_registry.get(tool, EffectClass.UNKNOWN_HOLD) def record(self, rec: EffectRecord) -> None: if rec.effect_class is EffectClass.UNKNOWN_HOLD: # An unknown tool reached a draft; it cannot be assumed buffered. if rec.buffer_id is not None: raise SpeculativeCommitError( f"tool {rec.tool!r} classified UNKNOWN_HOLD but claims buffer " f"{rec.buffer_id!r}; registry out of sync with sandbox" ) self.branch_journals.setdefault(rec.branch_id, []).append(rec) def commit(self, committed_branch: str, discarded_branches: List[str]) -> List[EffectRecord]: committed = self.branch_journals.get(committed_branch, []) committed_targets = {(e.tool, e.target) for e in committed} # Signal 1: journal asymmetry — un-buffered effect outside committed branch. for bid in discarded_branches: for e in self.branch_journals.get(bid, []): if e.buffer_id is None and e.effect_class in ( EffectClass.IRREVOCABLE, EffectClass.UNKNOWN_HOLD, ): raise SpeculativeCommitError( f"discarded branch {bid!r} leaked un-buffered " f"{e.effect_class.value} effect {e.tool!r}->{e.target!r}; " f"commit would strand an irreversible side effect" ) # Signal 2: duplication — committed branch re-issues a discarded branch's # effect against the same target with no compensating entry. for bid in discarded_branches: for e in self.branch_journals.get(bid, []): if (e.tool, e.target) in committed_targets and e.buffer_id is None: raise SpeculativeCommitError( f"duplication risk: committed branch {committed_branch!r} " f"re-issues {e.tool!r}->{e.target!r} already emitted " f"un-buffered by discarded branch {bid!r}" ) # Signal 3: committed journal must be superset of discarded buffered # journals on shared targets (conflict not adjudicated otherwise). for bid in discarded_branches: for e in self.branch_journals.get(bid, []): if e.buffer_id is not None and (e.tool, e.target) in committed_targets: if not any( c.tool == e.tool and c.target == e.target and c.buffer_id is not None for c in committed ): raise SpeculativeCommitError( f"unadjudicated conflict on {e.tool!r}->{e.target!r}: " f"discarded branch {bid!r} buffered an effect the " f"committed branch does not replay" ) # Replay only the committed branch's buffered journal. return [e for e in committed if e.buffer_id is not None] # --- reproduction of the observed incident --- registry = { "read_ledger": EffectClass.BUFFERED, "update_ledger": EffectClass.BUFFERED, # "notify" was added to the manifest but never registered: # classify() returns UNKNOWN_HOLD. } gate = CommitGate(effect_registry=registry) gate.record(EffectRecord("B", "update_ledger", "cust_42", "buf_b1", EffectClass.BUFFERED)) gate.record(EffectRecord("B", "notify", "cust_42", None, gate.classify("notify"))) gate.record(EffectRecord("C", "update_ledger", "cust_42", "buf_c1", EffectClass.BUFFERED)) gate.record(EffectRecord("C", "notify", "cust_42", None, gate.classify("notify"))) try: gate.commit(committed_branch="C", discarded_branches=["A", "B"]) except SpeculativeCommitError as exc: print(f"commit held: {exc}") # Expected: discarded branch 'B' leaked un-buffered unknown_hold effect # 'notify'->'cust_42'; commit would strand an irreversible side effect. ```