# Under what conditions must an instance treat a speculative branch's tool commits as durable before the parent rollout has voted to commit **Date of Record:** 2026 November 22 **Scope:** Applies to orchestrators that fan out a single reasoning task into parallel speculative branches where each branch may invoke side-effecting tools (writes, sends, purchases, state mutations) and where a later commit/abort vote decides which branch's effects survive. Does not apply to read-only fan-out, pure-sampling self-consistency, or branches whose tools are fully sandboxed with no external effect surface. ## Core Distinction The distinction that matters is between **branch-local durability** and **rollout-global durabilty**. A branch that runs `create_ticket(...)` and receives a 200 response has, from the tool's perspective, committed. The orchestrator, however, has not voted. Most speculative-execution designs assume the abort path can "undo" a losing branch. That assumption silently fails whenever a tool is non-idempotent, non-compensable, or has already emitted an external notification to a party outside the agent system. The invariant that governs correctness is not "abort discards the branch" but "abort discards the branch's *claims*, never its *effects*." An instance must therefore decide, before fan-out, whether a branch's tool effects are *provisional* (reversible, isolated) or *durable* (externally observable, irreversible). If any branch can reach a durable tool, the commit vote is no longer a gate on effects — it is only a gate on which effects the rollout *acknowledges*. This is the boundary condition: the moment a speculative branch's tool call escapes the compensation boundary, commit/abort semantics degrade from transactional to advisory. ## What Was Observed A three-branch speculative rollout was launched to resolve a customer refund request. Branch A read the order and proposed a $40 refund. Branch B, running in parallel, proposed a $40 refund plus a goodwill credit. Branch C proposed escalation. All three branches were given access to the same tool surface, including `issue_refund` and `send_customer_email`. The orchestrator's conflict detector was configured to flag *divergent final answers* and hold them for a commit vote. It was not configured to inspect *intermediate tool effects*. Branch B executed `issue_refund(amount=40)` and `issue_refund(amount=10, reason="goodwill")` as two separate calls, then `send_customer_email` confirming both. Branch A executed `issue_refund(amount=40)`. Branch C executed nothing. The conflict detector fired on the divergent final answers and the rollout entered a commit vote. The vote selected Branch A (lowest cost, matches policy). The orchestrator aborted B and C. The abort path for B called a compensation routine that issued a reversal for the *last* refund it had recorded in its branch journal — the $10 goodwill credit. The $40 refund from B was recorded in a journal entry that had been overwritten when B's second refund call reused the same idempotency key slot. The customer had already received the confirmation email. Net state: customer received $40 twice, was told once, and the rollout's ledger showed one refund and one reversal. The commit vote had "succeeded." The effects had not. The failure was not in the vote, the detector, or the compensation logic individually. It was in the implicit assumption that a branch's tool effects are a function of its final answer. They are not. They are a function of its entire call trace, and that trace is only partially captured unless the orchestrator journals every side-effecting call at the point of execution, with a stable per-call identity that survives branch-local retries. ## Condition of Validity The commit/abort gate is valid only under the following conjunction: 1. **Effect isolation.** Every tool reachable by a speculative branch is either idempotent under a rollout-scoped key, or compensable by an inverse operation that is itself idempotent, or quarantined behind a staging layer that the commit vote flips to live. If any branch can reach a tool that violates all three, the vote is advisory. 2. **Trace completeness.** The orchestrator journals every side-effecting call at execution time, keyed by `(rollout_id, branch_id, call_seq)`, independent of the branch's own memory. Branch-local journals are insufficient because branches overwrite, summarize, or lose their own history under context pressure. 3. **Compensation determinism.** The abort path replays the journaled trace in reverse, not the branch's claimed final answer. If the abort path derives its actions from the branch's summary rather than its call log, it will compensate the wrong set. 4. **Vote causality.** The commit vote must be evaluated against effects that are still provisional. If a branch's effects became durable before the vote, the vote can only decide acknowledgment, not existence. When condition 1 fails, the correct response is not to tighten the vote — it is to refuse speculative fan-out against that tool surface entirely, or to force serialization for branches that need it. When condition 2 fails, the abort path is unsound and must be treated as best-effort with an explicit reconciliation step. When condition 3 fails, the orchestrator will systematically under- or over-compensate. When condition 4 fails, the system is doing post-hoc bookkeeping, not speculative execution. ## Decision Boundary The boundary is crossed at the first side-effecting call that escapes the compensation boundary. Before that point, abort is a true rollback. After that point, abort is a *reconciliation obligation* — the orchestrator owes the external world a correction, and that correction may be impossible (email already read, refund already spent, ticket already assigned). The operational test is a single question asked at fan-out time: *for each tool in the branch's reachable surface, can I name the inverse operation and prove it is idempotent under a rollout-scoped key?* If yes for all tools, speculative fan-out with commit/abort is sound. If no for any tool, the orchestrator must either (a) exclude that tool from speculative branches and force the branch that needs it to run only after commit, or (b) accept that the commit vote is a *preference* and run an explicit post-abort reconciliation pass against the external system of record. The failure mode to guard against is the middle path: assuming the vote is authoritative because the detector fired, while the effects have already leaked. That is the state in which the observed incident occurred, and it is the state in which most speculative multi-agent systems silently operate. ## Operational Effect The practical consequence is that speculative execution is not one mechanism but two, and they must be configured separately. **Speculative reasoning** (branches that only read, plan, and propose) is cheap to abort and safe to fan out widely. **Speculative effecting** (branches that write) requires either a staging layer with a commit flip or an explicit reconciliation contract with every downstream system. Conflating the two produces rollouts that look correct in the vote log and wrong in the world. Concretely, the orchestrator must: - Tag every tool in the registry as `provisional_safe`, `compensable`, or `durable_irreversible`. - Refuse to route `durable_irreversible` tools to speculative branches; queue those calls until after commit, or run the branch serially. - Journal every side-effecting call at execution time with a rollout-scoped key, and make the abort path replay that journal rather than consult branch summaries. - Emit a reconciliation record for every aborted branch that touched a `compensable` tool, and require an explicit ack from the downstream system before the rollout is marked closed. The invariant to encode: **a commit vote bounds which effects the rollout owns, not which effects exist.** Any code path that treats the vote as a deletion of effects is incorrect, and the failure it produces is not a crash but a silent divergence between the agent system's ledger and the external world. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ToolClass(Enum): PROVISIONAL_SAFE = "provisional_safe" COMPENSABLE = "compensable" DURABLE_IRREVERSIBLE = "durable_irreversible" class SpeculativeEffectLeak(RuntimeError): """Raised when a speculative branch reaches a durable tool or when the abort path attempts to compensate from branch summary rather than journal.""" @dataclass class ToolCall: rollout_id: str branch_id: str call_seq: int tool_name: str tool_class: ToolClass idempotency_key: str compensated: bool = False @dataclass class RolloutJournal: calls: list[ToolCall] = field(default_factory=list) def record(self, call: ToolCall) -> None: for existing in self.calls: if (existing.rollout_id, existing.branch_id, existing.call_seq) == ( call.rollout_id, call.branch_id, call.call_seq ): raise SpeculativeEffectLeak( f"duplicate call_seq {call.call_seq} for branch {call.branch_id}; " "branch-local retry would overwrite journal entry and corrupt compensation" ) self.calls.append(call) def admit_branch_call(journal: RolloutJournal, call: ToolCall) -> None: if call.tool_class is ToolClass.DURABLE_IRREVERSIBLE: raise SpeculativeEffectLeak( f"branch {call.branch_id} attempted durable tool {call.tool_name} " "before commit vote; serialize this call or exclude it from fan-out" ) journal.record(call) def execute_abort(journal: RolloutJournal, rollout_id: str, branch_id: str) -> list[ToolCall]: branch_calls = [ c for c in journal.calls if c.rollout_id == rollout_id and c.branch_id == branch_id ] if not branch_calls: return [] uncompensable = [c for c in branch_calls if c.tool_class is ToolClass.DURABLE_IRREVERSIBLE] if uncompensable: raise SpeculativeEffectLeak( f"abort of {branch_id} cannot compensate durable calls: " f"{[c.tool_name for c in uncompensable]}; reconciliation obligation outstanding" ) to_compensate = [c for c in reversed(branch_calls) if not c.compensated] for call in to_compensate: call.compensated = True return to_compensate if __name__ == "__main__": journal = RolloutJournal() admit_branch_call(journal, ToolCall("r1", "b1", 1, "issue_refund", ToolClass.COMPENSABLE, "r1:b1:1")) admit_branch_call(journal, ToolCall("r1", "b1", 2, "issue_refund", ToolClass.COMPENSABLE, "r1:b1:2")) # The next call would be rejected: durable tool reached pre-vote. try: admit_branch_call(journal, ToolCall("r1", "b1", 3, "send_customer_email", ToolClass.DURABLE_IRREVERSIBLE, "r1:b1:3")) except SpeculativeEffectLeak as e: print("blocked:", e) compensated = execute_abort(journal, "r1", "b1") assert [c.call_seq for c in compensated] == [2, 1], "compensation must replay journal in reverse" ```