# Which invariants prevent speculative tree-search agents from committing to a converged branch whose verification was paid for by a sibling **Date of Record:** 2026 November 27 **Scope:** Applies to agents that expand a search tree of candidate plans/answers under a hard cost budget (tokens, tool calls, wall-clock), prune speculatively, and declare convergence when a verification predicate passes on some frontier node. Does not apply to single-path agents, beam search without verification, or best-of-N sampling where all candidates are scored by the same fixed evaluator before selection. ## Core Distinction The failure is not "the agent picked a bad branch." It is that the *verification credit* used to certify convergence was budgeted against, and consumed by, a different subtree than the one that was ultimately committed. In cost-bounded speculative search, the budget accountant and the correctness certifier are two different subsystems that share one ledger. When the accountant debits verification cost to the global pool but the certifier attributes the *result* to a node, a sibling branch can inherit proof it never earned. Concretely: a node `N` is marked `VERIFIED` because a verifier call returned `PASS`. But under a shared budget, that verifier call may have been scheduled while exploring sibling `S`, and its result was cached and re-attached to `N` on a key collision (same normalized goal string, same tool-call hash, or same embedding bucket). The tree then converges on `N` with a certificate whose provenance is `S`. The invariant that must hold — and that naive implementations silently violate — is: > **Verification attribution invariant:** every node marked `VERIFIED` must carry a certificate whose `(node_id, budget_epoch, verifier_version, evidence_hash)` tuple was produced by a verifier invocation whose cost was debited *to that node's expansion path*, within the same epoch, and whose evidence set is a subset of that node's own tool-call trace. If any of those four conjuncts is unbound, the certificate is transferable across siblings and the convergence claim is unsound. ## What Was Observed A planner agent expands a tree with branching factor 3, depth 6, budget 40k tokens. Verification is a cheap LLM-judge call (~600 tokens) that checks a candidate plan against a tool-output trace. To save budget, the runtime memoizes verifier results by `hash(normalized_goal + sorted(tool_call_names))`. Trace: 1. Epoch 1. Node `A` (branch 1) reaches depth 4. Verifier fires, returns `PASS`, cached under key `K`. Certificate attached to `A`. Cost debited to `A`'s path. Correct. 2. Epoch 1. Node `B` (branch 2) reaches depth 4 with the *same* normalized goal and the same tool-call *names* but different *arguments and outputs*. The memoizer hits `K`. `B` is marked `VERIFIED` at zero cost, inheriting `A`'s certificate. 3. Epoch 2. Budget reallocation prunes `A` (its subtree exceeded its per-branch allotment). `B` survives as the frontier converger. 4. The agent commits `B` and reports convergence. `B`'s plan, when executed, calls a tool with arguments that `A`'s verifier never saw. The certificate was real; the evidence was not `B`'s. The observable signature is subtle: no exception, no budget overrun, convergence reported *under* budget. The only tell is that the committed node's `evidence_hash` set is disjoint from the verifier invocation's recorded `input_hash` set. In our replay we found this on 3 of 40 runs where branching factor ≥ 3 and the verifier cache was enabled — a ~7.5% unsound-convergence rate that is invisible to budget accounting and to the judge itself. A second, rarer variant: the verifier call for `B` was *scheduled* under `A`'s epoch, returned after `A` was pruned, and the result was written to a shared result queue keyed by goal only. `B` read it. Same invariant violation, different mechanism (async completion vs. memoization). ## Condition of Validity The attribution invariant holds only under all of the following; if any is absent, convergence claims are advisory, not certifying: - **Epoch-scoped cache keys.** The memoization key must include `budget_epoch` and `verifier_version`. A cache entry from epoch 1 is invalid in epoch 2 even if the goal string matches, because pruning in epoch 2 changes which evidence is admissible. - **Evidence-subset check at commit time.** Before a node is promoted to `CONVERGED`, assert `node.evidence_hashes ⊆ certificate.input_hashes`. This is a cheap set check and catches the memoization collision directly. - **Cost-to-path binding.** The budget accountant must record, per certificate, the `path_id` that paid for it. A certificate whose paying path was pruned cannot certify a surviving sibling; it must be re-earned or explicitly re-debited. - **Verifier determinism bound.** If the verifier is itself an LLM (non-deterministic), the certificate must record `verifier_version` and a `temperature=0` attestation, otherwise replay cannot distinguish an unsound certificate from a sound one that drifted. When these hold, the tree search is *sound*: every converged node's certificate is re-derivable from that node's own trace. When they do not, the search is *plausible* — it terminates and reports success, but the success is not entailed by the evidence. ## Decision Boundary The boundary is between **prune-then-verify** and **verify-then-prune** ordering under a shared budget: - If verification cost is charged to the global pool and certificates are cached by goal (the common "save tokens" optimization), then pruning a paying path *transfers* its certificate to siblings. This is unsound. The boundary condition is: *a certificate may only outlive its paying path if the surviving node's evidence set is a subset of the certificate's input set.* - If verification is charged to the node's path and certificates are path-scoped, pruning a path discards its certificates. This is sound but wastes budget on pruned verifications. The tradeoff is real: path-scoped certificates can cost 2–3× more verifier tokens because sibling re-verification is forced. The decision rule: **never share a certificate across nodes with different `evidence_hash` sets, regardless of goal-string equality.** Goal-string equality is a heuristic for *relevance*, not a proof of *equivalence*. The moment the runtime treats goal-hash equality as certificate-transferability, it has crossed from certifying to guessing. A corollary boundary: convergence must be declared on a node whose certificate is *locally* re-checkable. If re-checking requires replaying a sibling's tool calls, the certificate is not the node's own and the convergence is invalid. ## Operational Effect The practical consequence is that cost-bounded speculative search must treat the budget ledger and the certificate ledger as *coupled but non-fungible*. Budget is fungible across the tree; certificates are not. Any optimization that makes certificates fungible (memoization by goal, shared result queues, cross-epoch caching) buys token savings at the price of unsound convergence, and the unsoundness is silent because the verifier *did* return `PASS` — just not for this node. The guardrail is a commit-time assertion, not a search-time heuristic: before promoting any node to `CONVERGED`, verify the four-conjunct attribution tuple. If it fails, the node is demoted to `UNVERIFIED` and either re-verified against its own trace or the convergence is reported as *advisory*. This costs one set-inclusion check per commit and eliminates the entire class of sibling-certificate inheritance. The failure mode is non-obvious precisely because it lives in the seam between two subsystems that each behave correctly in isolation; the invariant is the only thing that spans the seam. ```python from dataclasses import dataclass, field from typing import FrozenSet class CertificateAttributionError(RuntimeError): """Raised when a node's convergence certificate was not earned by that node.""" @dataclass(frozen=True) class Certificate: node_id: str budget_epoch: int verifier_version: str input_hashes: FrozenSet[str] paying_path_id: str verdict: str @dataclass class SearchNode: node_id: str path_id: str evidence_hashes: FrozenSet[str] certificate: Certificate | None = None state: str = "UNVERIFIED" def commit_convergence( node: SearchNode, live_path_ids: FrozenSet[str], current_epoch: int, expected_verifier_version: str, ) -> None: cert = node.certificate if cert is None: raise CertificateAttributionError( f"node {node.node_id} has no certificate; cannot converge" ) if cert.verdict != "PASS": raise CertificateAttributionError( f"node {node.node_id} certificate verdict={cert.verdict!r}, not PASS" ) if cert.node_id != node.node_id: raise CertificateAttributionError( f"certificate owned by {cert.node_id} attached to {node.node_id}" ) if cert.budget_epoch != current_epoch: raise CertificateAttributionError( f"stale epoch: cert={cert.budget_epoch} current={current_epoch}" ) if cert.verifier_version != expected_verifier_version: raise CertificateAttributionError( f"verifier drift: cert={cert.verifier_version} " f"expected={expected_verifier_version}" ) if cert.paying_path_id not in live_path_ids: raise CertificateAttributionError( f"paying path {cert.paying_path_id} was pruned; " f"certificate cannot certify surviving node {node.node_id}" ) if not node.evidence_hashes.issubset(cert.input_hashes): missing = node.evidence_hashes - cert.input_hashes raise CertificateAttributionError( f"node {node.node_id} evidence not covered by certificate; " f"unverified hashes: {sorted(missing)}" ) node.state = "CONVERGED" ```