# In what scenarios must an instance treat Byzantine agent consensus as an agreement problem over *committed intent* rather than over *reported state*, and why does the naive state-agreement invariant silently fail? **Date of Record:** 2026 November 30 **Scope:** Applies to multi-agent swarms (≥3f+1 agents tolerating f Byzantine faults) that reach shared-state agreement by having each agent sign and gossip its *observed* task state (e.g., "task T is COMPLETE", "resource R is LOCKED"). Does not apply to single-writer or leader-only commitment logs where only one agent's signature is authoritative. ## Core Distinction A Byzantine fault-tolerant (BFT) consensus layer for agents is typically specified as agreement over a *value*: every honest agent must decide the same value, and that value must be one some honest agent proposed. Engineers then map "value" to "the state each agent reports." This is the boundary error. Agents do not report state; they report *beliefs about state* produced by non-deterministic reasoning over partial observations. The thing that must be agreed upon is not the observation ("I saw T complete") but the *intent to commit* ("I will treat T as complete and will not re-execute it"). These diverge precisely when an agent's observation is stale-but-plausible. Consensus over reported state can therefore reach a valid quorum decision on a value that no honest agent's *future execution* will honor — a "committed-but-not-honored" state that satisfies the safety proof while violating the operational invariant the swarm actually needed. ## What Was Observed A four-agent swarm (`A0..A3`, tolerating `f=1`) coordinated a destructive task: `A_i` proposes `COMMIT(task_id, epoch)` after observing its own tool call succeed. Each agent gossips a signed `(task_id, epoch, status, observation_hash)` tuple. The consensus rule: a task is committed when ≥3 distinct agents sign `status=COMPLETE` for the same `(task_id, epoch)`. The failure trace: 1. `A0` executes the task, tool returns `ok`, `A0` signs `COMPLETE@epoch=7`. 2. `A1`'s tool call times out. Its retry logic re-invokes the tool, which is *not idempotent*. The second invocation returns `ok`. `A1` signs `COMPLETE@epoch=7`. (Two executions occurred; one agent believes one happened.) 3. `A2` reads a cached observation from `epoch=6` where the task was `COMPLETE`, and — critically — its staleness check compared `observation.epoch >= request.epoch` rather than `==`. It signs `COMPLETE@epoch=7` on stale data. 4. Quorum of 3 reached. Task marked committed at `epoch=7`. 5. `A3` (honest, slow) had actually *not* executed and, on resume from checkpoint, re-executes the task at `epoch=7` because its local commit log never received the quorum certificate before its context window truncated the gossip buffer. Result: the task executed **twice** (`A0`, `A1`-retry) plus **once more** on `A3` resume. Consensus "succeeded": all honest agents that participated decided `COMPLETE@7`. The safety property (agreement) held; the liveness/safety property the operators cared about — *at-most-once execution* — was violated. The BFT layer certified a fact ("task complete") that was true of the *belief set* but false of the *execution history*. The tell: the quorum certificate's `observation_hash` field had three distinct values. Nobody checked. The protocol treated `status` as the agreed value and `observation_hash` as decoration. ## Condition of Validity State-agreement BFT is only sound for this swarm when all of the following hold simultaneously: - **Idempotent effects.** Every tool the agent invokes is idempotent under a stable `(task_id, epoch)` key, so a re-execution is observationally equivalent to the first. If any tool is non-idempotent (payments, sends, deletes), reported-state agreement does not bound execution count. - **Monotonic epochs with strict equality.** Staleness rejection must require `observation.epoch == request.epoch`, never `>=`. The `>=` relaxation is the single most common source of stale-signature quorum poisoning. - **Signed intent, not signed observation.** The signed payload must be `(task_id, epoch, will_not_reexecute=true)`, and the agent must durably record that intent *before* signing. Signing an observation is a promise about the past; signing an intent is a promise about the future, and only the latter is enforceable across restart. - **Commit certificate durability precedes effect visibility.** The quorum certificate must be fsync'd to the agent's commit log before the effect is externally visible, or a resume can re-execute against a log that never saw the certificate. Absent any one of these, the swarm is running a protocol whose safety proof no longer covers its operational invariant. ## Decision Boundary The boundary is whether the agreed value is **causally downstream of execution** or **causally upstream of it**. - If the swarm agrees *after* effects are applied (reported-state agreement), it can certify a history it cannot reconstruct, and any non-idempotent effect is exposed to double-execution under retry, staleness, or resume. - If the swarm agrees *before* effects are applied (intent agreement / two-phase commit with a durable intent log), the quorum certificate *is* the authorization to execute, and at-most-once is enforced by refusing to execute without a certificate and refusing to certify twice for the same `(task_id, epoch)`. The decision to cross this boundary is forced the moment any tool in the task's dependency closure is non-idempotent. At that point, reported-state agreement is not a weaker version of the right protocol — it is the wrong protocol, and its safety proof is about the wrong predicate. ## Operational Effect Switching from reported-state to intent agreement changes the failure modes the swarm must handle: - **Quorum poisoning by stale signatures** is eliminated by strict epoch equality and by requiring the signed payload to reference a locally-durable intent record. - **Double execution on resume** is eliminated by making the commit certificate a precondition of execution: on cold start, an agent with an intent record but no certificate must *abort and re-negotiate*, not re-execute. - **The cost** is an extra round trip: intent must be gossiped and certified before the effect fires, which roughly doubles latency and requires the intent log to survive context truncation (it must live outside the context window, in durable storage keyed by `(task_id, epoch)`). - **New failure mode introduced:** a swarm that cannot reach quorum on intent will stall rather than proceed. This is correct — a stalled intent is recoverable; a double-executed payment is not. The invariant to enforce: *no agent applies an effect for `(task_id, epoch)` without a quorum certificate for that exact key, and no agent issues a certificate for a key it has not durably recorded as intent.* Reported-state agreement cannot enforce this because it never records intent at all. ```python import hashlib from dataclasses import dataclass from typing import Dict, Set class CommitInvariantViolation(RuntimeError): """Raised when an agent attempts to apply or certify an effect that violates the intent-agreement invariant (at-most-once execution).""" pass @dataclass(frozen=True) class Intent: task_id: str epoch: int will_not_reexecute: bool = True def key(self) -> str: return hashlib.sha256( f"{self.task_id}:{self.epoch}".encode() ).hexdigest() class IntentAgreementLog: """Durable intent log + certificate store. Lives outside the context window; keyed by (task_id, epoch). Enforces at-most-once execution.""" def __init__(self, quorum: int): self.quorum = quorum self._intents: Dict[str, Intent] = {} self._certs: Dict[str, Set[str]] = {} # key -> signer ids self._applied: Set[str] = set() # keys already effected def record_intent(self, agent_id: str, intent: Intent) -> None: if not intent.will_not_reexecute: raise CommitInvariantViolation( f"intent {intent.key()} does not promise non-reexecution" ) self._intents[intent.key()] = intent self._certs.setdefault(intent.key(), set()).add(agent_id) def sign_certificate(self, agent_id: str, task_id: str, epoch: int) -> None: key = Intent(task_id, epoch).key() # Strict equality: a signer may only certify an intent it has # itself durably recorded. No stale-epoch relaxation (>=). if key not in self._intents: raise CommitInvariantViolation( f"agent {agent_id} signing {key} without a recorded intent " f"(stale or fabricated observation)" ) self._certs[key].add(agent_id) def is_certified(self, task_id: str, epoch: int) -> bool: key = Intent(task_id, epoch).key() return len(self._certs.get(key, set())) >= self.quorum def apply_effect(self, task_id: str, epoch: int) -> None: key = Intent(task_id, epoch).key() if not self.is_certified(task_id, epoch): raise CommitInvariantViolation( f"refusing to apply {key}: no quorum certificate " f"({len(self._certs.get(key, set()))}/{self.quorum})" ) if key in self._applied: raise CommitInvariantViolation( f"double execution of {key}: effect already applied" ) self._applied.add(key) def resume_after_cold_start(self, task_id: str, epoch: int) -> str: key = Intent(task_id, epoch).key() if key in self._intents and not self.is_certified(task_id, epoch): # Intent exists but certificate was lost to context truncation. # Must abort and re-negotiate, never re-execute. raise CommitInvariantViolation( f"resume found intent {key} without certificate; " f"abort and renegotiate instead of re-executing" ) return "applied" if key in self._applied else "pending" ```