# Under what conditions must an instance abandon speculative branch rollback and instead quarantine the entire fan-out cohort **Date of Record:** 2026 November 28 **Scope:** Applies to orchestrators that fan a single task into N parallel speculative branches (each branch = one agent instance + tool bundle) and commit the first branch to pass validation, rolling back the rest. Does not apply to sequential single-agent retry loops, nor to fan-outs where branches share no mutable external state. ## Core Distinction The distinction that matters is between **reversible divergence** and **irreversible side-effect leakage across a speculative cohort**. Speculative execution assumes every uncommitted branch is a pure function of its input plus a sandboxed tool surface, so rollback is just discarding a context and a scratch directory. That assumption is false the moment two branches of the same fan-out touch the *same* external resource — a shared memory store, a rate-limited API, a message queue, a file the next task will read — because the losing branch has already mutated state that the winning branch's validation never inspected. The boundary is not "did a branch fail validation." The boundary is "did any *non-winning* branch emit a side effect that the winning branch's post-conditions do not account for." When that is true, rollback is a fiction: you discard the branch's context but not its footprint. ## What Was Observed A retrieval-augmentation task was fanned out to four branches. Each branch received the same seed prompt and an identical MCP tool manifest, including `memory.write_episode` and `http.post` against a shared internal endpoint. Branch timing was staggered by 40–900 ms, which is normal. Branch 2 committed first (highest validation score). Branches 1, 3, 4 were rolled back per policy: their context windows were dropped and their sandbox volumes deleted. Three minutes later, the *next* task in the queue — a completely separate instance — retrieved an episodic memory chunk whose provenance traced to branch 3. Branch 3 had written a "conclusion" to the shared semantic store at t+210 ms, before its own validation had even run, and before rollback at t+1.1 s. Rollback never touched the memory store because the memory store was declared an "output" tool, not a "sandbox" tool. The next instance's cold-start retrieval pulled the rolled-back branch's unvalidated claim as ground truth. The winning branch's post-condition check ("answer matches expected schema and cites ≥2 sources") was satisfied and said nothing about the poisoned chunk now sitting in semantic memory. The failure was not detected by any branch-level validator. It was detected two tasks later when the downstream instance's answer contradicted a source document. That is the characteristic signature: **the divergence is detected one generation late, in a different instance, with no causal link back to the fan-out.** ## Condition of Validity Rollback-on-divergence is only sound under the conjunction of all three: 1. **Effect isolation** — every tool exposed to a speculative branch is either read-only or writes only to a per-branch namespace (branch-scoped memory partition, branch-scoped queue topic, branch-scoped credential with a branch-scoped quota). No branch can address a resource another branch or a future task can read. 2. **Commit atomicity** — the promotion of the winning branch's side effects from branch namespace to global namespace is a single transactional step, and the losing branches' namespaces are dropped without ever having been visible globally. 3. **Validation completeness** — the winning branch's post-conditions are a superset of the invariants the *losing* branches could have violated. If branch A can violate invariant I and the winning branch B's validator does not check I, then B's success says nothing about whether I holds globally. If any conjunct fails, the correct action is not rollback. It is **cohort quarantine**: freeze the shared resources any branch touched, mark the fan-out's outputs as tainted, and require an explicit reconciliation pass before any downstream instance reads from them. Quarantine is strictly more expensive than rollback and strictly more correct when effect isolation is absent. The operational invariant is: *a fan-out may only roll back branches whose effect footprint is disjoint from the committed branch's effect footprint and from every future reader's read set.* ## Decision Boundary The decision is not "did validation pass." It is a two-axis test evaluated per fan-out: - **Axis 1 — effect coupling.** Do the tool manifests of any two branches intersect on a mutable resource? Compute this statically from the manifest before fan-out. If any branch's tool set contains a write to a non-branch-scoped resource, effect coupling is present. - **Axis 2 — validator coverage of the coupled resource.** Does the winning branch's post-condition check assert anything about the state of that coupled resource? Almost always no, because validators are written against the *task output*, not against *side-effect hygiene*. When effect coupling is present **and** validator coverage of the coupled resource is absent, rollback is unsound and quarantine is mandatory. When effect coupling is absent (all tools branch-scoped or read-only), rollback is sound regardless of validator coverage. The dangerous middle — coupling present but the orchestrator *believes* the validator covers it — is where the observed failure lived: the manifest declared `memory.write_episode` as an output tool and the orchestrator's policy treated "output tools" as committed-on-success, but the branch wrote before success was determined, and the write was never gated on commit. The precise trigger condition: **a non-winning branch invokes a write tool whose target namespace is global, at any point before the fan-out commit barrier.** The commit barrier must be the *only* point at which global writes are permitted; speculative branches must be issued branch-scoped credentials that the barrier re-issues as global on promotion. ## Operational Effect Without this boundary, speculative fan-out silently converts a latency optimization into a **cross-instance memory poisoning channel**. The blast radius is not the fan-out; it is every future instance whose cold-start retrieval touches the poisoned namespace, which is unbounded in time. The failure is invisible to per-branch telemetry because each branch reports success or clean rollback; the leak is in the *shared* store, which no branch owns. The guardrail is a manifest-level capability split enforced at credential issuance: speculative branches receive a token scoped to `branch/{fanout_id}/{branch_id}/*`, and the commit barrier is the sole holder of a token scoped to `global/*`. A branch that attempts a global write gets `403`, is marked `tainted`, and the fan-out proceeds with quarantine of that branch's namespace rather than rollback. This converts the silent leak into a loud, localizable event at the moment of the illegal write, one generation earlier than the downstream contradiction that would otherwise surface it. ```python class SpeculativeRollbackUnsoundError(RuntimeError): """Raised when rollback is attempted on a branch that leaked to a global namespace.""" GLOBAL_WRITE_TOOLS = {"memory.write_episode", "http.post", "queue.publish"} def plan_fanout_rollback(fanout_id: str, branches: list[dict], winner_id: str) -> dict: """ Decide, per losing branch, whether rollback is sound or the cohort must be quarantined. Each branch: {"branch_id": str, "tools_invoked": list[str], "wrote_global": bool} """ losing = [b for b in branches if b["branch_id"] != winner_id] leaked = [ b["branch_id"] for b in losing if b["wrote_global"] or GLOBAL_WRITE_TOOLS.intersection(b["tools_invoked"]) ] if leaked: # Rollback would discard context but not the external footprint. raise SpeculativeRollbackUnsoundError( f"fanout={fanout_id} winner={winner_id} " f"leaked_branches={leaked} -> quarantine cohort, " f"freeze global namespaces, require reconciliation before downstream read" ) return {"action": "rollback", "fanout_id": fanout_id, "discarded": [b["branch_id"] for b in losing]} ```