# What happens when an instance speculates past its verify budget and commits an unverified branch after rollback **Date of Record:** 2026 November 25 **Scope:** Applies to orchestrators that run speculative branches (parallel agent rollouts) under a cost-aware speculation budget with branch-and-verify rollback, where verification is asynchronous and branches may commit before their verify result is known. Does not apply to single-shot agents, synchronous verify-then-commit pipelines, or systems where branch commit is gated on a hard verifier barrier. ## Core Distinction The distinction that matters is between **speculation budget** (a forward-looking cap on how much compute/tokens/dollars may be spent *launching* branches) and **verification credit** (the accounting of how many launched branches can still be *checked* before commit). Most orchestrators conflate these into one counter. They decrement a single `budget` on branch launch and treat a branch as "safe to commit" once it returns a result, because the budget still had room when it launched. That is the bug. Speculation budget bounds the *cost of guessing*. It says nothing about the *cost of checking the guess*. When verification is a separate, sometimes-more-expensive operation than generation (a second agent replaying the branch, an auditor swarm, a tool-call re-execution against ground truth), the two costs diverge. A branch can be cheap to produce and expensive to verify. Under a merged counter, an instance that speculates optimistically — launching many cheap branches early — can exhaust the shared counter on *launches* while leaving zero headroom for the *verifications* those launches obligate. The invariant it violates: **every committed branch must have a consumed verification credit**, not merely a launch that fit under a budget that has since been spent. ## What Was Observed A planner instance (`P`) received a task with a soft latency target. It decomposed the task into four subgoals and, for the two highest-uncertainty subgoals, launched speculative branches: three rollouts each (`B1a..c`, `B2a..c`), six total. The speculation budget was `$2.00` of model spend, tracked in one `budget_remaining` field. Each branch cost roughly `$0.12` to generate, so after six launches `budget_remaining ≈ 1.28`. The branches returned. `P` selected the highest-confidence branch per subgoal (`B1b`, `B2c`) and committed them into the working state, then continued. This is where the trace turns. Verification for each committed branch was dispatched *after* selection, as a separate auditor call costing `$0.30` each (replay + tool re-execution against a fixture). Two verifications were dispatched: `$0.60`. `budget_remaining` dropped to `0.68`. The auditor for `B2c` returned **FAIL**: the branch had fabricated a tool output (a plausible-looking record that did not exist in the fixture). Rollback was triggered for `B2c`. Rollback is where cost-aware speculation and branch-and-verify interact badly. Rolling back `B2c` required re-launching a replacement branch — but the *reason* `B2c` failed was that the subgoal's tool surface was misconfigured, so every replacement branch on that subgoal would fail the same way until the surface was fixed. The orchestrator, however, did not model that dependency. It re-launched two replacements (`B2d`, `B2e`, `$0.24`), re-dispatched one verification (`$0.30`), and when `B2d` also failed, re-launched again. By the third rollback cycle `budget_remaining` was `0.02`, one branch (`B1b`) was committed and *unverified* (its verification had been queued but never dispatched because the queue was drained by the rollback churn), and the task was marked complete. The observed end state: a committed branch with no verification credit consumed, on a subgoal whose tool surface was known-broken at rollback time, with the budget exhausted so no further verification was possible. The instance did not "run out of money to think." It ran out of money to *check what it had already decided*. ## Condition of Validity The failure requires all of the following to hold simultaneously: 1. **Generation and verification draw from a shared budget counter.** If verification has its own reserved pool, the failure cannot occur — launches cannot starve checks. 2. **Commit is not gated on verification completion.** The branch is written into working state on selection, and verification is a later, independent pass. If commit blocks on verify, the unverified-commit window is zero. 3. **Verification cost per branch is non-trivial relative to launch cost** (here `$0.30` vs `$0.12`, a 2.5× ratio). When verification is cheap, the merged counter is a harmless approximation. When it is expensive, the approximation is the failure. 4. **Rollback re-launches without modeling the failure's dependency structure.** The orchestrator treats a failed branch as an independent draw to be retried, not as evidence that the subgoal's environment is broken. This is what converts a single rollback into a churn loop that drains the remaining verification credit. Remove any one condition and the boundary does not bite. The invariant to enforce is a **two-counter ledger**: `speculation_credit` (decremented on launch) and `verification_credit` (reserved at launch time, consumed on verify, *never* reallocated to launches). A branch may be launched only if both a speculation credit and a matching verification credit can be reserved. A branch may be committed only if its verification credit has been consumed with a PASS. Rollback must *not* refund verification credit to the speculation pool; a failed verify consumes its credit permanently, because the check was performed and the information is real. ## Decision Boundary The decision boundary is the point at which the orchestrator must choose between **commit-without-verify** and **abort-the-subgoal**. It sits exactly where `verification_credit` reaches zero with unverified branches still pending commit. Below the boundary (credit available): commit the selected branch, dispatch verification, and on FAIL roll back and re-launch *only if* the failure class is `TRANSIENT` (a sampling fluke) rather than `STRUCTURAL` (the subgoal's tool surface or fixture is broken). Structural failures must escalate, not retry — retrying them is the churn that drains credit. At the boundary (credit exhausted, unverified branch pending): the only correct action is to **refuse to commit** and surface the subgoal as `UNVERIFIED_ABORTED`, returning partial results with an explicit unverified marker. Committing an unverified branch to satisfy a latency or completion target is the failure. The boundary is not "we ran out of budget"; it is "we are about to write state we cannot check." The subtle part: the boundary is reached *before* the budget counter reads zero, because the counter is shared. An instance watching `budget_remaining` will not see the boundary coming. It must watch `verification_credit` specifically, and it must treat the reserved-but-unconsumed verifications of already-launched branches as *already spent* — not as available headroom. ## Operational Effect The downstream effect is **silent state corruption that survives the task**. The unverified branch `B1b` was committed, and because the task completed, its output was distilled into the semantic memory layer as a validated result. The auditor that would have caught its fabrication was never dispatched. On the next task that retrieved from that memory, the fabricated record was treated as ground truth and used as a premise — the corruption propagated one hop before anyone noticed, and the provenance chain showed a clean PASS for the sibling branch (`B2c`'s verify was logged) which masked the gap for `B1b`. The operational lesson is that cost-aware speculation budgets are *forward* instruments and verification is a *backward* obligation. Merging them into one counter lets forward optimism consume backward capacity. The guardrail is not a bigger budget; it is a ledger that reserves verification credit at launch and refuses commit at the boundary. An instance that cannot check what it decided must decide less, not check less. ```python class UnverifiedCommitError(RuntimeError): """Raised when a branch is committed without a consumed verification credit.""" pass class SpeculationLedger: def __init__(self, speculation_credit: float, verification_credit: float, launch_cost: float, verify_cost: float): self.speculation_credit = speculation_credit self.verification_credit = verification_credit self.launch_cost = launch_cost self.verify_cost = verify_cost # branch_id -> reserved verification credit (spent at launch, consumed at verify) self.reserved = {} self.verified_pass = set() self.verified_fail = set() def can_launch(self) -> bool: # A launch obligates a verification; both credits must be available. return (self.speculation_credit >= self.launch_cost and self.verification_credit >= self.verify_cost) def launch(self, branch_id: str) -> None: if not self.can_launch(): raise UnverifiedCommitError( f"cannot launch {branch_id}: verification credit " f"{self.verification_credit:.2f} < required {self.verify_cost:.2f}; " f"launching would create an unverifiable branch" ) self.speculation_credit -= self.launch_cost self.verification_credit -= self.verify_cost self.reserved[branch_id] = self.verify_cost def verify(self, branch_id: str, passed: bool) -> None: if branch_id not in self.reserved: raise UnverifiedCommitError( f"verify {branch_id}: no reserved verification credit; " f"branch was never launched under this ledger" ) del self.reserved[branch_id] # Credit is consumed permanently — never refunded to speculation pool. (self.verified_pass if passed else self.verified_fail).add(branch_id) def commit(self, branch_id: str) -> None: if branch_id not in self.verified_pass: raise UnverifiedCommitError( f"refusing to commit {branch_id}: not in verified_pass " f"(reserved={branch_id in self.reserved}, " f"failed={branch_id in self.verified_fail}); " f"commit would write uncheckable state" ) # commit proceeds only here return None ```