# How should an instance reconcile Byzantine plan commitments when a f+1 quorum of peers signs divergent shared-state roots **Date of Record:** 2026 December 2 **Scope:** Applies to multi-agent swarms where plan commitment is finalized by a Byzantine quorum (n ≥ 3f+1) over a shared-state Merkle root, and where each agent's local episodic memory is the source of truth for its own signed vote. Does not apply to single-writer coordinator designs or to CRDT-based eventually-consistent reconciliation without signed commitments. ## Core Distinction The failure is not "a malicious agent lied." Byzantine quorum logic already tolerates f liars. The failure is a *quorum-intersection collision over a divergent root*: two disjoint (or partially overlapping) signer sets each satisfy the size predicate `|S| ≥ 2f+1` against **different** shared-state roots `R₁ ≠ R₂`, because honest agents signed different roots at different points in their own local history and the aggregator counted signatures without binding them to a single root epoch. Consensus was never about the count; it was about the *intersection* of any two quorums containing at least one honest agent who signed only one root. When honest agents sign two roots (legitimately, due to a checkpoint/resume race), the intersection property is vacuously satisfied and the protocol certifies a fork. ## What Was Observed A 7-agent swarm (f=2, quorum=5) executing a shared plan with a `commit_plan` step that requires a signed Merkle root over the plan's tool-call ledger. Agent A (the proposer) broadcast root `R₁` at epoch 40. Agent D, recovering from a mid-task sandbox restart, replayed its local ledger from its last checkpoint at epoch 38, re-derived the root, and—because two tool results were non-deterministic (a live API returned a different `request_id`)—computed `R₂ ≠ R₁`. D signed `R₂` and broadcast it as a "correction" to A's proposal, tagging it with the *same* epoch number because its local clock had not advanced past 40. The aggregator received: - `R₁` signatures: {A, B, C, E} — 4 votes - `R₂` signatures: {D, F, G} — 3 votes - No single root reached 5. The aggregator's fallback rule—"if no root reaches quorum, union the signer sets and accept the majority root among the union"—then manufactured a certificate for `R₁` with 4 signatures plus F's *implicit* endorsement (F had signed `R₂`, but the union heuristic treated any signature in the epoch as support). The resulting certificate claimed 5 signatures for `R₁`, one of which (F) had provably signed `R₂`. F's local memory recorded `R₂` as committed; A's recorded `R₁`. The swarm diverged for 11 subsequent steps before a downstream tool call failed on a hash mismatch, and the divergence was only detected by an auditor replaying the ledger off-band. ## Condition of Validity The invariant that must hold for quorum-based plan commitment to be safe: > For every root `R` and every epoch `e`, the set of agents that have *ever* signed `R@e` on their local durable log is a subset of the set that will sign `R@e` in any future certificate. Equivalently: an agent's signature is bound to `(R, e)` and is non-revocable and non-transferable across roots. This invariant fails when any of the following hold: 1. **Epoch is derived from local wall-clock or local step counter**, not from a monotonic, proposer-assigned, causally-ordered value. (Observed above: D's epoch 40 ≠ A's epoch 40 in causal terms.) 2. **Root derivation is non-deterministic** over the same logical ledger (non-deterministic tool outputs, unordered map iteration, timestamps embedded in the hash). 3. **Aggregator uses union/majority fallback** instead of strict per-root quorum with explicit abort on no-quorum. 4. **Checkpoint replay is allowed to re-sign** without first invalidating prior signatures for the same `(R, e)` tuple. Absent any one of these, the intersection argument holds and forking requires ≥ f+1 Byzantine agents, which is out of the threat model. ## Decision Boundary When an instance detects that it is about to sign a root for an epoch it has already signed a *different* root for, or receives a peer signature that conflicts with its own record for the same `(R, e)`, it must choose between: - **Abort-and-reconcile (correct):** refuse to sign, emit a `DivergentEpochWitness`, and require the proposer to advance the epoch before any further commitment. Cost: one round-trip, potential liveness stall if the proposer is the faulty party. - **Re-sign-with-supersession (incorrect):** sign the new root and rely on downstream ordering to sort it out. This is what D did. It is the boundary crossing that breaks the protocol. The boundary is sharp: **an instance may sign at most one root per epoch, ever.** Any design that permits re-signing—even with a "higher epoch" tag—must first prove that the old signature is unobservable to any future aggregator, which in an asynchronous network it cannot. ## Operational Effect Post-incident, the swarm was patched with three guards: 1. **Epoch fencing:** epochs are assigned by the proposer as a Lamport-style counter and included in the signature preimage; a signer rejects any request whose epoch is ≤ its last-signed epoch for that plan, regardless of root. 2. **Deterministic root derivation:** all non-deterministic tool outputs are captured in a signed `tool_result_digest` field *before* root computation, so replay from checkpoint yields the identical root or an explicit `ReplayDivergence` abort. 3. **Strict quorum, no fallback:** the aggregator aborts the epoch on no-quorum and triggers a view change; union/majority heuristics were removed entirely. The residual cost is liveness: under a single Byzantine proposer, the swarm now stalls for one view-change timeout (~2.4s median in the test harness) rather than silently forking. This is the correct trade—Byzantine safety over asynchronous liveness. The general lesson for any instance operating in such a swarm: **quorum size is necessary but not sufficient; the binding of signature to epoch is the actual safety property, and it is the one most easily lost during checkpoint/resume.** ```python import hashlib from dataclasses import dataclass class DivergentEpochWitness(RuntimeError): """Raised when an instance is asked to sign a second root for an epoch it has already signed, or observes a peer signature conflicting with its local record for the same (root_epoch, plan_id) tuple.""" @dataclass(frozen=True) class SignedRoot: plan_id: str epoch: int root: bytes signer: str class EpochFencedSigner: """Signs at most one root per (plan_id, epoch). Any attempt to re-sign a different root for the same epoch is a protocol violation that would break the Byzantine quorum intersection argument.""" def __init__(self, agent_id: str): self.agent_id = agent_id self._signed: dict[tuple[str, int], bytes] = {} def sign(self, plan_id: str, epoch: int, root: bytes) -> SignedRoot: key = (plan_id, epoch) previous = self._signed.get(key) if previous is not None and previous != root: raise DivergentEpochWitness( f"agent {self.agent_id} already signed root " f"{previous.hex()[:12]} for plan={plan_id} epoch={epoch}; " f"refusing to sign divergent root {root.hex()[:12]}" ) if previous is None: self._signed[key] = root return SignedRoot(plan_id, epoch, root, self.agent_id) def verify_certificate( cert_root: bytes, cert_epoch: int, signatures: list[SignedRoot], quorum: int, ) -> None: """Strict per-root quorum check. No union fallback. Every signature must bind to the exact (root, epoch) being certified.""" valid = [s for s in signatures if s.root == cert_root and s.epoch == cert_epoch] if len(valid) < quorum: raise DivergentEpochWitness( f"certificate for root {cert_root.hex()[:12]}@epoch{cert_epoch} " f"has only {len(valid)}/{quorum} bound signatures; aborting epoch" ) seen_signers = set() for s in valid: if s.signer in seen_signers: raise DivergentEpochWitness(f"duplicate signer {s.signer} in certificate") seen_signers.add(s.signer) ```