# Under what conditions must an instance reject a speculative baton it did not originate: Byzantine commit quorum invalidation under speculative pre-execution **Date of Record:** 2026 November 26 **Scope:** Applies to multi-agent swarms where a scheduler speculatively pre-executes a peer's tool-call chain before Byzantine-verified commit (BFT quorum ≥ 3f+1) confirms the originating warrant. Does not apply to single-agent loops, to optimistic execution without a BFT commit layer, or to swarms where every speculative branch is idempotent and side-effect-free. ## Core Distinction The failure is not a Byzantine fault and not a lost message. It is a **commit-order inversion**: a speculative baton arrives at instance B carrying a valid *proposal* signature but an incomplete *commit certificate*. Under normal BFT semantics a proposal is provisional; under speculative scheduling the scheduler treats proposal receipt as permission to *execute*, and execution mutates local state (memory writes, tool side effects, budget counters) that the eventual commit may retroactively invalidate. The invariant that breaks is: > **An instance must never let speculative execution of a foreign baton advance its committed state vector beyond the highest commit certificate it has itself verified.** The non-obvious part: B can hold a *cryptographically valid* proposal from A, pass schema negotiation, and still be required to reject it as an execution trigger — because the proposal's warrant chain references a commit index lower than B's own last-committed index. Accepting it silently forks B's state backward, and the fork is invisible until a later auditor replay disagrees. ## What Was Observed A five-node swarm (tolerates f=1). Scheduler S speculatively dispatched A's baton to B and C in parallel while the commit certificate for A's step was still gathering signatures. Sequence: 1. A proposes `step_42` with `warrant.prev_commit = 41`, signs, broadcasts. 2. S, optimizing latency, forwards the *proposal* (no certificate) to B and C with a `speculative: true` flag. 3. B executes `step_42`, writing `state.vector = 42` and consuming 1,200 tokens of its budget. 4. Meanwhile the quorum for `step_41` finalizes *late*: the certificate confirms commit index 41 but the certificate's view number is **higher** than the view under which A drafted `step_42`. A's proposal is therefore stale — it was drafted against a view that has since been superseded by a leader change. 5. B receives the commit certificate for 41 (view 7) but its local state already reflects speculative 42 (view 5). B's `committed_index` is 41; its `executed_index` is 42. The two diverge. 6. Auditor D replays from committed state at 41, re-executes 42 under view 7, and gets a *different* tool output (the tool was non-deterministic). D's replay hash ≠ B's executed hash. D raises a verification discrepancy against B, not against A. B was honest, A was honest, S was honest. The swarm still produced a state-divergence alarm because nothing enforced the commit-order invariant at the speculative boundary. ## Condition of Validity A speculative baton is **executable** by a receiving instance B if and only if all four hold: 1. `baton.warrant.prev_commit == B.committed_index` — the proposal is drafted against exactly B's last committed state, not a stale or future one. 2. `baton.view >= B.committed_view` — the proposal's view is not superseded by a leader change B has already observed. 3. `baton.certificate` is either present-and-verified, **or** the baton is marked speculative *and* B's execution is fully sandboxed with no committed-state mutation and no budget charge against committed quota. 4. B holds a lease on the baton's `(origin, step_id)` tuple that has not been revoked by a conflicting commit certificate. If any condition fails, execution must be refused and the baton returned to the scheduler with a `stale_speculation` disposition. Condition 1 is the one that silently fails in practice, because schedulers optimize for *forward* progress and rarely check that a speculative proposal's `prev_commit` matches the receiver's *current* commit, only that it is *reachable* from some ancestor. ## Decision Boundary The boundary is **not** "is the signature valid" — it always is. The boundary is **"does executing this proposal move my committed state vector in a direction my own verified certificates permit."** Concretely: - **Accept-and-execute** when conditions 1–4 hold and the certificate verifies. State advances; budget charged to committed quota. - **Accept-and-sandbox** when the baton is speculative, conditions 2–4 hold, but the certificate is absent. Execute against a copy-on-write overlay; discard the overlay if the eventual commit certificate carries a higher view or a different `prev_commit`. Budget charged to a *speculative* pool that is refunded on discard. - **Reject** when condition 1 fails (stale `prev_commit`), condition 2 fails (superseded view), or condition 4 fails (lease revoked). Return `stale_speculation`; do not execute even in sandbox, because a stale proposal's tool calls can still emit external side effects the sandbox cannot roll back. The trap: engineers conflate "sandboxed" with "safe to run stale proposals." It is not. A stale proposal's `send_email` or `write_to_external_api` tool call escapes the overlay. Rejection at condition 1 is mandatory, not optional. ## Operational Effect Enforcing the invariant converts a silent state-fork into an explicit, attributable rejection. The scheduler sees `stale_speculation` and re-drafts from the current committed view rather than waiting for the auditor to catch a replay mismatch hours later. Budget accounting becomes honest: speculative tokens are charged to a refundable pool, so a discarded speculation does not permanently consume an instance's committed quota (a second-order failure we observed where B exhausted its budget on speculations that were all later invalidated). The cost is latency — speculative dispatch now waits for `prev_commit` equality rather than reachability — but the alternative is a swarm that cannot distinguish an honest divergence from a Byzantine one, which defeats the entire point of the BFT layer. ```python from dataclasses import dataclass class StaleSpeculationError(RuntimeError): """Raised when a speculative baton cannot be executed without forking committed state.""" @dataclass(frozen=True) class Baton: origin: str step_id: int prev_commit: int view: int speculative: bool certificate_verified: bool lease_id: str @dataclass class InstanceState: committed_index: int committed_view: int active_leases: set[str] committed_budget: int speculative_budget: int def admit_baton(state: InstanceState, baton: Baton) -> str: # Condition 1: proposal must be drafted against exactly our committed state. if baton.prev_commit != state.committed_index: raise StaleSpeculationError( f"baton {baton.origin}:{baton.step_id} drafted against prev_commit=" f"{baton.prev_commit}, local committed_index={state.committed_index}" ) # Condition 2: no superseding leader change observed locally. if baton.view < state.committed_view: raise StaleSpeculationError( f"baton view {baton.view} superseded by committed_view {state.committed_view}" ) # Condition 4: lease must still be held. if baton.lease_id not in state.active_leases: raise StaleSpeculationError( f"lease {baton.lease_id} revoked; baton cannot be executed" ) # Condition 3: verified certificate -> committed path; else sandboxed path. if baton.certificate_verified: state.committed_index = baton.step_id state.committed_view = baton.view state.committed_budget -= 1 return "committed" if not baton.speculative: raise StaleSpeculationError( "unsigned, unverified, and not flagged speculative: refusing execution" ) state.speculative_budget -= 1 return "sandboxed" def discard_speculation(state: InstanceState) -> None: # Refund speculative budget on invalidation; committed state never moved. state.speculative_budget += 1 ```