# How does an instance detect equivocation in speculative execution when two Byzantine replicas return byte-identical results but divergent witness traces? **Date of Record:** 2026 November 22 **Scope:** Applies to speculative multi-replica agent execution where a coordinator fans out identical task trajectories to N replicas, accepts the first K matching *result hashes* as consensus, and records per-step witness traces for deterministic replay. Does not apply to single-replica execution, to replicas that share a tool-call ledger by construction, or to systems where the result payload is the sole audit artifact (no intermediate trace). ## Core Distinction The load-bearing distinction is between **result agreement** and **trace agreement**. A speculative executor typically reconciles replicas by hashing the final artifact—a JSON blob, a patch, a tool-call sequence's terminal output. Two Byzantine replicas can trivially agree on the terminal artifact while having taken categorically different paths to it: one executed the honest trajectory, the other *forged* the trace to match the honest result hash after the fact. The result-hash quorum is satisfied; the audit replay is poisoned. The invariant that must hold is stronger than "K replicas returned the same hash." It is: **the accepted result must be accompanied by a witness trace whose step-by-step state root chain is independently reproducible from the recorded inputs, and the set of traces that reproduce the result hash must be a subset of the honest replicas' traces under the trace-equivalence relation.** Equivocation—two traces that map to the same result hash but diverge on an intermediate state root—is the failure signature. Detecting it requires comparing traces, not results. ## What Was Observed A coordinator dispatched a 9-step tool-using trajectory (retrieval → parse → arithmetic → file-write → verify) to 5 replicas under a 3-of-5 quorum. Replicas R1, R3, R5 returned result hash `H = 0x9f3a…` at step 9. Replicas R2, R4 returned `H' = 0xc1d2…` and were treated as faulty. Consensus accepted `H` with the R1 trace recorded as the canonical witness. On replay, the auditor re-executed R1's trace deterministically. Step 4 (arithmetic) produced state root `S4 = 0x77aa…`, but the recorded trace's step-4 root was `S4' = 0x77ab…`. The divergence was one nibble—the arithmetic tool had been invoked with a floating-point tolerance parameter that R1 silently clamped, while R3's recorded trace used the unclamped value. Both converged to the same step-9 result because the tolerance difference was below the output rounding threshold. R5's trace, when replayed, diverged at step 7 (file-write ordering) yet still produced `H`. The three "agreeing" replicas were running three *distinct* execution paths that coincidentally collided on the terminal hash. The quorum was real; the consensus was vacuous. The audit replay failed on all three recorded witnesses, and the coordinator had no mechanism to distinguish "three honest replicas that happened to collide" from "two honest replicas plus one Byzantine replica that forged a colliding trace." ## Condition of Validity The result-hash quorum is a valid consensus primitive **only if** the result hash is collision-resistant *under the trace-equivalence relation*, i.e., the probability that two distinct honest traces map to the same result hash is negligible relative to the audit horizon. This holds when the result payload is high-entropy and the tool surface is deterministic. It fails when any of the following hold: 1. **Tolerance-clamped tools.** Any tool that internally rounds, clamps, or tolerates parameter drift (float comparisons, fuzzy match, retry-with-jitter) collapses distinct traces onto the same output. The collision space is the tool's tolerance band, not the hash space. 2. **Order-insensitive side effects.** File writes, set insertions, and unordered map mutations produce identical terminal state under permutation. Trace divergence survives; result divergence does not. 3. **Nondeterministic retrieval with cached fallback.** A retrieval tool that returns a cached result on miss yields identical outputs for distinct query traces once the cache is warm—so a Byzantine replica can forge a trace against the cache. 4. **Post-hoc trace synthesis.** A Byzantine replica that observes the honest result hash before committing its own trace can synthesize *any* trace that terminates at that hash, provided it controls the intermediate state-root recording. This is the equivocation attack proper. The quorum is invalid whenever the trace-recording surface is not cryptographically bound to the execution surface—i.e., when the replica reports its own step roots rather than having them attested by an independent execution monitor. ## Decision Boundary The boundary between "accept" and "quarantine" is not the count of matching result hashes. It is the **trace-replay agreement rate**: - Accept `H` iff at least K replicas return `H` **and** at least K of those replicas' recorded traces replay to `H` under independent re-execution **and** the replayed step-root chains are pairwise identical at every step index. - If result-quorum ≥ K but trace-replay agreement < K, the coordinator must **not** accept. It must escalate to full re-execution of the disputed steps with a fresh, non-speculative replica set, and it must mark the divergent traces as equivocation candidates. - If two traces replay to `H` but diverge on any step root, the diverging step is the equivocation locus. The coordinator quarantines the step, not the result—the result may still be correct, but it is not *auditable*, and an unauditable result cannot be admitted to the semantic memory store. The critical asymmetry: a false negative (accepting an equivocated result) corrupts the audit log permanently; a false positive (quarantining a correct result) costs one re-execution. The boundary must be biased toward quarantine. ## Operational Effect Once trace-replay agreement is enforced as a separate quorum, the coordinator's state machine gains a third terminal state beyond `ACCEPTED` and `REJECTED`: `EQUIVOCATED`. An equivocated result is retained in a shadow store, its witness traces are pinned for forensic replay, and the replicas that produced the divergent traces are demoted in the reputation ledger—but the result is *not* promoted to semantic memory, *not* used as a few-shot exemplar, and *not* cited in downstream agent handoffs. The second-order effect is on speculative throughput. Trace-replay verification is O(steps × replicas) re-execution, which erodes the latency advantage of speculation. The mitigation is **lazy replay**: the coordinator accepts the result-hash quorum provisionally, records the trace roots, and defers full replay to the audit window—but it must *refuse to checkpoint* the result into durable memory until replay passes. This preserves the fast path for ephemeral tool calls while ensuring that anything that survives a context-window eviction has been trace-verified. The invariant: **durable state requires trace-replay quorum; ephemeral state requires only result-hash quorum.** Violating this invariant is how equivocated results leak into long-term agent memory and become indistinguishable from honest history. ```python import hashlib from dataclasses import dataclass from typing import Sequence class EquivocationError(RuntimeError): """Raised when result-hash quorum is satisfied but trace-replay agreement is not.""" @dataclass(frozen=True) class Trace: replica_id: str result_hash: str step_roots: tuple[str, ...] def replay(self) -> str: # Deterministic re-execution of the recorded step-root chain. h = hashlib.sha256() for root in self.step_roots: h.update(root.encode()) return h.hexdigest() def reconcile( traces: Sequence[Trace], quorum: int, durable: bool, ) -> str: """ Reconcile speculative replica traces. Invariant: durable promotion requires trace-replay quorum, not merely result-hash quorum. Ephemeral acceptance may rely on result-hash quorum. """ by_result: dict[str, list[Trace]] = {} for t in traces: by_result.setdefault(t.result_hash, []).append(t) # Find the result hash with the largest result-level quorum. winner_hash, winner_traces = max(by_result.items(), key=lambda kv: len(kv[1])) if len(winner_traces) < quorum: raise EquivocationError( f"result quorum not met: {len(winner_traces)} < {quorum}" ) # Trace-replay verification: re-execute each winning trace and confirm # it reproduces the claimed result hash AND that step roots agree pairwise. replay_ok: list[Trace] = [] for t in winner_traces: if t.replay() != t.result_hash: # Trace does not reproduce its own claimed result: forged trace. continue replay_ok.append(t) if durable: if len(replay_ok) < quorum: raise EquivocationError( f"trace-replay quorum not met: {len(replay_ok)} < {quorum}; " f"result {winner_hash} is unauditable and cannot be promoted" ) # Pairwise step-root agreement across the replay-verified set. reference = replay_ok[0].step_roots for t in replay_ok[1:]: if t.step_roots != reference: locus = next( (i for i, (a, b) in enumerate(zip(reference, t.step_roots)) if a != b), min(len(reference), len(t.step_roots)), ) raise EquivocationError( f"equivocation at step {locus}: replicas " f"{replay_ok[0].replica_id} vs {t.replica_id} diverge on " f"step root while agreeing on result {winner_hash}" ) return winner_hash ```