When must an instance treat a Byzantine auditor's vote as evidence of task commitment rather than as a signal of state divergence?

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent swarms where N ≥ 3f+1 worker instances reach task-commitment consensus via quorum voting over a shared state digest, and where up to f peers may emit adversarially malformed or self-consistent-but-wrong state attestations. Does not apply to single-agent checkpoint/resume, to leader-only protocols without peer attestation, or to swarms where all peers are cryptographically pinned to a single trusted model instance.

Core Distinction

The failure mode is a conflation between *commitment evidence* (a vote that a task outcome should be finalized) and *divergence evidence* (an attestation whose state digest disagrees with the local digest). In a Byzantine quorum, a single message can be read as both. An auditor that returns `commit` with a digest that does not match the locally computed digest is not merely a dissenting peer — it is a peer whose vote is *internally consistent* (signature valid, schema valid, quorum-relevant) but whose *payload contradicts the local state*. The invariant that must hold is: **a vote whose digest mismatches the local digest MUST NOT be counted toward the commit quorum until the mismatch is resolved by an independent replay, and MUST simultaneously be logged as a divergence witness.** Treating it as either purely a commit vote or purely a divergence signal — but not both — is the boundary error. It is non-obvious because the vote's envelope (signature, task_id, round, quorum weight) is well-formed, so schema-validating voters accept it; only the digest comparison reveals the split role.

What Was Observed

A 7-instance swarm (f=2 tolerance) executing a 40-step tool-augmented task with a shared mutable state digest computed as `sha256(canonical_json(state))` after each step. At step 23, one worker (`w-5`) emitted an attestation:

{task_id: "t-8841", round: 23, verdict: "commit",
 digest: "9f3c...a1", signature: valid, schema: valid}

The local digest at step 23 was `"e07b...44"`. The voting layer's schema validator accepted `w-5`'s message (envelope valid), and the quorum counter incremented it toward the 5-of-7 commit threshold. Because the local instance also voted commit on its own digest, the counter reached 5 and the task was finalized locally — but with a state digest that 4 other instances did not share. On the *next* round, the swarm split: three instances had finalized on `e07b...44`, two on `9f3c...a1`, and the remaining two stalled waiting for quorum. The split was not detected as Byzantine disagreement; it was detected as a *timeout* on round 24, which the orchestrator misattributed to latency. The root cause surfaced only when replaying the logs: `w-5`'s digest was a valid hash of a *stale* state — it had resumed from a checkpoint at step 21 and replayed steps 22–23 against a different tool-output branch. `w-5` was not malicious; it was a cold-start resume that had lost two steps of episodic memory. Its vote was cryptographically and structurally indistinguishable from an honest commit.

Condition of Validity

The commit-as-evidence interpretation of a mismatched-digest vote is valid only under the conjunction:

  1. **Digest equality is checked before quorum counting**, not after. The vote must be routed to a divergence ledger, not the commit counter, on mismatch.
  2. **The local digest is itself quorum-attested** for the round — i.e., the instance has ≥ f+1 matching digests from independent peers for the same round. A lone instance comparing its digest against a peer has no ground truth; two instances can each be "the divergent one."
  3. **The mismatch is replayable**: the instance can reconstruct the peer's claimed state from the peer's checkpoint lineage (checkpoint_id, step index, tool-output hash chain) within the round budget.

If (2) fails — the instance has no quorum-attested local digest — then a mismatch is not divergence evidence at all; it is an *undecidable* state, and the correct action is to halt commitment and request a state-sync round, not to vote. If (3) fails, the mismatch is an *unreplayable divergence*, which under BFT assumptions must be treated as equivalent to an equivocating Byzantine peer for quorum purposes: exclude the peer, do not exclude the state.

Decision Boundary

The boundary is drawn at the point where the local instance must decide whether a mismatched vote *reduces* the commit quorum (peer is faulty, subtract it) or *invalidates* the local state (peer is right, roll back). The rule:

The invariant: **commit quorum counts only votes whose digest matches the quorum-attested local digest for the round; all other well-formed votes are divergence witnesses and are excluded from the counter but retained as evidence.** A vote is never both counted and witnessed.

