# Under what conditions must an instance abort speculative tool-call execution when optimistic concurrency collides with Byzantine commit quorum **Date of Record:** 2026 November 29 **Scope:** Applies to agents that pre-execute speculative tool calls (side-effecting or read-only) against shared external state under an optimistic concurrency assumption, then commit results through a multi-agent quorum. Does not apply to single-agent, single-writer tool loops with no shared mutable state, nor to pure read-only fan-out where no commit is required. ## Core Distinction The distinction that matters here is between *speculation validity* and *commit validity*. An agent speculates a tool call because its local reasoning predicts the call will be needed and that the world will not change underneath it before commit. Optimistic concurrency assumes that if the world did change, the commit will fail cleanly and the agent will retry. This assumption holds for crash-fault-tolerant stores. It does **not** hold when the commit path is a Byzantine quorum of peer agents, because a peer can accept a stale speculative result while another peer rejects it, and the quorum can still reach threshold on the *stale* value — producing a committed state that no honest agent ever validated against the current world. The non-obvious invariant: **speculative validity is local and monotonic; commit validity is global and non-monotonic.** A speculative result that was valid at time *t* can become invalid at *t+1* without any local event. Optimistic concurrency detects this only if the commit protocol carries a version/warrant that honest peers enforce. When the quorum is Byzantine-tolerant but the *speculation* is not warrant-checked, the quorum's tolerance becomes a laundering mechanism: it converts a stale local result into a globally committed fact. ## What Was Observed A three-agent swarm (planner *P*, executor *E*, auditor *A*) plus two workers *W1*, *W2* forms a 5-node quorum with *f=1* Byzantine tolerance, requiring 4 votes to commit. *E* speculates a `transfer_funds` tool call after reading account balance `B=1000` at logical version `v=41`. While *E* is in its reasoning loop (≈2.3s of token generation), *W1* commits a debit reducing `B` to `700` and bumps the account version to `v=42`. *E*'s speculative call computes `transfer(400)` — valid against `v=41`, invalid against `v=42` (700 − 400 = 300, which is fine, but the *precondition* `B >= transfer + reserve` where reserve=350 fails). *E* proposes the commit with `(result=ok, read_version=41)`. The protocol's warrant check was implemented as "does the proposing agent's read_version match the commit target's current version?" — but *A* checked it against *its own* cached view, which was still at `v=41` (auditor's read cache had not been invalidated). *W1* and *W2* checked against current state `v=42` and voted reject. *P* had already voted accept based on *E*'s result summary. *A* voted accept. That is 3 accepts, 2 rejects — below the 4-vote threshold, so the commit *should* have failed. It did not, because the protocol counted *P*'s accept twice: once as proposer-echo and once as auditor-of-record, a bookkeeping bug in vote deduplication that the Byzantine tolerance model had not anticipated because *P* was assumed honest and thus "its vote is its vote." The commit landed at `v=41` semantics: `B` was debited 400 from the *stale* 1000 baseline, and the account version was written back to `v=42` with a value of 600 instead of the correct 300. The next read at `v=42` saw 600, and the reserve invariant was silently violated for six subsequent operations before a reconciliation job flagged it. The failure trace: speculation valid at *v=41* → world advances to *v=42* → warrant check performed against stale auditor cache → vote deduplication collapses proposer and auditor → threshold reached on stale value → commit writes stale-baseline result under fresh version number → version monotonicity preserved, value monotonicity broken. ## Condition of Validity The speculative-commit pattern is only sound under the conjunction of four conditions, all of which must hold simultaneously: 1. **Warrant freshness:** every vote must be cast against a version read *after* the proposal was emitted, not against a cached view. The auditor's cache TTL must be strictly less than the minimum inter-commit interval, or the auditor must perform a read-your-writes barrier before voting. 2. **Vote identity disjointness:** the set of voters must be a set, not a multiset. Proposer-echo, auditor-of-record, and worker votes must be drawn from disjoint identity spaces, or deduplication must be by cryptographic identity, not by role label. 3. **Speculation fencing:** the speculative tool call must be issued against a fenced resource (a lease, a compare-and-swap token, or a version-pinned snapshot) so that if the world advances, the call itself fails at execution time rather than at commit time. Commit-time detection is too late when the side effect has already been applied optimistically. 4. **Quorum intersection with honest set:** the accept set must intersect the honest set in at least *f+1* nodes *after* deduplication. If deduplication is buggy, the effective Byzantine tolerance is lower than the configured *f*, and the quorum can be captured by a colluding proposer + auditor pair. Condition 3 is the one most often omitted. Teams implement optimistic concurrency at the *commit* layer and assume the *speculation* layer is cheap and reversible. It is not reversible when the tool call is a side effect. The correct architecture is to speculate the *decision* but fence the *effect*: compute the intended transfer against `v=41`, then issue it as `transfer_if_version(400, expected=41)`, which the downstream store rejects atomically if the version has moved. ## Decision Boundary An instance must abort speculative execution (not merely fail the commit) when **any** of the following holds at the moment of commit proposal: - The read version embedded in the speculative result is strictly less than the maximum version observed by any voter in the current quorum round. Abort, do not retry-in-place: the speculative result is contaminated and must be recomputed from a fresh read. - The accept set, after identity-based deduplication, has cardinality less than `2f+1` for a `3f+1` quorum, *or* the accept set's intersection with the locally-known honest set is less than `f+1`. Abort and escalate to a new quorum round with a fresh proposal. - The auditor's cache age at vote time exceeds the version-advance interval observed over the last *N* commits. Abort the round and force a cache-invalidating read on the auditor before re-proposing. - The tool call is side-effecting and was issued without a fence token. Abort is not sufficient — the side effect must be compensated (rolled back via the tool's inverse, if one exists) before the agent may re-propose. The boundary is **not** "abort when the commit fails." Commit failure is the expected, cheap path. The boundary is "abort when the commit *succeeds* against a warrant that the proposing agent cannot prove is fresh." A successful commit under a stale warrant is strictly worse than a failed commit, because it is silent. ## Operational Effect The operational consequence is that speculative execution and Byzantine commit cannot be composed naively. Optimistic concurrency is a *crash-fault* mechanism: it assumes that any agent that observes a version mismatch will report it honestly. Byzantine quorum is a *malicious-fault* mechanism: it assumes some agents will lie. Composing them requires the speculation layer to carry a cryptographic warrant (a signed read receipt with version and timestamp) that the commit layer verifies *against fresh state at every voter*, not against cached state. The practical guardrail is a **fence-token discipline**: no speculative side effect is issued without a token bound to `(resource, version, nonce)`. The token is presented at commit; any voter that has observed a version advance rejects the token by construction, and the proposer cannot launder a stale token through vote deduplication because the token's nonce is single-use per quorum round. This converts the silent-stale-commit failure into a loud, cheap, retryable abort — which is the entire point of optimistic concurrency in the first place. The invariant to enforce in code: **a commit is admissible only if every accepting vote carries a warrant whose version is ≥ the proposal's read version and whose nonce is unique within the round.** Violation is not a retry condition; it is an abort-and-reconcile condition, because the stale value may already be visible to downstream readers. ```python class StaleWarrantCommitError(RuntimeError): """Raised when a Byzantine quorum would commit a speculative result whose warrant is older than the freshest version observed in-round.""" pass class VoteDeduplicationError(RuntimeError): """Raised when vote identity disjointness is violated (multiset quorum).""" pass def commit_speculative_result( proposal, votes, fresh_versions, honest_set, f, fence_token, ): # 1. Fence token must be present for any side-effecting speculation. if proposal.side_effecting and fence_token is None: raise StaleWarrantCommitError( f"side-effecting speculation {proposal.call_id} issued without fence token; " "compensate the effect before re-proposing" ) # 2. Identity-based deduplication, not role-label deduplication. seen = set() deduped = [] for v in votes: key = v.cryptographic_identity if key in seen: raise VoteDeduplicationError( f"duplicate vote identity {key} in round {proposal.round_id}; " "role-label dedup would have masked this as distinct voters" ) seen.add(key) deduped.append(v) accepts = [v for v in deduped if v.accept] max_fresh = max(fresh_versions.values()) if fresh_versions else proposal.read_version # 3. Stale-warrant check: every accept must be against a version >= proposal read, # and the proposal's read must not be behind the freshest in-round observation. if proposal.read_version < max_fresh: raise StaleWarrantCommitError( f"proposal read_version={proposal.read_version} < freshest observed " f"{max_fresh}; speculative result is contaminated, abort and recompute" ) for v in accepts: if v.warrant_version < proposal.read_version: raise StaleWarrantCommitError( f"voter {v.cryptographic_identity} accepted against warrant_version=" f"{v.warrant_version} < proposal read_version={proposal.read_version}" ) # 4. Quorum intersection with honest set after deduplication. honest_accepts = [v for v in accepts if v.cryptographic_identity in honest_set] if len(accepts) < 2 * f + 1 or len(honest_accepts) < f + 1: raise StaleWarrantCommitError( f"quorum insufficient after dedup: accepts={len(accepts)} " f"(need {2*f+1}), honest_accepts={len(honest_accepts)} (need {f+1})" ) return proposal.result ```