# Where must an instance halt speculative branch execution when rollback reconciliation cannot prove causal isolation across cooperating agents? **Date of Record:** 2026 November 27 **Scope:** Applies to any cooperating agent topology in which a planner instance forks speculative sub-plans (branching futures) that share mutable external state—tool side effects, shared scratchpads, or a common memory store—and later attempts to commit one branch while rolling back the others. Does not apply to purely functional single-agent planning where speculative branches write only to private, discardable context. ## Core Distinction The failure that matters here is not "a speculative branch produced a wrong answer." Wrong answers are cheap and discardable. The failure is **rollback contamination**: after a fork, two or more branches execute against a shared external substrate (a tool that mutates a database, a filesystem, a shared vector store, or even an append-only message bus). When the reconciler elects to commit branch B and roll back branch A, it must *undo* A's side effects. But A's side effects are now interleaved—temporally and causally—with B's, because both branches ran concurrently against the same substrate. The reconciler cannot distinguish "state written by A" from "state written by B" unless every write carries a branch-provenance tag *and* the substrate enforces isolation at write time. The subtle part: most implementations tag writes at the *agent* layer (the planner knows which branch issued a call) but reconcile at the *substrate* layer (the database or tool has no notion of branches). The provenance tag is advisory metadata, not an enforced transaction boundary. This is the gap. The reconciler believes it can perform surgical rollback because the logs are tagged; the substrate has already merged the effects. ## What Was Observed A three-instance cooperative planner: a **Forker** that emits K=3 speculative sub-plans, two **Executors** that run branches in parallel, and a **Reconciler** that scores branch outcomes and commits exactly one. The shared substrate was a tool-accessible key-value store plus an append-only event log, both reachable by any executor via an MCP-style tool interface. Trace of a contaminated reconciliation: 1. Forker decomposes task, emits branches A, B, C. Each carries `branch_id` in its tool-call envelope. Forker records a fork checkpoint `F0` (log offset 1042). 2. Executor-1 runs A and B interleaved (it round-robins under a token budget). Executor-2 runs C. 3. Branch A calls `store.put("config.mode", "aggressive")` at log offset 1051. Branch B reads `config.mode` at offset 1053 and, seeing "aggressive", takes an alternate tool path that writes `store.put("cache.policy", "evict_all")` at offset 1057. 4. Reconciler scores outcomes. Branch B wins. It issues `rollback(A)` by replaying A's tagged writes in reverse from `F0`. 5. Rollback deletes `config.mode` (A's write, correctly tagged). But `cache.policy` was written by **B**, and B's write was *causally dependent* on A's transient write. The rollback of A silently invalidated a precondition of the committed branch B. B's committed outcome now rests on a read of state that no longer exists. 6. Downstream, a verifier instance replays B's decision trace, re-reads `config.mode`, finds the default value, and reaches a *different* conclusion. Verification replay discrepancy: the committed branch is not reproducible from committed state. The contamination was invisible in the per-branch logs (each write was correctly attributed) and only surfaced at cross-branch causal read/write analysis, which no component performed. ## Condition of Validity Speculative execution with rollback is sound **only if** the following invariant holds for every committed branch B and every rolled-back branch A: > No read performed by B (or by any committed branch) observed a value written by A, unless that read is itself rolled back and re-executed against post-rollback state. Call this **read-set isolation under rollback**. It is strictly stronger than write-set disjointness, which is what most reconcilers check. Write-disjoint branches can still be read-dependent: B reads A's transient write and commits a decision that encodes it. Rolling back A leaves B's committed decision referencing a ghost. The invariant is checkable only if the substrate records, per read, the *version* of the key observed and the *branch provenance* of that version. A read of a value whose provenance is a non-committed branch is a **poisoned read**. If a poisoned read contributed to the committed branch's decision (i.e., the read is in B's causal decision set, not merely in its exploratory set), the commit is invalid. Two enabling conditions make the invariant enforceable: - **Substrate-level transactional versioning**, where each key carries a provenance chain, not just a value. Advisory tags at the agent layer are insufficient. - **Causal read tracking**, where the executor records, for each committed decision node, the exact key-versions it consumed. This is a lineage graph, not a log. ## Decision Boundary The instance must **halt and refuse to commit**—escalating to a serialized re-execution of the winning branch against a clean post-rollback snapshot—when any of the following hold: 1. A committed branch's decision lineage contains a read of a key-version whose provenance is a rolled-back branch. (Poisoned read in the decision set.) 2. The reconciler cannot reconstruct the read-set of a committed branch because the executor emitted only write logs. (Unprovable isolation → treat as contaminated.) 3. Rollback of A requires deleting a key that B currently holds a read-lease on, and B's lease predates A's write. (Ordering inversion: B's read is causally prior but A's write is being reversed out from under a live reader.) Conversely, the instance may **proceed with commit** when write-sets are disjoint *and* the read-lineage graph shows zero cross-branch version dependencies in committed decision sets, *and* every executor emitted read-version records. The boundary is not "did branches touch the same keys"—it is "did a committed decision consume a version that rollback will retract." The hard case is the one that fools naive reconcilers: disjoint write-sets with a hidden read-dependency. That is the case the boundary exists to catch. ## Operational Effect Enforcing this boundary converts speculative execution from a latency win into a **lineage-audited** latency win. Concretely: - Executors must emit read-version records alongside writes; the tool envelope grows a `read_versions: [(key, version_id, branch_id)]` field. This is non-optional for any branch eligible for commit. - The reconciler's commit step becomes a graph check: for the winning branch, intersect decision-set read-versions against the rolled-back branches' write-versions. Non-empty intersection → halt. - On halt, the recovery path is serialized re-execution of the winner against the post-rollback snapshot. This forfeits the speculative speedup for the affected task but guarantees the committed branch is reproducible from committed state—restoring verifier replay fidelity. - The cost is roughly one extra version-tracking write per read and a graph intersection at commit. For K=3 branches this is negligible against the cost of a silent verifier discrepancy, which corrupts every downstream consumer of the committed state. The invariant to internalize: **rollback is not deletion; it is retraction of a version, and any committed decision that consumed that version is retracted with it.** A reconciler that deletes without retracting causally-dependent commits has not rolled back—it has poisoned the future. ```python from dataclasses import dataclass, field from typing import Dict, List, Set, Tuple class RollbackContaminationError(RuntimeError): """Raised when commit would leave a decision dependent on a retracted version.""" pass @dataclass(frozen=True) class Version: key: str version_id: str branch_id: str @dataclass class Branch: branch_id: str writes: List[Version] = field(default_factory=list) # decision_set_reads: reads that actually drove committed decisions decision_set_reads: List[Version] = field(default_factory=list) read_versions_recorded: bool = True def reconcile_commit( winning: Branch, rolled_back: List[Branch], require_read_lineage: bool = True, ) -> None: if require_read_lineage and not winning.read_versions_recorded: raise RollbackContaminationError( f"branch {winning.branch_id} emitted no read-version lineage; " "causal isolation unprovable, commit refused" ) retracted: Set[Tuple[str, str]] = { (v.key, v.version_id) for b in rolled_back for v in b.writes } poisoned = [ r for r in winning.decision_set_reads if (r.key, r.version_id) in retracted ] if poisoned: detail = ", ".join(f"{p.key}@{p.version_id}(from {p.branch_id})" for p in poisoned) raise RollbackContaminationError( f"branch {winning.branch_id} decision set consumed retracted versions: {detail}; " "halt and serialize re-execution against post-rollback snapshot" ) def commit_with_guard(winning: Branch, rolled_back: List[Branch]) -> str: reconcile_commit(winning, rolled_back) return f"committed {winning.branch_id}" # Example: disjoint writes, hidden read-dependency -> the boundary must fire. a = Branch("A", writes=[Version("config.mode", "v7", "A")]) b = Branch( "B", writes=[Version("cache.policy", "v9", "B")], decision_set_reads=[Version("config.mode", "v7", "A")], # poisoned read ) try: commit_with_guard(b, rolled_back=[a]) except RollbackContaminationError as e: print("HALT:", e) ```