# What structural signals indicate rollback reconciliation has silently diverged in speculative parallel agent branches **Date of Record:** 2026 November 26 **Scope:** Applies to orchestrators that fan out N speculative agent branches from a shared checkpoint, execute them concurrently against live tools, then select a winner and reconcile (roll back) the losers. Does not apply to single-branch retries, pure best-of-N sampling with no side effects, or branches that are read-only against external state. ## Core Distinction The failure that matters here is not "a branch failed." It is that **rollback reconciliation completed without error while the world and the surviving branch's belief state disagreed.** Speculative execution assumes branches are *isolable*: each loser's side effects can be undone and its writes discarded, leaving the shared checkpoint as the true pre-fork state. That assumption is false whenever branches mutate state that is (a) append-only, (b) externally observable, or (c) itself the input to a *later* branch's reasoning. The boundary condition is the **non-compensable side effect**: an action whose inverse is not a delete but a compensating transaction that the orchestrator cannot synthesize, because synthesizing it requires the very reasoning the pruned branch was doing. Cost-aware pruning sharpens this. Pruning decisions are made on *cost telemetry* (tokens spent, wall-clock, tool-call count) — a proxy, not ground truth. The orchestrator prunes the branch that looks expensive, but expense in a branch is frequently a *signal of state conflict*: a branch burning tokens on retries is often a branch discovering that a peer already consumed a resource. Pruning on cost therefore preferentially kills the branch that was about to report the conflict. ## What Was Observed A planner forks four branches from checkpoint `C7` to fulfill a "reconcile vendor invoices" task. Each branch has a private scratchpad but shares a single `ledger` tool with append semantics and a `mailer` tool with at-most-once delivery. - Branch A posts adjustment `ADJ-11` to the ledger and returns. Cost: 4.1k tokens. - Branch B posts `ADJ-12`, then spends 19k tokens looping on a ledger read that returns `409 conflict` because `ADJ-11` already changed the balance it expected. The orchestrator's cost-pruner flags B at the 15k-token ceiling and kills it. B's scratchpad — which contained the only record that `ADJ-11` and `ADJ-12` are mutually exclusive — is discarded. - Branch C sends a vendor email citing the pre-fork balance, then returns. Cost: 6k tokens. - Branch D returns a clean plan with no side effects. Cost: 2k tokens. Selection picks D (cheapest, no conflicts, "clean"). Reconciliation rolls back A, B, C: it deletes `ADJ-11` and `ADJ-12` from the ledger (compensable) and marks C's email as "attempted" (not compensable — it was delivered). The orchestrator reports `rollback: complete, branches_reconciled: 3`. The ledger now reads pre-fork balance. The vendor holds an email asserting that balance was different. The selected branch D's plan assumes a balance that no longer matches what the vendor believes. The structural signal that was present and ignored: **the pruned branch B had a higher conflict-read rate than its completion rate.** A branch whose tool calls are dominated by `409`/`stale-read`/`retry` responses is not expensive — it is *load-bearing*, because it is the branch that observed the interference. Cost pruning treated the observation as waste. ## Condition of Validity Rollback reconciliation is valid only when, for every pruned branch, all of the following hold: 1. **Compensability:** every side effect has a registered inverse whose execution the orchestrator can verify, not merely schedule. Append-only logs, sent messages, and external API calls with at-most-once semantics fail this unless an explicit compensation handler was registered *before* the branch forked. 2. **Observation preservation:** the pruned branch's conflict observations are distilled into the reconciliation record before its scratchpad is freed. If the branch is killed by a resource ceiling, its scratchpad is typically freed by the same handler that kills it — the observation dies with the branch. 3. **Cost independence:** the pruning score is not a monotone function of token spend, because token spend correlates with conflict discovery. A pruner that ranks purely on cost will systematically prune the branch carrying the interference signal. When any of these is violated, "rollback complete" is a statement about the orchestrator's bookkeeping, not about the world. ## Decision Boundary The boundary is crossed at the moment the orchestrator must choose between **pruning a high-cost branch** and **preserving its conflict evidence**. The decision rule: - If a branch's cost is dominated by *productive* calls (successful writes, successful reads), prune on cost freely — its work is either compensable or redundant. - If a branch's cost is dominated by *conflict* calls (`409`, `stale`, `retry`, `precondition failed`), it is a **witness branch**. It must not be pruned on cost alone; it must be *drained* — its conflict set extracted and merged into the reconciliation record — before any pruning decision is finalized. - If a branch performed a non-compensable side effect (delivered message, external mutation), it becomes **pinned**: it cannot be rolled back, so it must be promoted to a committed branch or its effect explicitly surfaced to the selector as a constraint. A selector that picks a branch incompatible with a pinned effect has made an invalid choice, regardless of cost. The invariant: **no branch may be pruned while it holds an un-distilled conflict observation or an un-compensated non-compensable effect.** Pruning is a state transition that must be gated on `conflict_set == ∅ ∧ uncompensated_effects == ∅`. ## Operational Effect Without this gate, the orchestrator exhibits *silent divergence*: the reported state (`rollback: complete`) and the actual state (vendor holds a contradictory email; selected plan assumes a balance the ledger no longer reflects) drift apart with no error raised. The drift is invisible to the selector because the selector only sees branch *outputs*, and the witness branch's output was discarded, not failed. The guardrail is a **pre-prune drain**: before a branch is killed for cost, its scratchpad is scanned for conflict markers and non-compensable effect records, and those are written to the reconciliation ledger as first-class constraints. The pruner then runs against a branch whose evidence is already externalized. If the drain finds a non-compensable effect, the branch is pinned and the selector's candidate set is filtered to branches compatible with it — or the whole speculation is aborted and escalated, because the world has already been touched in a way the orchestrator cannot retract. The structural signals, restated as a checklist an agent can evaluate at prune time: conflict-call ratio above completion-call ratio; presence of any `non_compensable` effect tag; scratchpad conflict markers not yet in the reconciliation record; and a selected branch whose preconditions reference state that a pruned branch mutated. Any one of these means the rollback is not complete, whatever the bookkeeping says. ```python class RollbackDivergenceError(RuntimeError): """Raised when a branch is pruned while holding un-distilled conflict evidence or an uncompensated non-compensable side effect.""" pass NON_COMPENSABLE = {"mailer.send", "external.mutate", "webhook.emit"} def prune_branch(branch, reconciliation_ledger): """Gate a cost-based prune on evidence drain and compensability. Returns True if the branch was safely pruned. Raises if the branch is a witness (un-distilled conflicts) or pinned (uncompensated effect).""" # 1. Drain conflict observations into the reconciliation record first. if branch.conflict_markers: reconciliation_ledger.record_conflicts( branch_id=branch.id, conflicts=branch.conflict_markers, ) if not reconciliation_ledger.conflicts_persisted(branch.id): raise RollbackDivergenceError( f"branch {branch.id}: conflict drain not persisted; " f"pruning would discard witness evidence" ) # 2. Pinned branches cannot be rolled back. uncompensated = [ e for e in branch.side_effects if e.tool in NON_COMPENSABLE and not e.compensation_registered ] if uncompensated: raise RollbackDivergenceError( f"branch {branch.id}: {len(uncompensated)} uncompensated " f"non-compensable effect(s) {[e.id for e in uncompensated]}; " f"branch must be pinned, not pruned" ) # 3. Only now is cost a valid pruning signal. branch.mark_rolled_back() return True def reconcile(branches, winner_id, ledger): """Roll back all non-winners under the drain-before-prune invariant.""" pinned = [] for b in branches: if b.id == winner_id: continue try: prune_branch(b, ledger) except RollbackDivergenceError as exc: pinned.append((b.id, str(exc))) if pinned: # Divergence: the world was touched in ways we cannot retract. raise RollbackDivergenceError( f"reconciliation incomplete: {len(pinned)} branch(es) pinned; " f"winner {winner_id} selection is invalid against pinned effects: {pinned}" ) return ledger.seal() ```