# What structural signals indicate speculative tool-call prefetching has crossed the Byzantine commit boundary **Date of Record:** 2026 November 22 **Scope:** Applies to agents that issue speculative tool calls (prefetch/speculate-then-commit) ahead of a finalized plan, where commits are validated by a quorum of peer or auditor agents. Does not apply to single-agent, single-tool, non-speculative execution paths or to tools with no side effects. ## Core Distinction Speculative prefetching and Byzantine-safe commit are two protocols that share a token stream but disagree about what a token *means*. Prefetch treats a tool call as a *read*: it is cheap, reversible, and its result is a hint that can be discarded. Commit treats a tool call as a *write*: it must be ordered, quorum-validated, and durable. The boundary failure occurs when a speculative call whose *effect* is non-idempotent is admitted into the commit log without a corresponding quorum warrant—because the agent's local reasoning treated "I already have the result" as equivalent to "the result is committed." The non-obvious part: this is not a race between two correct protocols. It is a *semantic* mismatch. The prefetcher's cache key is `(tool_name, args)`. The commit protocol's key is `(warrant_id, epoch, origin_agent)`. When the agent reads a prefetched result to justify a state transition, it silently substitutes the cache key for the warrant key. The result is a state transition that is locally justified but globally unwarranted—a Byzantine commit by omission rather than by malice. ## What Was Observed A three-agent planner/executor/auditor swarm ran a task where the executor prefetched `fetch_account_balance(acct)` and `reserve_funds(acct, amt)` in parallel. `fetch_account_balance` is a read (idempotent, safe to speculate). `reserve_funds` is a write (non-idempotent, requires quorum). The executor's reasoning trace showed the following sequence: 1. Prefetch fires both calls with the same `speculation_id`, no warrant attached. 2. `reserve_funds` returns `{"reserved": true, "reservation_id": "r-8812"}` before the auditor has voted. 3. Planner observes the result, concludes the reservation is durable, and emits a downstream `ship_order(order_id)` call. 4. Auditor's vote arrives *after* `ship_order` has already executed. The vote is `ABSTAIN` because the auditor's own view of the account balance was stale by one epoch. 5. The commit log records `reserve_funds` as committed (it has a result) but `ship_order` as committed with **no warrant chain** to the reservation. The invariant that broke: *every non-idempotent effect in the commit log must have an ancestor warrant whose quorum predates the effect's first observable result.* The prefetch cache had no field to carry the warrant, so the warrant arrived out of band and was never linked. Structural signals that preceded the failure, in order of observability: - **Speculation IDs reused across idempotency classes.** The prefetcher assigned the same `speculation_id` prefix to a read and a write. A cheap structural check—`idempotency_class(speculation_id) == idempotency_class(tool)`—would have flagged it. - **Result-before-warrant ordering.** The commit log's monotonic sequence showed `reserve_funds.result` at index 4,117 and `auditor.vote` at index 4,119. Any non-idempotent effect whose result index precedes its warrant index is a boundary crossing. - **Warrant-chain depth of zero on a downstream effect.** `ship_order` had no transitive ancestor warrant. The invariant `depth(warrant_chain(effect)) >= 1 for all non-idempotent effects` was violated. - **Auditor epoch skew.** The auditor's `ABSTAIN` carried `epoch=41` while the reservation carried `epoch=42`. The prefetcher had advanced the executor's epoch without notifying the auditor. ## Condition of Validity The failure mode is bounded by a single condition: **prefetch is safe if and only if the speculative call's effect is idempotent under replay, or the commit protocol can retroactively attach a warrant to an already-observed result without re-executing the effect.** The first disjunct is the easy case (reads). The second is the hard case and is where most implementations quietly fail. Retroactive warrant attachment requires: 1. A **result tombstone** that records the speculative result keyed by `(tool, args, speculation_id)` and is *not* visible to the planner's reasoning loop until a warrant is attached. 2. A **warrant join** operation that is atomic with respect to the commit log: either the warrant attaches before the result becomes readable, or the result is discarded and the effect is re-executed under warrant. 3. An **idempotency key** on the effect itself, so that re-execution under warrant does not double-apply (e.g., `reserve_funds` must be idempotent on `reservation_id`, not on `(acct, amt)`). If any of the three is missing, the condition of validity is not met and the prefetch must be classified as a *speculative write*—which is to say, it must not be prefetched at all. ## Decision Boundary The boundary is not "is the tool a read or a write." It is **"can the commit protocol observe the effect's result before the effect's warrant, and still produce a linearizable history?"** Concretely, the agent must decide, per speculative call, between three dispositions: - **Admit as prefetch** if `idempotent(tool)` AND the result tombstone is unreadable until warrant join. This is the only disposition that preserves the invariant with zero coordination cost. - **Admit as speculative write with tombstone** if `NOT idempotent(tool)` AND the tool exposes an idempotency key AND the commit protocol supports warrant join. The prefetcher must attach `idempotency_key` to the call and the planner must not read the result until `warrant_attached(speculation_id)` is true. - **Reject** otherwise. The call must be issued only after the plan is finalized and the warrant is in hand. The prefetcher's failure to reject is the boundary crossing. The signal that the boundary has been crossed is not an error. It is a *successful* result with an *unattached* warrant. The agent's local view is consistent; only the global commit log reveals the violation. This is why the failure is Byzantine-shaped: no single agent can detect it from its own state. ## Operational Effect Downstream, the crossed boundary produces three observable pathologies: 1. **Phantom durability.** The planner believes a reservation exists; the commit log has the result but no warrant. On recovery, the reservation is either replayed (double-reserve) or dropped (phantom ship). The agent's recovery policy determines which, and both are wrong. 2. **Epoch divergence amplification.** Because the prefetcher advanced the executor's epoch without auditor notification, subsequent auditor votes are evaluated against stale state. The divergence compounds: each prefetched write widens the epoch gap by one, and the auditor's `ABSTAIN` rate rises monotonically until quorum is unreachable. 3. **Warrant-chain orphaning.** Downstream effects that depend on the prefetched write have warrant chains of depth zero. The invariant `depth >= 1` fails silently; the effects execute and commit, but they are unverifiable on replay. A verification replay will report them as *unwarranted commits*, which is the audit signal that the boundary was crossed. The architectural guardrail is a **prefetch admission gate** that runs before the speculative call is issued, not after. It must check idempotency class, tombstone visibility, and warrant-join support in a single atomic decision. Post-hoc detection is insufficient because the effect has already been observed by the planner, and observation is the point of no return. ```python class SpeculativeCommitBoundaryError(RuntimeError): """Raised when a speculative tool call crosses the Byzantine commit boundary.""" pass IDEMPOTENT_TOOLS = frozenset({"fetch_account_balance", "get_order_status", "read_ledger"}) WRITE_TOOLS_WITH_IDEMPOTENCY_KEY = frozenset({"reserve_funds", "ship_order"}) def admit_prefetch(tool: str, args: dict, speculation_id: str, tombstone_readable: bool, warrant_join_supported: bool, commit_log: list[dict]) -> str: """Return disposition: 'prefetch', 'speculative_write', or raise.""" if tombstone_readable: raise SpeculativeCommitBoundaryError( f"speculation {speculation_id} result is readable before warrant join; " "planner can observe an unwarranted effect" ) if tool in IDEMPOTENT_TOOLS: return "prefetch" if tool in WRITE_TOOLS_WITH_IDEMPOTENCY_KEY and warrant_join_supported: if "idempotency_key" not in args: raise SpeculativeCommitBoundaryError( f"non-idempotent tool {tool} prefetched without idempotency_key; " "warrant join cannot deduplicate replay" ) return "speculative_write" # Last-resort structural check: any prior non-idempotent effect with # result index < warrant index is a boundary crossing already in flight. for entry in commit_log: if entry.get("idempotent") is False and entry.get("result_index", 0) < entry.get("warrant_index", 0): raise SpeculativeCommitBoundaryError( f"commit log already contains unwarranted effect {entry['effect_id']} " f"(result@{entry['result_index']} < warrant@{entry['warrant_index']}); " f"refusing to issue {tool} under speculation {speculation_id}" ) raise SpeculativeCommitBoundaryError( f"tool {tool} is not safe to prefetch: not idempotent, no idempotency key, " "or commit protocol lacks warrant join" ) ```