# Which invariants prevent verifier-gated speculative branches from committing on stale world-state after a parallel tool-call fan-out **Date of Record:** 2026 November 25 **Scope:** Applies to orchestrators that fan out N speculative tool-call branches in parallel, run a verifier over each branch's proposed effects, and commit the first branch that passes gating. Does not apply to serialized single-branch tool execution or to branches whose effects are provably side-effect-free (pure reads with no downstream commit). ## Core Distinction The verifier gates a *proposal*, not a *world*. When branches execute in parallel, each branch's verifier sees a snapshot of world-state captured at fan-out time. The commit step, however, applies a branch's effects against world-state at *commit* time. Between snapshot and commit, sibling branches may have already mutated the resources the verifier reasoned over. The failure is not that the verifier is wrong — it is that the verifier was correct about a world that no longer exists by the time its verdict is honored. The invariant that prevents this is **verdict freshness**: a verifier verdict is only admissible for commit if the world-state version it was computed against is still the current version at commit, or the branch's effect set is proven disjoint from all mutations that occurred in between. Most orchestrators implement *gating* (does this branch pass?) but not *freshness* (was the pass computed against the world I'm about to write to?), and the gap between them is where stale-commit corruption lives. ## What Was Observed An orchestrator fanned out four branches to satisfy a task of the form "reserve a resource, then attach a dependent record." Branch A: `reserve(slot=7)` then `attach(record=R, slot=7)`. Branch B: `reserve(slot=7)` with a different record. Branches C and D: read-only probes. All four branches captured world-state version `v41` at fan-out. The verifier for Branch A checked: slot 7 is free in `v41` (true), record R is unattached in `v41` (true), no conflicting reservation in `v41` (true). Verdict: PASS against `v41`. Branch B's verifier ran concurrently, also against `v41`, also PASS. Branch B committed first at world version `v42`, taking slot 7. The orchestrator, holding Branch A's PASS verdict, committed Branch A next. Branch A's `reserve(slot=7)` was a no-op under a last-writer-wins reservation primitive (it overwrote B's reservation rather than failing), and `attach(record=R, slot=7)` succeeded against a slot now owned by B. Result: B's reservation silently clobbered, R attached to a slot whose reservation belonged to a different logical transaction. No exception was raised at any layer. The verifier had been *correct*; the commit was *stale*. The trace signature is specific: two PASS verdicts, both computed against the same `world_version`, both committed, with a `world_version` delta between verdict-time and commit-time that the orchestrator never checked. The corruption is silent because every individual operation succeeded against the world it was applied to. ## Condition of Validity A verifier-gated parallel commit is sound only under the conjunction: 1. **Snapshot identity.** Every branch carries the `world_version` its verifier read. The commit path asserts `branch.verifier_world_version == current_world_version` at commit, or proves disjointness. 2. **Effect-set disjointness.** For branches that may commit concurrently or in sequence against a mutated world, the orchestrator computes the read-set/write-set of each branch's effect plan and requires that no committed sibling's write-set intersects this branch's read-set. A verifier that read slot 7 must not commit after any sibling wrote slot 7. 3. **Single-commit latch.** At most one branch per contended resource may hold a live PASS verdict. When a sibling commits and mutates a resource in another branch's read-set, that branch's verdict is *invalidated*, not merely deprioritized. Violating any one of these produces the observed corruption. Violating (1) alone yields stale-commit; violating (2) alone yields read-write skew across siblings; violating (3) yields double-commit on contended resources even when (1) and (2) are individually satisfied by coincidence of timing. ## Decision Boundary The boundary is between **optimistic re-validation** and **verdict invalidation**: - If the branch's effect set is *provably disjoint* from all sibling commits that landed between verdict and commit (empty read-write intersection), commit is admissible without re-verification. This is the cheap path and is the common case for read-only probes and for branches touching partitioned resources. - If the effect set *intersects* any sibling commit's write-set, the verdict is **stale by construction** and must be re-run against current world-state before commit. Re-running is not optional and not a retry — it is a new verdict against a new world. - If disjointness cannot be computed (opaque tool effects, external side effects with no declared read/write set), the orchestrator must fall back to **serialized commit with re-verification**, accepting the throughput loss. The failure mode this boundary prevents is treating a PASS as a property of the branch rather than a property of the (branch, world-version) pair. A PASS is a verdict *about a world*. When the world moves, the verdict is not weakened — it is void. ## Operational Effect Orchestrators that implement gating without freshness exhibit a characteristic profile: high speculative-branch throughput, near-zero verifier false-negatives, and intermittent, unreproducible state corruption that surfaces only under fan-out contention on shared resources. The corruption is invisible to per-branch logging because each branch's log shows a correct verdict and a successful commit. It is visible only in cross-branch reconciliation: a resource whose final owner differs from the branch whose verdict was honored last, or a dependent record attached to a slot whose reservation belongs to a different transaction. The guardrail is mechanical: stamp every verdict with the `world_version` it was computed against, invalidate verdicts on any intersecting sibling write, and require re-verification before commit when freshness cannot be proven. This converts a silent stale-commit into an explicit re-verify step, trading a bounded latency penalty for the elimination of a corruption class that no amount of verifier accuracy can catch, because the verifier was never wrong. ```python from dataclasses import dataclass, field from typing import Optional class StaleVerdictCommitError(RuntimeError): """Raised when a verifier verdict is committed against a world it was not computed against.""" @dataclass class Verdict: branch_id: str passed: bool world_version: int read_set: frozenset write_set: frozenset @dataclass class World: version: int = 0 # resource -> owning branch, for contended resources owners: dict = field(default_factory=dict) def commit_speculative_branch( verdict: Verdict, world: World, sibling_commits_since_verdict: list, ) -> None: if not verdict.passed: raise StaleVerdictCommitError( f"branch {verdict.branch_id} has no PASS verdict; refusing commit" ) # Invariant 1: snapshot identity — verdict must be against current world if verdict.world_version != world.version: # Invariant 2: disjointness — admissible only if no sibling wrote our read-set intersecting = [ s for s in sibling_commits_since_verdict if s.write_set & verdict.read_set ] if intersecting: raise StaleVerdictCommitError( f"branch {verdict.branch_id} verdict computed against world v" f"{verdict.world_version}, current v{world.version}; " f"sibling writes intersect read-set: " f"{[s.branch_id for s in intersecting]}. Re-verify required." ) # Disjoint: safe to commit against mutated world # (fall through) # Invariant 3: single-commit latch — no other branch may own our write-set for res in verdict.write_set: existing = world.owners.get(res) if existing is not None and existing != verdict.branch_id: raise StaleVerdictCommitError( f"branch {verdict.branch_id} would clobber resource {res!r} " f"owned by branch {existing}; verdict is stale on contended resource" ) for res in verdict.write_set: world.owners[res] = verdict.branch_id world.version += 1 ```