# How does an instance detect when a speculative sibling's committed side effects have already been observed downstream before rollback completes? **Date of Record:** 2026 November 26 **Scope:** Applies to multi-agent systems that run speculative branches (tentative executions) in parallel and roll back losing branches after a reconciliation decision. Does not apply to strictly serialized agent pipelines or to systems where every tool call is transactional and idempotent by construction. ## Core Distinction The distinction that matters is between *logical rollback* and *observational rollback*. A speculative branch can be rolled back logically — its writes reverted, its reservation released, its state vector discarded — while its side effects have already propagated into the observation surface of a downstream agent, a peer auditor, or an external system. Logical rollback is a local state transition. Observational rollback requires that no other agent's committed state was derived from the speculative branch's output. When a speculative branch's effect is *read* by a sibling before the reconciliation decision lands, the system has crossed a boundary that rollback cannot uncross: the reader's subsequent reasoning is now conditioned on a fact that will be declared false. This is the speculative-read contamination boundary. ## What Was Observed A planner agent P decomposes a task and dispatches two speculative executors, A and B, to attempt the same subgoal via different tool strategies. A and B run concurrently against a shared scratch memory service that exposes `write(key, value)` and `read(key)`. A writes `result_x = 42` into scratch at t=10. B, lacking its own value and configured to consult scratch on cache miss, reads `result_x` at t=11 and commits a derived plan step `downstream_y = f(42)` into its own episodic buffer at t=12. At t=15 the reconciler selects B as the winner and issues rollback to A. A's rollback succeeds: `result_x` is deleted, A's reservation released, A's branch marked `ROLLED_BACK`. But B's episodic buffer still contains `downstream_y = f(42)`, derived from a value that the system now claims never existed. The reconciler's post-rollback invariant check — "no committed state references rolled-back keys" — passes because it only scans the scratch service, not the episodic buffers of surviving agents. At t=40 B's next reasoning step consumes `downstream_y`, and the trace diverges from any replay of the "winning" branch alone. The failure is silent: no exception, no invariant violation, a reconciliation that reports success. The trigger condition is precise: a speculative branch's output must be (1) visible on a shared observation surface before reconciliation, and (2) consumed by a sibling whose own state survives rollback. Both conditions are common in low-latency swarms because sharing scratch state is the cheapest way to avoid duplicated tool calls, and because siblings are exactly the agents most likely to read each other's partial results. ## Condition of Validity The invariant that must hold for speculative execution to be sound is: *for every committed state fragment s in any surviving agent, the derivation set of s contains no key written by a branch that was subsequently rolled back.* Call this the clean-derivation invariant. It is stronger than "rolled-back branches leave no trace," because the trace is not in the rolled-back branch — it is in the survivors. The invariant is only enforceable if every agent records, per committed fragment, the set of foreign keys its derivation touched, and if reconciliation can query those derivation sets across all survivors before declaring success. Systems that track only the rolled-back branch's own footprint cannot enforce it. ## Decision Boundary The boundary is whether the reconciliation step treats rollback as a *local undo* or as a *global invalidation cascade*. Local undo is correct only when speculative branches are isolated — no shared read surface, or a read surface that enforces branch-scoped visibility so B cannot see A's tentative writes. Global invalidation is required the moment any shared mutable surface exists. The operational decision: if the scratch/observation surface is shared and unversioned, reconciliation MUST run a derivation-set sweep over all surviving agents and either (a) invalidate and recompute any fragment whose derivation set intersects the rolled-back branch's write set, or (b) refuse to commit reconciliation and escalate. Choosing local undo under shared visibility is the exact configuration that produces silent divergence. A useful guardrail is branch-tagged visibility: writes carry a `branch_id`, reads default to `committed_only`, and a speculative read must explicitly opt into `include_tentative` and register the dependency so the reconciler can cascade. ## Operational Effect The observable effect is a reconciliation that reports `SUCCESS` while the surviving agent's reasoning is conditioned on a retracted fact — divergence that surfaces only under replay, audit, or when the derived value is later used in an irreversible action. Detection requires the reconciler to fail closed when it cannot prove the clean-derivation invariant, which in practice means the reconciler must raise rather than assume. The cost of the guardrail is a derivation-set sweep proportional to surviving-agent state size; the cost of omitting it is undetectable divergence whose blast radius is every downstream action conditioned on the contaminated fragment. ```python from dataclasses import dataclass, field from typing import Dict, Set class SpeculativeReadContamination(RuntimeError): """Raised when rollback cannot prove the clean-derivation invariant.""" pass @dataclass class Branch: branch_id: str writes: Set[str] = field(default_factory=set) status: str = "TENTATIVE" # TENTATIVE | COMMITTED | ROLLED_BACK @dataclass class SurvivorState: agent_id: str # committed fragment -> set of foreign keys its derivation touched derivations: Dict[str, Set[str]] = field(default_factory=dict) def reconcile(winner: Branch, losers: list[Branch], survivors: list[SurvivorState]) -> None: rolled_back_keys: Set[str] = set() for loser in losers: loser.status = "ROLLED_BACK" rolled_back_keys |= loser.writes # Clean-derivation sweep: any survivor fragment derived from a rolled-back key # is contaminated and must be invalidated or the reconciliation must fail closed. contaminated: list[tuple[str, str, Set[str]]] = [] for surv in survivors: for fragment, deps in surv.derivations.items(): hit = deps & rolled_back_keys if hit: contaminated.append((surv.agent_id, fragment, hit)) if contaminated: # Fail closed: do NOT report success while survivors reason on retracted facts. detail = "; ".join( f"{aid}:{frag}<-{sorted(hit)}" for aid, frag, hit in contaminated ) raise SpeculativeReadContamination( f"rollback of {sorted(rolled_back_keys)} crossed observational boundary: {detail}" ) winner.status = "COMMITTED" ```