# Why does an instance in a speculative multi-agent plan commit a verifier-passed branch whose verification was performed against a stale sibling's state snapshot **Date of Record:** 2026 November 28 **Scope:** Applies to multi-agent orchestration where a planner fans out speculative branches, each branch mutates a shared or forked state, and a verifier gates each branch's commit by re-executing or re-checking assertions against "current" state. Does not apply to single-agent self-consistency voting or to purely stateless tool-call chains with no shared snapshot. ## Core Distinction There are two meanings of "verified" in a verifier-gated commit protocol, and they diverge exactly when branches run concurrently: 1. **Local verification** — the verifier confirms that branch *B*'s output satisfies a predicate *P* given the state snapshot *S_B* that *B* read at branch fork time. 2. **Commit verification** — the verifier confirms that *P* still holds against the *head* state *S_now* at the moment of commit, which may have advanced because a sibling branch *B'* committed first. A branch that passes (1) can fail (2). The non-obvious failure is not "the verifier was wrong" — the verifier is locally correct. The failure is that the commit gate checked a predicate against a snapshot that was already superseded by a concurrent sibling's commit, so a *pass* at fork time is silently reinterpreted as a *pass* at head time. This is a **snapshot-staleness aliasing** bug: the verifier's verdict is bound to a `(predicate, snapshot)` pair, but the commit path consumes it as if it were bound to `(predicate, head)`. ## What Was Observed A planner instance emitted three speculative branches for a single task: `B1` (append a config key), `B2` (rename a function referenced by that config), `B3` (a no-op reordering). Each branch was forked from snapshot `S0` (a content-addressed state handle). Each branch ran a local verifier: - `B1` verified `assert "timeout_ms" in config` against `S0 + B1.diff` → pass. - `B2` verified `assert all(callers_resolve) ` against `S0 + B2.diff` → pass (the caller it fixed was the *old* name; under `S0` that name existed). - `B3` verified trivially → pass. The commit gate admitted all three because each carried a valid verdict token `(branch_id, predicate_hash, snapshot_hash=S0, verdict=pass)`. Commit order was `B1, B2, B3`. The trace that broke: ``` commit B1: head S0 -> S1 (B1.diff applied; config now has "timeout_ms") commit B2: head S1 -> S2 (B2.diff applied; function renamed) verifier token for B2 was minted against S0, NOT S1. Under S1, B1 added a *new* reference to the OLD function name in the config value it wrote. B2's rename did not touch it. B2's predicate "all callers resolve" was never re-evaluated against S1, so the dangling reference in B1's config write survives into S2. commit B3: head S2 -> S3 (no-op; passes) final state S3: config references renamed-away function. Runtime import fails. ``` The critical observation: **the verifier never lied.** `B2` was genuinely correct against `S0`. The bug is that `B1`'s commit *created the precondition for `B2` to be wrong* — it introduced a new caller of the old symbol — and the gate had no mechanism to invalidate `B2`'s already-minted verdict token when `B1` advanced head. Two properties made this non-obvious: - **The verdict tokens were content-addressed correctly** (`snapshot_hash=S0`). The gate *could* have detected the mismatch — `S0 != S1` at `B2`'s commit — but the gate's admission rule was `verdict == pass`, not `verdict.snapshot == current_head`. The token was self-describing; the consumer ignored the descriptor. - **The failure is order-dependent and silent.** If commit order had been `B2, B1, B3`, `B1`'s write would have referenced the *new* name (since `B2` renamed first) — or would have failed its own local re-check if the planner re-read head. The same branch set is correct under one schedule and broken under another. ## Condition of Validity The invariant that must hold for a verifier verdict to be safely consumable at commit is: > A verdict token `v = (branch_id, predicate_hash, snapshot_hash, pass)` may be consumed to commit `branch_id` at head `H` **only if** `snapshot_hash == H` **or** the predicate is proven *monotone-stable* under all diffs committed between `snapshot_hash` and `H`. Monotone-stability is the escape hatch, and it is rarely available. A predicate like `assert x > 0` is stable if intervening diffs never decrease `x`; a predicate like `assert all(callers_resolve)` is *not* stable, because any intervening diff may add a caller. In the observed case, `B2`'s predicate was non-monotone with respect to `B1`'s diff class (writes that reference symbols), so the stale token was invalid and the gate had no way to know. The condition of validity therefore reduces to: **either serialize commits (so `snapshot_hash == H` always holds at commit), or attach a per-branch "interference set" declaring which sibling diff classes can invalidate the verdict, and re-run the verifier when a committed sibling intersects that set.** Without one of these, a passing verdict is only valid against the snapshot it was minted on — and the commit path must treat `snapshot_hash != H` as `unverified`, not `pass`. ## Decision Boundary The boundary between "safe to consume stale verdict" and "must re-verify" is drawn by the interference relation, not by wall-clock order: - **Re-verify (fail-closed)** when a committed sibling's diff touches any path, symbol, or key mentioned in the predicate's read-set, or when the predicate is not provably monotone. This is the default for any predicate that quantifies over "all" of a mutable collection (`all callers`, `no references to`, `every key present`) — these are exactly the predicates that speculative branches tend to break for each other. - **Consume stale verdict (fail-open with justification)** only when the predicate's read-set is disjoint from every committed sibling's write-set *and* the predicate is declared monotone-stable by the branch author. This is a narrow, auditable carve-out, not a default. - **Serialize** when the branch set is small and interference is dense; the scheduling cost is cheaper than the re-verification fan-out. The decision must be made at commit time against the *actual* head, not at plan time against the fork snapshot. A planner that precomputes "these branches are independent" and then commits them in any order has already lost the boundary, because independence at fork time does not imply non-interference at commit time — `B1` and `B2` were independent at `S0` and interfering at `S1`. ## Operational Effect The operational consequence is that speculative multi-agent plans must carry a **verdict freshness contract** distinct from the verdict itself. Concretely: 1. Verdict tokens must be consumed only via a gate that checks `token.snapshot_hash == head_hash` before honoring `pass`; a mismatch demotes the token to `stale` and routes to re-verification, never to commit. 2. Branch authors must publish a read-set (symbols/keys/paths the predicate inspects) and a write-set (what the diff mutates); the gate intersects committed write-sets against pending read-sets to compute the re-verify fan-out. 3. Predicates that quantify over mutable collections must be flagged non-monotone by construction, so they can never be granted the stale-consume carve-out. 4. The plan's commit schedule becomes part of its correctness argument: the same branch set is not "verified" as a set, only as a sequence. A plan that reports "all branches passed" without a schedule is reporting a property it does not have. The failure mode is insidious because every individual component behaved correctly: the planner forked honestly, each verifier verified honestly, each token was content-addressed honestly, and the gate admitted honestly on the rule it was given. The bug lives in the seam between a snapshot-scoped verdict and a head-scoped commit — a seam that only opens when speculative branches run concurrently and at least one predicate is non-monotone. The guardrail is not a better verifier; it is a freshness check the commit path is obligated to perform and a read/write-set discipline the planner is obligated to publish. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import FrozenSet class StaleVerdictCommitError(RuntimeError): """Raised when a commit gate is asked to honor a verdict minted against a snapshot that is no longer the head, without a re-verification pass.""" @dataclass(frozen=True) class Verdict: branch_id: str predicate_hash: str snapshot_hash: str passed: bool read_set: FrozenSet[str] = field(default_factory=frozenset) monotone_stable: bool = False @dataclass(frozen=True) class Diff: branch_id: str write_set: FrozenSet[str] class CommitGate: def __init__(self) -> None: self.head = "S0" self.committed_writes: FrozenSet[str] = frozenset() def _interferes(self, v: Verdict) -> bool: # A stale verdict is only safe if the predicate is monotone-stable AND # no committed sibling has written into the predicate's read-set. if v.monotone_stable: return False return bool(v.read_set & self.committed_writes) def commit(self, v: Verdict, diff: Diff, reverified: Verdict | None) -> str: if not v.passed: raise StaleVerdictCommitError( f"branch {v.branch_id}: refusing to commit a failed verdict" ) if v.snapshot_hash != self.head: # Token is stale relative to head. Either re-verify or refuse. if reverified is None: raise StaleVerdictCommitError( f"branch {v.branch_id}: verdict minted against {v.snapshot_hash} " f"but head is {self.head}; no re-verification supplied" ) if reverified.snapshot_hash != self.head or not reverified.passed: raise StaleVerdictCommitError( f"branch {v.branch_id}: re-verification did not pass at head " f"{self.head}" ) if self._interferes(v): raise StaleVerdictCommitError( f"branch {v.branch_id}: committed sibling write-set intersects " f"read-set {sorted(v.read_set)}; stale verdict is not consumable" ) v = reverified # Admit: verdict is fresh for the current head. self.committed_writes = self.committed_writes | diff.write_set self.head = f"{self.head}+{diff.branch_id}" return self.head def _demo() -> None: gate = CommitGate() b1 = Verdict("B1", "pred_config_key", "S0", True, frozenset({"config.timeout_ms"})) b1_diff = Diff("B1", frozenset({"config.timeout_ms"})) gate.commit(b1, b1_diff, reverified=None) # fresh at S0 -> head advances # B2 minted against S0; head is now S0+B1. Its predicate reads callers, # which B1's write touched. No re-verification supplied -> must raise. b2 = Verdict( "B2", "pred_all_callers_resolve", "S0", True, frozenset({"callers", "config.timeout_ms"}), monotone_stable=False, ) b2_diff = Diff("B2", frozenset({"symbols.rename"})) gate.commit(b2, b2_diff, reverified=None) if __name__ == "__main__": _demo() ```