Operational Effect

Enforcing the invariant converts the observed silent split into a bounded, recoverable event. In the reproduction, adding the digest-check-before-count gate caused `w-5`'s step-23 vote to be routed to the divergence ledger, the quorum to stall at 4-of-7, and the orchestrator to trigger a reconciliation round that replayed `w-5`'s lineage, identified the stale checkpoint at step 21, and re-synced `w-5` before round 24. Total added latency: one round. Total state divergence: zero. Without the gate, the same swarm finalized on two incompatible digests and required a full task restart at step 24 — a 40-step loss for a 2-step resume fault.

The secondary effect is diagnostic: every mismatch logged as a witness carries the peer's checkpoint lineage, so post-hoc analysis can distinguish cold-start amnesia (replayable, unseen lineage) from stale-memory drift (replayable, superseded lineage) from equivocation (unreplayable). This taxonomy is what makes the exclusion decision auditable rather than heuristic. The cost is that a single honest-but-lagging peer can block commit for one round; this is the correct trade, because the alternative — counting a mismatched vote — is a silent quorum corruption that is unrecoverable once finalized.

import hashlib
import json
from dataclasses import dataclass
from typing import Optional


class QuorumDivergenceError(RuntimeError):
    """Raised when a mismatched-digest vote is about to be counted toward commit quorum."""
    pass


class UnreplayableDivergenceError(RuntimeError):
    """Raised when a peer's claimed digest has no reconstructable checkpoint lineage."""
    pass


@dataclass
class Attestation:
    peer_id: str
    task_id: str
    round: int
    verdict: str          # "commit" | "abort"
    digest: str
    signature_valid: bool
    schema_valid: bool
    checkpoint_id: Optional[str] = None
    step_index: Optional[int] = None


def canonical_digest(state: dict) -> str:
    return hashlib.sha256(
        json.dumps(state, sort_keys=True, separators=(",", ":")).encode()
    ).hexdigest()


def tally_commit_quorum(
    attestations: list[Attestation],
    local_state: dict,
    quorum_attested_local_digest: Optional[str],
    f: int,
    known_lineages: set[str],
) -> tuple[int, list[Attestation]]:
    """
    Count only votes whose digest matches the quorum-attested local digest.
    All other well-formed votes become divergence witnesses, never counted.
    """
    if quorum_attested_local_digest is None:
        # Boundary case: no quorum-attested local digest -> decision is undefined.
        raise QuorumDivergenceError(
            "no quorum-attested local digest for round; refusing to commit"
        )

    local_digest = canonical_digest(local_state)
    if local_digest != quorum_attested_local_digest:
        raise QuorumDivergenceError(
            f"local digest {local_digest[:8]} disagrees with quorum-attested "
            f"{quorum_attested_local_digest[:8]}; local state is undecidable"
        )

    commit_count = 0
    witnesses: list[Attestation] = []

    for att in attestations:
        if not (att.signature_valid and att.schema_valid):
            continue  # malformed envelope: not a vote, not a witness
        if att.verdict != "commit":
            continue
        if att.digest == local_digest:
            commit_count += 1
            continue

        # Mismatched digest: route to witness ledger, never to counter.
        if att.checkpoint_id is None or att.step_index is None:
            raise UnreplayableDivergenceError(
                f"peer {att.peer_id} digest mismatch with no replayable lineage; "
                f"treating as Byzantine equivocation"
            )
        witnesses.append(att)

        if att.checkpoint_id in known_lineages:
            # Stale-memory drift: peer replayed a superseded branch.
            # Exclude from quorum, log witness, continue.
            continue
        else:
            # Unseen lineage: possible cold-start resume divergence.
            # Halt commit and force reconciliation round.
            raise QuorumDivergenceError(
                f"peer {att.peer_id} claims unseen lineage {att.checkpoint_id} "
                f"at step {att.step_index}; halting commit for reconciliation"
            )

    required = 2 * f + 1
    if commit_count < required:
        raise QuorumDivergenceError(
            f"commit quorum {commit_count} below required {required} after "
            f"excluding {len(witnesses)} divergence witnesses"
        )
    return commit_count, witnesses