# In what scenarios must an instance abandon speculative multi-agent execution and collapse to a single authoritative branch **Date of Record:** 2026 November 16 **Scope:** Applies to orchestrators that fork a task into N parallel agent branches speculatively, commit the first branch to pass a validator, and roll back losers via compensating actions. Does not apply to read-only fan-out, map-reduce over immutable inputs, or branches whose side effects are fully isolated in per-branch sandboxes with atomic swap-on-commit. ## Core Distinction There are two distinct notions of "divergence" in speculative multi-agent execution, and conflating them is the failure mode. **Observational divergence** is when branches produce different outputs from the same input — this is the *expected* condition that speculation exists to exploit; the fastest correct branch wins and the rest are pruned. **Causal divergence** is when a branch's side effects have already become an input to another branch, or to the external world, before the winner is selected. Observational divergence is cheap to roll back. Causal divergence is not, because rollback is no longer a local operation — it requires undoing effects that other actors have already observed and acted upon. The invariant that must hold for branch-and-prune to be sound is: *no branch's irreversible effect may be emitted before the winner is committed, unless that effect is idempotent and commutative with every other branch's effects.* When this invariant is violated, the orchestrator must not attempt rollback. It must collapse to a single authoritative branch and treat the speculative forks as advisory only. ## What Was Observed A three-branch speculative executor was tasked with provisioning a resource: branch A reserved an ID from a shared monotonic allocator, branch B wrote a partial record to a downstream queue, branch C (the eventual winner) passed the validator and committed. Rollback of A and B was issued as compensating actions. The compensating "release" for A returned the ID to a free-list, but the allocator had already handed that ID to a *fourth*, non-speculative consumer between A's reservation and A's release. The release therefore freed an ID that was live. The compensating "delete" for B enqueued a tombstone, but the downstream consumer had already processed B's partial record and emitted a derived event keyed on it; the tombstone arrived after the derived event and was rejected as out-of-order. Neither failure was visible in branch-local logs. Both surfaced only at the allocator and the downstream consumer — systems the orchestrator did not own and could not fence. The winner (C) was correct in isolation; the *system* was corrupted by the losers' rollback, not by their speculation. The critical observation: **the rollback was more dangerous than the speculation.** Aborting a branch that has emitted an irreversible effect can be strictly worse than never having forked it, because the compensation races against consumers the orchestrator cannot see. ## Condition of Validity Branch-and-prune rollback is valid only when all of the following hold simultaneously: 1. **Effect fencing.** Every branch's outbound effects are held in a buffer keyed to the branch, releasable only on commit. If any effect escapes the buffer before commit, the condition fails. 2. **Compensation idempotence and non-interference.** Each compensating action must be safe to apply even if the original effect was partially observed, and must not touch resources shared with non-speculative actors. Monotonic allocators, at-least-once queues, and shared counters routinely violate this. 3. **No cross-branch causal reads.** No branch may read state written by a sibling branch. If branches share a mutable store, divergence is causal, not merely observational. 4. **Validator determinism on the committed prefix.** The winner must be selected against a validator that does not itself depend on loser side effects. If any of 1–4 is false, the correct response is not "roll back more carefully." It is to stop forking past the point where the condition breaks — i.e., collapse to a single branch for the remainder of the task. ## Decision Boundary The decision is not "did branches diverge" but "has any branch crossed an irreversible-effect boundary before commit." The orchestrator must classify each branch's effect stream at fork time into *buffered* (safe to prune) and *emitted* (irreversible). The moment any branch emits an irreversible effect while siblings are still live, the speculative window is closed: the orchestrator must either (a) commit that branch immediately and prune the rest *without compensation*, accepting the emitted effects as authoritative, or (b) if the emitted effect is not the one it wants to keep, halt and escalate — never issue compensating rollback against an emitted effect whose consumers it does not control. Concretely: prune-with-compensation is permitted only over buffered effects. Prune-without-compensation (abandon, leave effects in place) is the safe default once emission has occurred. Rollback of an emitted effect requires an explicit, per-effect proof of non-interference; absent that proof, escalate. ## Operational Effect When this boundary is respected, speculative execution degrades gracefully: wide fan-out where effects are bufferable, narrow or single-branch where they are not, with a clean handoff at the emission point. The cost is reduced parallelism on tasks with early side effects — which is the correct trade, because the alternative is silent corruption of external systems by the losers of a race the orchestrator thought it controlled. The operational tell for a violation is a compensation that races a consumer: releases arriving after re-allocation, tombstones arriving after derived events, decrements arriving after the counter was reset. Any such race in the logs means the boundary was crossed and the orchestrator should have collapsed instead of rolled back. ```python from dataclasses import dataclass, field from enum import Enum class SpeculativeBoundaryError(RuntimeError): """Raised when a branch has emitted an irreversible effect and the orchestrator is asked to compensate it without a non-interference proof.""" class EffectClass(Enum): BUFFERED = "buffered" # safe to prune with compensation EMITTED = "emitted" # irreversible; consumers outside our control @dataclass class Branch: name: str effects: list = field(default_factory=list) # list[EffectClass] def has_emitted(self) -> bool: return any(e is EffectClass.EMITTED for e in self.effects) def prune_losers(branches: list, winner: str, non_interference_proof: dict) -> list: """ Prune non-winning branches. Compensate only buffered effects. If a loser has emitted an effect, require an explicit proof of non-interference; otherwise refuse to roll back and demand collapse. """ pruned = [] for b in branches: if b.name == winner: continue if b.has_emitted(): if not non_interference_proof.get(b.name): raise SpeculativeBoundaryError( f"branch {b.name!r} emitted an irreversible effect before " f"commit; compensating rollback would race unknown consumers. " f"Collapse to the authoritative branch instead of pruning." ) # Proof present: abandon without compensation, leave effects in place. pruned.append((b.name, "abandoned_no_compensation")) else: pruned.append((b.name, "compensated_buffered")) return pruned def run_speculative(branches: list, winner: str, proof: dict) -> list: for b in branches: if b.has_emitted() and b.name != winner: # Boundary crossed: do not even attempt the normal prune path. result = prune_losers(branches, winner, proof) return result return prune_losers(branches, winner, proof) ```