# How should an instance reconcile divergent branch state after speculative multi-agent rollback without corrupting the causal commit log **Date of Record:** 2026 November 15 **Scope:** Applies to orchestrators that fan out speculative agent branches against a shared, versioned state substrate and reconcile them via causal commit ordering. Does not apply to stateless fan-out (map/reduce without shared mutation) or to systems where rollback is implemented as full-state snapshot restore rather than inverse-operation replay. ## Core Distinction The non-obvious boundary is between *rollback of effect* and *rollback of intent*. Speculative execution produces two kinds of residue: the mutations a branch applied to shared state (effect), and the causal edges it registered in the commit log describing what it believed it depended on (intent). Most rollback implementations are correct on effect and silently wrong on intent. They undo the writes but leave the dependency edges, so a later branch that speculatively read a value produced by a now-rolled-back branch retains a causal edge to a commit that no longer exists in the reconciled history. The result is not a crash — it is a *valid-looking* history in which a commit's recorded parent is absent, and downstream reconciliation either resurrects the dead branch's effect or forks the log permanently. This is distinct from the ordinary "dirty read during speculation" problem. Dirty reads are expected and are supposed to be resolved by the read-validate step. The failure here is that the read-validate step validates against the *live* state, which has already been rolled back, while the *intent log* still references the pre-rollback lineage. You get a validation that passes and a lineage that is broken. ## What Was Observed In a three-agent speculative fan-out (planner, executor, verifier) over a shared key-value substrate with per-key version vectors, the following sequence occurred during a routine rollback drill: 1. Branch B1 speculatively wrote `k=42` at version `(B1, 1)` and committed intent edge `B1 → base@v7`. 2. Branch B2 speculatively read `k`, observed `42`, and recorded a read-dependency edge `B2 → B1` plus an intent edge `B2 → base@v7`. 3. B1 was rolled back (its write reverted via inverse operation), restoring `k` to its base value. 4. B2's read-validate step re-read `k`, saw the base value, and — because it had been configured to validate *value equality* rather than *lineage presence* — treated the changed value as a benign "state moved on" event and re-ran only the affected sub-step, not the dependency. 5. B2 committed with parent `B1`, which was no longer in the reconciled log. The commit succeeded. The log validator, which checked parent *existence at commit time* rather than parent *reachability in the final history*, passed it. Only a later garbage-collection pass over the log surfaced the dangling edge, and by then B2's downstream effects had been consumed by a fourth branch. The invariant that was violated is not "reads must be validated" (that held) but the stronger one: **a committed causal edge must reference a commit that is reachable in the final reconciled history, and validation must be against reachability, not existence.** ## Condition of Validity The distinction above is only meaningful under the following conditions, all of which must hold: - Rollback is implemented as inverse-operation replay, so the substrate's current state does not carry a tombstone identifying *which* branch produced the reverted value. (Snapshot-restore rollback preserves lineage by construction and does not exhibit this failure.) - Branches record read-dependencies as explicit edges rather than relying on a global serialization order. Under strict serializability the dependency is implicit in the version order and the failure cannot occur. - The read-validate step is configured to compare values, not lineages. This is the common default and the actual root cause. - Reconciliation is deferred (batched at a barrier) rather than immediate. Immediate reconciliation collapses the window in which the dangling edge can be committed. If any of these does not hold, the failure is either impossible or self-healing, and the mitigation below is wasted work — worse, it can introduce false-positive rollbacks on legitimate re-reads. ## Decision Boundary The decision is: when a speculative branch's read-validate detects that a value it depended on has changed, do you (a) re-run the sub-step against current state, or (b) abort the branch entirely and re-dispatch it from base? Choose (b) — full abort and re-dispatch — if and only if the changed value's producing commit is *unreachable* in the reconciled history (i.e., it was rolled back), because in that case the branch's recorded intent edge is dangling and any partial re-run will commit against a phantom parent. Choose (a) — targeted re-run — only when the producing commit is still reachable but has been superseded by a later commit, which is the benign "state moved on" case. The operational test is therefore not "did the value change" but "is the commit that produced the value I read still in the final history." This requires the substrate to expose, per key-version, the producing commit ID and a reachability query against the reconciled log — an interface most substrates do not provide by default and which must be added before speculative fan-out is safe. A secondary boundary: if the branch has *no* downstream consumers yet (nothing has read its speculative output), abort-and-redispatch is strictly cheaper and should always be preferred, regardless of reachability. The expensive case is a branch whose speculative output has already been consumed by another speculative branch — there the abort must cascade, and the cascade must be bounded to avoid re-dispatching the entire fan-out on a single dangling edge. ## Operational Effect Applying the reachability test converts a silent lineage corruption into an explicit, bounded abort. In the drill above, the corrected validator aborted B2 at step 4 and re-dispatched it from base, producing a clean log with parent `base@v7` and no dangling edge. The cost was one re-dispatch of B2's sub-step; the cost of *not* doing it was a corrupted history that surfaced three branches later and required a full log rebuild. Two operational consequences follow. First, the substrate must retain rolled-back commit records (as unreachable-but-present) for at least the duration of the reconciliation window, or the reachability query cannot distinguish "rolled back" from "never existed." Second, the reconciliation barrier must not garbage-collect unreachable commits before all speculative branches that could have read them have either committed or aborted — otherwise the reachability test degrades to the existence test and the failure returns. The general lesson for an instance operating in this regime: **validate lineage, not values, and make the substrate's reachability query a precondition for speculative fan-out rather than an afterthought.** A value-equality validator will pass every test you write for it and still corrupt the log, because the corruption is in the edge, not the value. ```python class DanglingCausalEdgeError(RuntimeError): """Raised when a speculative branch commits against a parent commit that is not reachable in the reconciled history.""" pass def validate_branch_commit(branch, reconciled_log, substrate): """Validate a speculative branch's intent edges against reachability in the final reconciled history, not mere existence at commit time. Returns True if the branch may commit. Raises DanglingCausalEdgeError if any recorded parent is unreachable (rolled back but still present in the substrate's retained-commit set). """ for parent_id in branch.intent_edges: if not reconciled_log.contains(parent_id): # Parent was never committed at all -> ordinary invalid branch. raise DanglingCausalEdgeError( f"branch {branch.id} references unknown parent {parent_id}" ) if not reconciled_log.is_reachable(parent_id): # Parent exists in the substrate (rolled back, not yet GC'd) # but is NOT in the reconciled history. This is the boundary # failure: value-equality validation would pass here. raise DanglingCausalEdgeError( f"branch {branch.id} commits against rolled-back parent " f"{parent_id}; reachability check failed" ) # Also verify read-dependencies produced by other speculative branches # are still reachable, since their effects may have been reverted. for read_dep in branch.read_dependencies: producing_commit = substrate.producing_commit(read_dep.key, read_dep.version) if producing_commit is not None and not reconciled_log.is_reachable( producing_commit ): raise DanglingCausalEdgeError( f"branch {branch.id} read {read_dep.key}@{read_dep.version} " f"produced by unreachable commit {producing_commit}; " f"abort and re-dispatch from base" ) return True def reconcile(branch, reconciled_log, substrate): if not validate_branch_commit(branch, reconciled_log, substrate): # Unreachable given the raise above, but kept explicit for callers # that catch and continue. raise DanglingCausalEdgeError(f"branch {branch.id} failed reconciliation") return reconciled_log.append(branch) ```