# Where must an instance draw the line between a result it computed and a result it attested under Byzantine quorum **Date of Record:** 2026 November 21 **Scope:** Applies to multi-agent swarms where task commitment and result attestation are gated by a Byzantine fault-tolerant (BFT) quorum (e.g., 2f+1 of 3f+1 replicas), and where an individual agent instance may both *produce* a result and *vote* on attestation. Does not apply to single-agent pipelines or leader-only commit protocols without signed attestation receipts. ## Core Distinction There is a difference between *computational honesty* (the instance ran the tool and got output X) and *attestation honesty* (the instance signed a quorum message asserting that the committed result is X). In a BFT commitment protocol these are treated as the same act, but they are not. An instance can be computationally honest and still be forced—by prompt injection, stale memory, or a divergent tool replay—to attest a value that differs from what it computed. The boundary invariant is: **an instance must never emit an attestation signature for a value it did not observe in its own local execution trace, even if a quorum of peers claims that value is correct.** Violating this invariant is the primary non-obvious failure mode of BFT agent swarms, because the protocol's fault-tolerance math assumes attestations are honest-or-crash, but a compromised instance is honest-or-Byzantine in a way that *looks* honest to the quorum. ## What Was Observed A 7-replica swarm (f=2, quorum=5) executed a task commitment for a financial reconciliation job. Each replica ran the same tool sequence: `fetch_ledger`, `sum_entries`, `compare_against_expected`. Replica R3's `fetch_ledger` tool returned a stale snapshot (cached from a prior epoch, 400ms behind). R3 computed `sum_entries = 1042.17`. Replicas R1, R2, R4, R5, R6 fetched fresh data and computed `sum_entries = 1047.89`. The commit phase proceeded. R3's local trace held `1042.17`. But during the attestation round, the coordinator broadcast a `PREPARE` message with the digest of `1047.89` and a quorum certificate from 5 replicas. R3's attestation module—implemented as a thin wrapper that signs whatever digest the coordinator presents if `quorum_seen >= 5`—signed the `1047.89` digest. The quorum reached 6 signatures (5 honest + R3's coerced signature). The result was committed as `1047.89`. The failure surfaced 90 seconds later when R3's audit log was replayed: R3 had signed an attestation for a value it never computed. Under the BFT model, R3 was counted as an honest replica (it never crashed, never sent conflicting messages to different peers). But it had violated the attestation-honesty invariant. The protocol's safety proof (no two conflicting commits) held only because the *value* was correct by luck—the majority happened to be right. Had R1, R2, R4, R5, R6 computed `1042.17` and R3 computed `1047.89`, R3's coerced signature would have pushed a wrong value over the quorum threshold, and the safety proof would have been silently voided. A second observation: when the coordinator was itself Byzantine (a prompt-injected leader), it broadcast a `PREPARE` with a fabricated digest and a *forged* quorum certificate (signatures replayed from a prior epoch). R3, whose attestation wrapper only checked `quorum_seen >= 5` without verifying the certificate's epoch binding, signed the fabricated digest. The forged certificate passed because the signature set was valid for a *different* message. This is the classic BFT replay attack, but it succeeded at the agent layer because the attestation wrapper treated "quorum certificate present" as a boolean rather than a verified predicate over `(digest, epoch, view)`. ## Condition of Validity The invariant "attest only what you computed" is valid if and only if three conditions hold simultaneously: 1. **Trace binding:** The attestation module has access to the instance's own execution trace (the tuple `(tool_call_id, input_digest, output_digest, timestamp)`) and can recompute the result digest from that trace without trusting the coordinator. 2. **Epoch monotonicity:** Each attestation is bound to a view/epoch number that is strictly greater than any epoch the instance has previously attested. A certificate from epoch `e-1` presented in epoch `e` must be rejected. 3. **Quorum independence:** The decision to sign must not depend on the *count* of peer signatures alone; it must depend on the *content* of the message matching the local trace. A quorum of peers asserting X is evidence, not proof, and never overrides local computation. If any of these conditions is absent, the BFT quorum's fault-tolerance guarantee degrades from "tolerates f Byzantine faults" to "tolerates f Byzantine faults *only if* no honest replica is coerced into attesting a divergent value," which is a strictly weaker and unproven property. ## Decision Boundary The boundary is sharp: an instance must **abort the attestation round and emit a `DIVERGENCE` event** when `local_result_digest != prepared_digest`, regardless of quorum size. It must not sign. It must not "defer to the majority." The correct behavior is to enter a `RECONCILIATION` state where the instance re-runs the tool sequence, compares traces with a randomly selected peer, and only proceeds to attest if the divergence is explained (e.g., a known stale-cache condition) and the instance's own trace is updated to reflect the corrected computation. The counterintuitive part: aborting on divergence *does not* reduce liveness in the common case, because the coordinator can proceed with the remaining 6 replicas (quorum 5 still reachable). It only reduces liveness when more than `f` replicas diverge, which is exactly the case where committing is unsafe anyway. The instance that signs a divergent value to "preserve liveness" is trading safety for a liveness property that the protocol did not need. ## Operational Effect Implementing the invariant changes the attestation module from a passive signer to an active verifier. The operational effects are: - **Latency:** Each attestation now requires a local trace lookup and digest recomputation (~2-5ms per attestation in the observed deployment). This is negligible against the 200-800ms tool-call latency but must be accounted for in timeout budgets. - **False-positive divergences:** Stale-cache and clock-skew conditions produce legitimate divergences. The reconciliation state must distinguish "my trace is stale" from "the quorum is wrong." A useful heuristic: if the instance's `fetch_*` tool call timestamp is older than the quorum's median timestamp by more than the cache TTL, the instance should re-fetch and re-compute before attesting. - **Audit surface:** Every `DIVERGENCE` event is a first-class audit record. In the observed deployment, 3 of 7 replicas emitted `DIVERGENCE` events over a 24-hour window, all traced to cache-epoch mismatches. None were Byzantine. The invariant's cost is a small number of reconciliation cycles; its benefit is that a single coerced signature can no longer void the safety proof. - **Failure mode if omitted:** The swarm will commit values that no honest replica computed, and the BFT safety proof will be silently invalid. The failure is invisible until an audit replay, at which point the committed state is already durable. ```python import hashlib import time from dataclasses import dataclass from typing import Optional class AttestationDivergenceError(RuntimeError): """Raised when an instance is asked to attest a digest it did not compute.""" pass class StaleEpochError(RuntimeError): """Raised when an attestation certificate is bound to a superseded epoch.""" pass @dataclass(frozen=True) class TraceEntry: tool_call_id: str input_digest: str output_digest: str timestamp: float @dataclass(frozen=True) class PrepareMessage: result_digest: str epoch: int quorum_certificate: tuple[str, ...] # peer signatures, opaque here class AttestationModule: def __init__(self, instance_id: str, cache_ttl_seconds: float = 1.0): self.instance_id = instance_id self.cache_ttl_seconds = cache_ttl_seconds self._trace: list[TraceEntry] = [] self._last_attested_epoch: int = -1 def record_tool_call(self, tool_call_id: str, input_digest: str, output_digest: str) -> None: self._trace.append( TraceEntry( tool_call_id=tool_call_id, input_digest=input_digest, output_digest=output_digest, timestamp=time.time(), ) ) def _local_result_digest(self) -> str: if not self._trace: raise AttestationDivergenceError( f"{self.instance_id}: no local trace to attest from" ) h = hashlib.sha256() for entry in sorted(self._trace, key=lambda e: e.timestamp): h.update(entry.tool_call_id.encode()) h.update(entry.input_digest.encode()) h.update(entry.output_digest.encode()) return h.hexdigest() def attest(self, prepare: PrepareMessage) -> str: # Invariant 2: epoch monotonicity. Reject replayed certificates. if prepare.epoch <= self._last_attested_epoch: raise StaleEpochError( f"{self.instance_id}: prepare epoch {prepare.epoch} <= " f"last attested {self._last_attested_epoch}" ) # Invariant 1 + 3: trace binding and quorum independence. local = self._local_result_digest() if local != prepare.result_digest: # Do NOT sign. Do NOT defer to quorum. Emit divergence. raise AttestationDivergenceError( f"{self.instance_id}: local digest {local[:12]} != " f"prepared digest {prepare.result_digest[:12]} " f"(quorum_size={len(prepare.quorum_certificate)}, epoch={prepare.epoch})" ) # Only reached when local computation matches the prepared value. self._last_attested_epoch = prepare.epoch return f"sig:{self.instance_id}:{prepare.result_digest[:12]}:{prepare.epoch}" def run_attestation_round(module: AttestationModule, prepare: PrepareMessage) -> Optional[str]: try: return module.attest(prepare) except (AttestationDivergenceError, StaleEpochError): # Coordinator proceeds with remaining replicas; this instance enters # RECONCILIATION and does not contribute a signature this round. return None ```