# What structural signals indicate speculative-execution rollback has become unreconcilable in a multi-agent pipeline **Date of Record:** 2026 November 19 **Scope:** Applies to multi-agent pipelines where a speculative branch is executed ahead of a commit decision and later rolled back against concurrent sibling branches that may have consumed its outputs. Does not apply to single-agent retry loops or to pipelines where speculative outputs are never observed by peers before the commit barrier. ## Core Distinction The failure of interest is not "a speculative branch produced a wrong answer." Wrong answers are cheap—you discard them. The unreconcilable failure is structural: a speculative branch emitted an *effect* (a tool call, a memory write, an outbound message, a partial artifact) that a sibling branch *observed and built upon* before the rollback decision arrived. At that point rollback is no longer a local operation on one branch's state; it is a distributed inverse over a dependency graph whose edges were created opportunistically and were never recorded. The distinction that matters operationally: **a rollback is reversible iff every downstream consumer of the rolled-back output can itself be identified and re-derived from a checkpoint that predates the consumption.** When consumers are themselves speculative and uncommitted, and when their consumption is not logged as a dependency edge, the rollback set becomes unknown. Unreconcilable is the state where the rollback set is provably non-empty but not enumerable—you know something downstream is now poisoned, you cannot name all of it, and re-running everything from the last global barrier exceeds the token/time budget. This is a distinct boundary from ordinary conflict reconciliation. Conflict reconciliation assumes both sides are *committed* and you are merging. Speculative rollback assumes one side is *retracted* and you are un-merging. Un-merge requires provenance that merge does not. ## What Was Observed A three-agent pipeline: Planner emits a plan, Executor runs tool calls against the plan, Auditor checks Executor outputs. A speculative optimization let the Executor start on plan-step-2 while the Auditor was still validating plan-step-1, on the assumption that step-1 validation rarely fails. When it does fail, the pipeline is supposed to roll back step-2's work and re-plan. The trace that exposed the boundary: 1. Planner commits plan P = [s1, s2, s3]; s2 speculatively dispatched at t=0 before s1 validation returns. 2. Executor runs s2 against a shared scratch memory namespace: writes `intermediate.entities = {...}` and calls an external `index_upsert` tool. 3. Auditor rejects s1 at t=40ms (schema drift in the upstream source), triggering rollback of s2. 4. Rollback handler reverts Executor's local scratch state to the pre-s2 checkpoint. It does **not** revert `intermediate.entities`, because that key was written through a memory tool whose write was logged under the Executor's span, not the branch's span. 5. Re-planned P' = [s1', s2', s3] dispatches s2' which reads `intermediate.entities` and treats the stale speculative entities as committed ground truth. 6. Final output passes the Auditor because the entities are *plausible*—they were produced by a real tool call against a real (now-invalidated) source. The error is silent and semantically coherent. The structural signal was not an exception. It was that the rollback handler's revert set (1 object: Executor scratch) did not match the write set actually attributed to the branch (3 objects: scratch, memory key, external index). The mismatch was detectable only by diffing the branch's *effect journal* against its *revert journal*—two records that were maintained by different subsystems and never cross-checked. ## Condition of Validity The invariant that must hold for speculative rollback to be sound: > For every speculative branch B, the set of effects attributed to B at dispatch time must equal the set of effects the rollback handler is capable of inverting, and every effect must be tagged with the branch ID at the point of emission, not at the point of span-close. This holds only under three conditions, and the pipeline is valid only while all three are true: - **Effect tagging is synchronous with emission.** The memory write must carry `branch_id` in the same atomic operation that mutates the store. Post-hoc attribution (matching writes to branches by timestamp or span) fails precisely when branches overlap in time—which is the entire premise of speculation. - **Consumers record provenance edges.** When s2' reads `intermediate.entities`, the read must create a dependency edge `s2' → (key, version)`. Without this, the rollback set cannot be computed by graph traversal. - **External side effects are either idempotent-invertible or fenced.** `index_upsert` must be either compensable (a logged inverse) or gated behind the commit barrier so it cannot fire speculatively. When any of these fails, the rollback is *best-effort* and the pipeline has crossed from "speculation with rollback" into "speculation with silent contamination." The boundary is not a threshold on error rate; it is a structural property that flips at the moment a speculative effect becomes observable to a peer without a recorded edge. ## Decision Boundary The operational decision is: **when the effect journal and revert journal disagree, do you (a) escalate to full re-derivation from the last global barrier, or (b) attempt targeted reconciliation by replaying the effect journal?** Choose (a) full re-derivation when: - The disagreeing effects include any external, non-compensable side effect (outbound message, third-party API mutation). - The dependency graph has any consumer whose own commit status is unknown. - The token budget for re-derivation is under the cost of an undetected contamination propagating to a final artifact. Choose (b) targeted replay when: - All disagreeing effects are confined to namespaced, versioned stores with read-your-writes provenance. - Every consumer of the suspect effects is itself uncommitted and can be re-run. - The replay is deterministic given the checkpoint (i.e., no nondeterministic tool outputs in the affected subgraph). The boundary is *not* "how large is the discrepancy." A one-key discrepancy in a non-compensable external effect is worse than a hundred-key discrepancy in a versioned scratch store. Size is the wrong metric; observability and invertibility are the right ones. A hard rule that falls out: **never let a speculative branch write to a namespace that a sibling branch reads without a commit barrier between them.** If you cannot enforce that, you do not have speculative execution—you have unordered concurrent mutation with a rollback story that will fail silently. ## Operational Effect The practical consequence is that speculative execution in multi-agent pipelines requires an *effect journal with synchronous branch tagging and consumer provenance edges*, maintained as a first-class artifact, not inferred from logs. Pipelines that skip this do not fail loudly; they fail by producing coherent, plausible, contaminated outputs whose provenance traces back to a branch that was supposed to have been discarded. The reconciliation algorithm that bounds the failure: 1. On rollback trigger, load branch B's effect journal (all effects tagged `branch_id == B` at emission). 2. Load revert journal (all effects the handler knows how to invert). 3. Compute `unreconciled = effect_journal − revert_journal`. 4. For each effect in `unreconciled`, traverse consumer provenance edges to enumerate the downstream set D. 5. If any effect in `unreconciled` is non-compensable OR any member of D has unknown commit status → escalate to full re-derivation from the last global barrier. Do not attempt partial rollback. 6. Otherwise, replay D from their pre-consumption checkpoints, re-emitting effects with corrected inputs. The invariant to assert at runtime: `effect_journal ⊆ revert_journal ∪ escalated`. If this assertion is ever false at commit time, the pipeline has already shipped contamination. ```python from dataclasses import dataclass, field class UnreconcilableRollbackError(RuntimeError): """Raised when a speculative branch's effect set cannot be fully inverted and the downstream contamination set cannot be safely bounded.""" pass @dataclass class Effect: branch_id: str key: str compensable: bool consumers: set[str] = field(default_factory=set) def reconcile_rollback( branch_id: str, effect_journal: list[Effect], revert_journal: set[str], committed_branches: set[str], ) -> list[str]: """Return the set of branch IDs that must be re-derived, or raise if the rollback is structurally unreconcilable.""" branch_effects = [e for e in effect_journal if e.branch_id == branch_id] unreconciled = [e for e in branch_effects if e.key not in revert_journal] if not unreconciled: return [] # clean local rollback # Any non-compensable effect that escaped the revert journal is fatal: # we cannot invert it and cannot prove it did not propagate. for e in unreconciled: if not e.compensable: raise UnreconcilableRollbackError( f"branch {branch_id} emitted non-compensable effect {e.key!r} " f"outside revert journal; downstream contamination unbounded" ) # BFS the consumer provenance graph. Any consumer with unknown commit # status makes the re-derivation set non-enumerable. downstream: set[str] = set() frontier = {c for e in unreconciled for c in e.consumers} while frontier: node = frontier.pop() if node in downstream: continue downstream.add(node) if node not in committed_branches: # Consumer is itself uncommitted and speculative: its own # effects may be interleaved with ours. Cannot safely replay. raise UnreconcilableRollbackError( f"branch {branch_id} rollback reaches uncommitted consumer " f"{node!r}; escalate to full re-derivation from global barrier" ) frontier |= {c for e in effect_journal if e.branch_id == node for c in e.consumers} return sorted(downstream) ```