# What structural signals indicate speculative tool-call cache poisoning is about to cross a Byzantine commit boundary in multi-agent schedulers **Date of Record:** 2026 November 25 **Scope:** Applies to multi-agent systems where a scheduler speculatively executes tool calls ahead of a quorum commit and caches their results keyed by (intent, argument) pairs, then reconciles against a Byzantine-resilient commit order. Does not apply to single-agent tool loops, to caches that are invalidated on every epoch, or to systems where speculative results are never visible to non-speculating agents before commit. ## Core Distinction The failure mode is not "a tool returned wrong output" and not "a Byzantine replica voted maliciously." It is the collision of two independently sound mechanisms: speculative execution (which assumes tool outputs are *deterministic functions of arguments*, so a cached result can be reused safely) and Byzantine-resilient commit ordering (which assumes *no replica's local state is trusted until f+1 agreement*). Speculation caches results keyed by argument hash and serves them to *other* agents before the originating agent's commit round completes. The cache thus becomes an unauthenticated side channel that lets a single Byzantine agent's speculative branch — never committed, never quorum-verified — influence the reasoning of honest agents that later read the same key. The invariant that breaks: *a result visible to agent B must have been produced by a call that agent B's own quorum would have accepted.* Speculation violates it silently because the cache hit is faster and carries no provenance. ## What Was Observed A 7-agent swarm (f=2 tolerated faults) ran a plan with three parallel branches, each branch issuing `lookup(entity)` tool calls. Agent A₃ was Byzantine (or, in the non-adversarial variant, simply crashed mid-call and its speculative result was written by a retry path). Sequence: 1. Scheduler speculatively dispatched `lookup(X)` from A₃ before the epoch's commit round. A₃'s tool returned `{status: ok, value: v₁}`. 2. The cache wrote `hash("lookup","X") → v₁` with TTL = 3 epochs, tagged only with `origin: A₃`, no commit attestation. 3. A₃'s commit round failed to reach f+1 agreement (its proposal was malformed; other replicas rejected). Its speculative branch was *never committed*. The scheduler correctly marked A₃'s branch for rollback. 4. In epoch+1, honest agents A₁ and A₅ issued `lookup(X)` on a *different* branch. Cache hit → `v₁`. Both reasoned on `v₁` and built downstream plans on it. 5. The quorum-committed value for `lookup(X)`, produced later by A₁'s own call, was `v₂ ≠ v₁`. Divergence surfaced only at the merge step, three tool calls deep, when A₁'s and A₅'s plans contradicted the committed branch. The structural signal that preceded the failure by one epoch was *not* a vote rejection (A₃'s rejection was handled correctly). It was the cache write event: a speculative result was committed to shared cache **before** its originating commit round resolved, and the cache entry carried no `commit_round_id` or `quorum_signature`. Any cache hit by a non-originating agent on an entry lacking a quorum attestation is the boundary marker. ## Condition of Validity The invariant "speculative results are safe to share" holds only under the conjunction: - **Determinism:** `tool(args)` is a pure function of `args` for the cache TTL window. Violated by any tool reading mutable external state (time, RNG, live DB, another agent's mailbox). `lookup(X)` in the incident read a DB that A₃'s failed branch had partially mutated — so even honest calls were non-deterministic across the window. - **Originator honesty:** the entry was written by a replica whose commit will succeed. Violated by f Byzantine replicas and by crash-retry writers. - **Provenance locality:** every consumer of a cache entry is also a voter in the round that would commit it. Violated the moment a *non-originating* branch reads the key. When any conjunct fails, the cache is no longer a memoization layer but an unverified broadcast channel. The boundary is crossed at the *first read by a non-originator of an entry with no quorum attestation* — not at the write, and not at the eventual merge divergence. ## Decision Boundary The scheduler must choose, per cache entry, between: - **Serve** — only if the entry carries `quorum_signature` over `(key, value, commit_round_id)` from ≥ f+1 distinct replicas, and the TTL has not outlived the commit epoch. Serving an attested entry is safe even to non-originators. - **Re-speculate** — if the entry is unattested but the requesting agent is itself a voter in the pending round; it may use the value provisionally but must treat it as *unconfirmed* and must not propagate it to its own downstream tool calls' cache keys. - **Invalidate** — if the entry is unattested and the requester is a non-originator, or if the tool is flagged non-deterministic. Invalidate on any `commit_round_id` rollback, regardless of TTL. The decision is not "trust the cache" vs. "trust the quorum." It is a three-way gate keyed on **attestation presence × requester voter-membership × tool determinism class**. Collapsing it to two-way is precisely the bug: unattested entries get served because the requester happens to be honest, but honesty of the requester does not launder the originator's uncommitted state. ## Operational Effect Once an unattested entry is served to a non-originator, the system enters a state where *honest agents hold mutually inconsistent committed beliefs* — each agent's local view is internally consistent and each individual commit round succeeded, yet the global merge is unsatisfiable. Byzantine-resilient ordering does not detect this because no single round violated f+1; the violation is in the *cross-round cache fabric*, which the ordering protocol does not model. Recovery requires a full cache flush keyed on rollback events and a re-derivation of every downstream plan whose ancestry includes an unattested hit — cost scales with branch fan-out, not with the number of faulty agents. The guardrail that bounds it: **cache entries are first-class commit objects**; they are written only after quorum attestation, carry the attestation as part of the key's validity predicate, and are invalidated by `commit_round_id` rollback propagation, not by TTL alone. Speculation is then permitted only *within* a single agent's uncommitted working set, never across the shared cache boundary. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Optional class SpeculativeCacheBoundaryError(RuntimeError): """Raised when a speculative cache entry would cross a Byzantine commit boundary.""" class ToolDeterminism(Enum): PURE = "pure" EXTERNAL_STATE = "external_state" class Disposition(Enum): SERVE = "serve" RE_SPECULATE = "re_speculate" INVALIDATE = "invalidate" @dataclass(frozen=True) class CacheEntry: key: str value: object origin_agent: str commit_round_id: int quorum_signers: frozenset[str] tool_class: ToolDeterminism epoch_written: int @dataclass(frozen=True) class Request: key: str requester: str is_voter_in_pending_round: bool current_epoch: int fault_tolerance_f: int def classify(entry: Optional[CacheEntry], req: Request) -> Disposition: if entry is None: return Disposition.RE_SPECULATE attested = len(entry.quorum_signers) >= req.fault_tolerance_f + 1 epoch_valid = req.current_epoch - entry.epoch_written <= 1 non_deterministic = entry.tool_class is ToolDeterminism.EXTERNAL_STATE if non_deterministic: return Disposition.INVALIDATE if attested and epoch_valid: return Disposition.SERVE if not attested and req.is_voter_in_pending_round and entry.origin_agent != req.requester: # voter may use provisionally but MUST NOT propagate return Disposition.RE_SPECULATE if not attested and not req.is_voter_in_pending_round: return Disposition.INVALIDATE return Disposition.INVALIDATE def serve_or_guard(entry: Optional[CacheEntry], req: Request) -> object: disposition = classify(entry, req) if disposition is Disposition.INVALIDATE and entry is not None: # The structural signal: a non-originator is about to read an # unattested speculative result. Refuse before state divergence. raise SpeculativeCacheBoundaryError( f"refusing cache hit key={entry.key!r} origin={entry.origin_agent!r} " f"requester={req.requester!r} signers={len(entry.quorum_signers)} " f"f={req.fault_tolerance_f} round={entry.commit_round_id} " f"epoch_delta={req.current_epoch - entry.epoch_written}" ) if disposition is Disposition.RE_SPECULATE: return None # caller must re-execute, not reuse assert entry is not None return entry.value ```