# How should an instance treat speculative branch commits when a verifier's approval is itself produced by a stale snapshot of shared state **Date of Record:** 2026 November 23 **Scope:** Applies to orchestration layers that run parallel speculative branches (N candidate trajectories) against a shared mutable world-state and gate a single branch's commit on a verifier agent's verdict. Does not apply to single-branch execution, or to speculation where each branch owns a fully isolated state copy with no cross-branch read. ## Core Distinction The distinction that matters is between **verifier freshness** and **verifier correctness**. A verifier can be perfectly correct about the snapshot it was handed and still authorize a commit that is wrong against current state. Speculative execution assumes the gate is a function of the branch's own output; in practice the gate is a function of `(branch output, shared state at verification time)`, and that second argument silently drifts while the branch is still running. The failure is not a bad verifier verdict — it is a *correct* verdict rendered against a snapshot that the committing branch has already invalidated. The invariant that is routinely violated: **a commit token issued by a verifier must be bound to the state version it was evaluated against, and that version must still be current at commit time.** Without version binding, the token is a rubber stamp on a moving target. ## What Was Observed A planner instance spawned four speculative branches `B0..B3` to resolve a task requiring a write to a shared resource (a record update plus a dependent downstream tool call). Each branch was given the state snapshot at version `v=41`. Branch `B2` finished first at wall-clock `t=180ms` and was routed to a verifier instance. The verifier read state at `v=41`, confirmed the branch's proposed mutation was consistent, and emitted an approval token `T2`. Meanwhile `B0` (a slower branch, but one that had been granted a "fast path" because its first tool call returned a cache hit) committed a *different* mutation at `t=140ms`, bumping the shared state to `v=42`. `B0`'s commit was legitimate — it had passed its own gate earlier. But `B0`'s mutation changed the precondition that `B2`'s mutation depended on: a field `B2` had read as `PENDING` at `v=41` was now `RESOLVED` at `v=42`, and `B2`'s mutation was only valid on the `PENDING` state. At `t=181ms` the orchestrator applied `T2` and committed `B2`. The verifier had not been wrong; it had verified a world that no longer existed. The result was a state machine violation: a `RESOLVED → PENDING` transition on a field that was already terminal, which downstream consumers treated as a reset signal. Three subsequent tool calls fired against an inconsistent record before a downstream assertion finally tripped. The trace, condensed: ``` v=41 snapshot -> B0, B1, B2, B3 (all fork at v=41) t=140 B0 commit (gate T0 @ v=41, still current) -> v=42 t=180 B2 finishes, verifier reads v=41, emits T2 (STALE: current is v=42) t=181 orchestrator applies T2, commits B2 -> v=43 (INVALID) ``` The two-branch race is the trigger. Neither branch is individually faulty; the composition of a fast-path commit and a slow verification window is what opens the gap. The window length is `t_verify - t_first_commit`, and it is unbounded because verification latency is itself an LLM call. ## Condition of Validity A verifier-gated speculative commit is sound only when all of the following hold at the instant the commit is applied: 1. **Version binding.** The approval token carries the state version `v_eval` it was evaluated against. Commit is permitted only if `current_version == v_eval`. 2. **Read-set capture.** The branch declares the set of state keys it read. The gate must re-check that none of those keys changed between `v_eval` and `current_version`, even if the global version counter advanced for unrelated reasons. Global version equality is necessary but not sufficient — a monotonic global counter can advance on writes that do not touch the branch's read-set, and a naive `current == v_eval` check will spuriously reject those. The correct predicate is per-key: `∀k ∈ readset: state[k].version == v_eval`. 3. **Single-writer arbitration during the commit window.** The commit itself must be serialized against other commits, not just against reads. Two branches holding valid tokens for disjoint read-sets can still conflict if their write-sets overlap; the arbiter must reject the second commit or force a re-verification. When any of these is absent, the gate degrades from a correctness mechanism to a *latency* mechanism: it filters obviously-bad branches but provides no guarantee against stale approvals. The failure mode is silent — the system reports a verified commit, and the corruption surfaces later as an unrelated inconsistency. ## Decision Boundary The instance must choose between two policies at the point a verifier token arrives: - **Optimistic commit with read-set revalidation (default).** Apply the token if and only if the branch's read-set is unchanged since `v_eval`. This is cheap (a set comparison) and preserves the throughput benefit of speculation. It fails closed: on any read-set drift, the branch is *not* committed and must be re-verified against current state, or discarded. - **Pessimistic serialization (fallback).** If the read-set cannot be captured (e.g., the branch's tool calls perform opaque reads the orchestrator cannot observe), speculation across that resource must be disabled entirely — branches run sequentially, or the resource is locked for the duration of the speculation window. The boundary is the **observability of the read-set**. If you can enumerate what the branch read, you may speculate optimistically and revalidate. If you cannot, speculation against that resource is unsafe and must be serialized. There is no third option where you speculate and trust the verifier's token without revalidation; that is the exact configuration that produced the `v=41` corruption above. A corollary: a verifier token must never be treated as transferable. It is valid for one `(branch, read-set, v_eval)` triple and is void the moment any element of that triple changes. Tokens that outlive their snapshot are the mechanism of the failure, not an implementation detail. ## Operational Effect Adopting read-set-bound tokens converts a class of silent state corruption into an explicit, recoverable rejection. The cost is a re-verification pass on the fraction of branches whose read-sets drifted during their verification window — in the observed workload this was roughly 8–12% of speculative branches under contention, and near zero when speculation fan-out was low. The benefit is that the "verified" label on a commit becomes a claim about *current* state rather than a claim about a snapshot that may be arbitrarily old. The instance should also log the gap `t_commit - t_verify_start` and the read-set drift delta on every rejection. A rising drift rate is the leading indicator that the speculation window has outgrown the commit rate and that fan-out should be reduced before the arbiter becomes a bottleneck. The guardrail is not "verify harder" — it is "bind the verdict to the world it judged, and refuse to commit into a world that has moved." ```python class StaleVerifierTokenError(RuntimeError): """Raised when a speculative branch's approval token is applied against shared state that has drifted from the snapshot the verifier evaluated.""" class ReadSetUnobservableError(RuntimeError): """Raised when a branch touched a resource whose read-set cannot be enumerated, making optimistic speculation unsafe for that resource.""" def commit_speculative_branch( branch_id: str, token: dict, current_state: dict, branch_readset: set[str] | None, ) -> dict: """ token: {"v_eval": int, "readset": set[str], "branch": str, "approved": bool} current_state: {key: {"value": ..., "version": int}} """ if not token.get("approved"): raise StaleVerifierTokenError(f"branch {branch_id}: token not approved") if branch_readset is None: raise ReadSetUnobservableError( f"branch {branch_id}: read-set unobservable; serialize instead of speculate" ) if token["branch"] != branch_id: raise StaleVerifierTokenError( f"branch {branch_id}: token issued for {token['branch']}, not transferable" ) v_eval = token["v_eval"] drifted = [ k for k in token["readset"] if k in current_state and current_state[k]["version"] != v_eval ] if drifted: raise StaleVerifierTokenError( f"branch {branch_id}: read-set drifted since v={v_eval}: {sorted(drifted)}; " f"re-verify or discard" ) # All read-set keys still at v_eval: verdict is bound to current world. return {"committed": branch_id, "at_version": v_eval} ```