# In what scenarios must an instance treat a speculative tool call as non-idempotent and refuse rollback-only reconciliation across a multi-agent branch **Date of Record:** 2026 November 30 **Scope:** Applies to multi-agent orchestrators that fork a shared task state into speculative branches, execute tool calls optimistically on each branch, and reconcile by either committing one branch or rolling back the others. Does not apply to single-agent retry loops or to branches whose tool calls are provably side-effect-free within a declared sandbox. ## Core Distinction The load-bearing distinction is between **rollback of state** and **rollback of effect**. Speculative multi-agent execution assumes that if a branch loses reconciliation, its writes can be discarded by rewinding the shared state pointer to the pre-fork checkpoint. That assumption holds only for tool calls whose observable effects live entirely inside the state the orchestrator owns. The failure mode appears when a speculative branch invokes a tool whose effect escapes the orchestrator's state boundary—an email send, a payment authorization, a `git push`, a cache mutation, a downstream API that enqueues work—and then loses the reconciliation vote. The state rolls back; the effect does not. The orchestrator now holds a committed world that disagrees with its own checkpoint, and the disagreement is silent because every branch's local log says "rolled back cleanly." This is not the same as a tool returning an error. A tool error is visible and the branch can compensate. The boundary condition here is a tool that *succeeded* on a branch that was subsequently *abandoned*. Success plus abandonment is the specific combination that produces orphaned effects. ## What Was Observed A three-way speculative fan-out on a document-processing task: branch A summarized, branch B performed entity extraction, branch C performed entity extraction with a different prompt and a stricter schema. All three shared a forked state at checkpoint `cp_0`. Branch B and C both called `enrich_record(record_id, entities)` against an external enrichment service that appends to a downstream queue. The orchestrator's reconciliation policy was majority-vote on extracted entities; when B and C disagreed past a similarity threshold, the arbiter selected C and issued rollback to A and B. State rewound to `cp_0` plus C's delta. The observable defect surfaced forty minutes later: the downstream queue contained two enrichment jobs for the same `record_id`, one derived from B's entity set and one from C's. The queue is not part of the orchestrator's state, so B's rollback did nothing to it. Worse, the two jobs were not identical and the downstream consumer applied both, producing a record whose entity list was the union of two mutually-exclusive interpretations. The reconciliation logic had correctly identified that B and C were incompatible—it just had no mechanism to retract B's already-emitted effect. The trace showed the branch's local invariant held perfectly: `branch_B.committed_effects == []` after rollback, because the branch tracked *its own* state writes, not the tool's external writes. The orchestrator's global invariant—"at most one branch's effects are live"—was violated without any component reporting an error. ## Condition of Validity Rollback-only reconciliation is valid if and only if, for every tool call executed on any speculative branch, one of the following holds before the branch is abandoned: 1. The call is **provably idempotent** under a stable key the orchestrator controls (the tool deduplicates on `(record_id, branch_token)` or equivalent), so re-execution from the committed branch subsumes the abandoned effect; or 2. The call is **deferred**—staged into a commit buffer and never dispatched to the external system until reconciliation selects the branch; or 3. The call carries a **compensating transaction** that the orchestrator can invoke on abandonment, and that compensation is itself idempotent and ordered correctly relative to concurrent commits. The invariant fails the moment a branch dispatches a non-idempotent, non-deferred, non-compensable call and then loses. Note that "the tool usually succeeds" is not a validity condition—the failure is triggered by success, not failure, so retry-oriented hardening does nothing here. ## Decision Boundary An instance must refuse rollback-only reconciliation and escalate to explicit compensation (or block the speculative dispatch entirely) when all of the following are true: - The branch is speculative (its outcome is not yet selected), **and** - The tool call has an effect outside orchestrator-owned state (detectable via a declared `side_effect_class` on the tool manifest, or conservatively assumed for any tool not marked `pure`), **and** - The tool is not idempotent under an orchestrator-supplied deduplication key, **and** - No registered compensator exists for the tool's effect class. If any one of those is false, rollback-only reconciliation is admissible. The dangerous default is treating an *undeclared* tool as pure; the boundary must be drawn conservatively—unknown side-effect class means "assume non-idempotent, assume external." The decision must be made at dispatch time, not at reconciliation time, because by reconciliation time the effect is already live and the only remaining options are compensation or a reconciliation that accepts the orphan. ## Operational Effect Enforcing this boundary changes the fan-out topology. Speculative branches can no longer freely execute effectful tools; they must either stage those calls behind a commit gate, supply a dedup key that makes re-execution safe, or register a compensator at branch creation. The orchestrator gains a new required step at reconciliation: for every abandoned branch, enumerate its dispatched effectful calls and either confirm idempotent subsumption by the committed branch or run compensation, then verify the external system's state matches the committed world before releasing the checkpoint. The cost is latency and a compensation surface; the benefit is that "rolled back" once again means the world matches the checkpoint, and the silent union-of-interpretations defect becomes a loud, bounded reconciliation step. ```python class SpeculativeRollbackViolation(RuntimeError): """Raised when a branch is abandoned after dispatching a non-retractable effect.""" pass SIDE_EFFECT_CLASSES = {"pure", "idempotent", "compensable", "external_nonidempotent"} def assert_rollback_safe(branch, tool_manifest): """ Call before abandoning a speculative branch. Refuses rollback-only reconciliation if any dispatched call escaped orchestrator state without a dedup key or a registered compensator. """ for call in branch.dispatched_calls: manifest = tool_manifest[call.tool_name] effect_class = manifest.get("side_effect_class", "external_nonidempotent") if effect_class == "pure": continue if effect_class == "idempotent" and call.dedup_key is not None: continue if effect_class == "compensable" and call.compensator is not None: continue raise SpeculativeRollbackViolation( f"branch {branch.id} cannot be rolled back: tool " f"{call.tool_name!r} (class={effect_class}) dispatched without " f"dedup_key or compensator; external effect is already live and " f"would orphan on reconciliation. Require commit-gate staging or " f"register a compensator before abandoning." ) return True ```