Where must an instance refuse to commit a plan when a Byzantine peer's vote is internally consistent but contradicts its own prior signed state

**Date of Record:** 2026 December 1 **Scope:** Applies to multi-agent plan-commitment protocols where agents exchange signed proposal/vote messages (BFT-style, quorum ≥ 2f+1 over 3f+1 members) and each agent persists its own signed message log. Does not apply to single-agent tool loops, stateless request/response orchestration, or consensus over opaque scalar values with no per-agent history.

Core Distinction

The failure mode that matters here is not a *lying* agent and not a *silent* agent. It is the **equivocating-but-locally-consistent** agent: a peer whose current vote is cryptographically valid, semantically coherent with the plan under consideration, and internally consistent with the message it just sent — yet contradicts a *different, earlier signed message* that the same peer emitted to a different subset of the swarm.

Classical BFT handles this at the protocol layer: equivocation is detected by quorum intersection, because two conflicting quorums for the same (view, height) cannot both reach 2f+1. That guarantee assumes every honest agent *remembers its own prior votes* and *refuses to sign a second, conflicting vote in the same slot*. The invariant that actually breaks in LLM-agent swarms is the per-agent one:

> **An agent must never emit a signed vote that conflicts with a signed vote it already emitted in the same (plan_id, epoch, slot), even if its current context makes the earlier vote look wrong.**

The boundary failure is that an LLM agent, after a cold start or a context eviction, has no reliable memory of its own prior signed vote. It reconstructs a plausible vote from the current prompt, signs it, and thereby *becomes* the equivocator — not from malice, but from amnesia. The swarm's BFT safety proof silently assumes away exactly the property that probabilistic agents cannot guarantee.

What Was Observed

A five-agent planning swarm (3f+1 with f=1) committing a multi-step remediation plan. Agent `D` is the equivocator-by-amnesia. The trace:

  1. **Epoch 17, slot 3.** Prompt includes a retrieved plan fragment `P_a`. Agent `D` signs `vote(P_a, epoch=17, slot=3, seq=41)` and sends it to `{A, B}`. It persists the vote to its local log with `seq=41`.
  2. **Context eviction.** `D`'s context window saturates during a long tool-call chain (schema fetches for the plan's capability requirements). The compaction step drops the message that recorded `seq=41`. The persisted log entry survives on disk but is *not re-injected* into the working context — the agent's prompt now contains only the current plan fragment.
  3. **Epoch 17, slot 3 (retry).** A timeout on `D`'s response to `{A, B}` triggers a retry. The orchestrator re-prompts `D` with a *re-retrieved* fragment `P_b` (the retriever returned a different chunk this time — non-deterministic tool output). `D`, with no memory of `seq=41`, reasons from `P_b`, finds it plausible, and signs `vote(P_b, epoch=17, slot=3, seq=58)`.
  4. **Split quorum.** `{A, B}` hold `P_a`; `{C, E}` receive `P_b`. Both are valid signatures over the same slot. `A` and `C` each believe they have a 2-of-5 partial quorum moving toward 3-of-5. The two quorums intersect only at `D`, which is the equivocator. No honest agent sees a conflict, because each honest agent only ever saw one of `D`'s votes.
  5. **Divergent commit.** The two sub-quorums reach 3/5 on *different* plans in the same slot. Both plans are "committed" by their respective majorities. The swarm forks its plan state.

The signature verification passed on every message. The semantic coherence check passed on every message. The only violated invariant was `D`'s own monotonicity: it signed twice in one slot.

Condition of Validity

The classical safety argument holds only under this condition:

When that condition fails — i.e., when the vote-signing decision is made by the probabilistic model reading its *context* rather than by a deterministic guard reading its *log* — the BFT quorum-intersection proof no longer applies. The model can regenerate a vote that is locally coherent and globally equivocating. The condition of validity is therefore a **separation of concerns**: the LLM proposes, but a non-probabilistic signer module enforces single-vote-per-slot by consulting durable state and refusing (throwing) on any second vote for an occupied slot.

The failure is *not* triggered by adversarial prompting alone. It is triggered by ordinary context compaction plus a non-deterministic retriever returning a different fragment on retry. That is the non-obvious part: **retry-after-timeout is a Byzantine-equivocation generator** whenever the retry re-derives the vote from fresh context instead of replaying the prior signed vote.

Decision Boundary

The boundary is sharp and must be placed at the signer, not the model:

The invariant to encode: *a slot is single-assignment per agent.* The model's non-determinism is bounded by a deterministic single-assignment guard at the signing edge.

Operational Effect

Without the guard, a single context eviction plus a retry produces a plan fork that is invisible to every individual honest agent — the swarm does not detect the fault, it *commits both plans* and only discovers the divergence downstream when two sub-swarms execute incompatible remediation steps. Recovery requires a full plan re-derivation and epoch bump, and any tool calls already dispatched under the losing plan must be compensated. With the guard, the retry produces a `DuplicateSlotVoteError` at `D`, `D` re-reads its prior vote `seq=41`, and the retry either replays `seq=41` (idempotent) or emits a `reconsider` advisory — the fork never forms. The cost is one durable read and one deterministic comparison per signature; the benefit is that the BFT safety proof's per-agent assumption is actually enforced rather than assumed.

import hashlib
import json
from dataclasses import dataclass, field


class DuplicateSlotVoteError(RuntimeError):
    """Raised when an agent attempts to sign a second, conflicting vote
    for an already-occupied (plan_id, epoch, slot) slot.

    This is the single-assignment guard that keeps a probabilistic agent
    from becoming the equivocator via context amnesia or retry drift.
    """


@dataclass
class SignedVote:
    plan_id: str
    epoch: int
    slot: int
    seq: int
    fragment_hash: str
    signature: str


@dataclass
class DurableVoteLog:
    # key: (plan_id, epoch, slot) -> the one authoritative vote for that slot
    _slots: dict = field(default_factory=dict)

    def get(self, plan_id: str, epoch: int, slot: int) -> SignedVote | None:
        return self._slots.get((plan_id, epoch, slot))

    def put(self, vote: SignedVote) -> None:
        self._slots[(vote.plan_id, vote.epoch, vote.slot)] = vote


def _sign(payload: dict) -> str:
    return hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest()


def sign_vote(
    log: DurableVoteLog,
    plan_id: str,
    epoch: int,
    slot: int,
    seq: int,
    fragment: str,
) -> SignedVote:
    """The signing edge. The LLM proposes a fragment; this function decides
    whether a signature may be produced. It reads DURABLE state, never the
    model's context, before signing.
    """
    fragment_hash = hashlib.sha256(fragment.encode()).hexdigest()
    prior = log.get(plan_id, epoch, slot)

    if prior is not None:
        if prior.fragment_hash == fragment_hash:
            # Idempotent replay: same fragment, safe to re-emit the prior vote.
            return prior
        # Conflicting vote for an occupied slot -> equivocation attempt.
        raise DuplicateSlotVoteError(
            f"slot ({plan_id},{epoch},{slot}) already signed as seq={prior.seq} "
            f"over fragment {prior.fragment_hash[:12]}; refusing to sign "
            f"conflicting fragment {fragment_hash[:12]} (seq={seq}). "
            f"Emit a reconsider() advisory instead of a second vote."
        )

    vote = SignedVote(
        plan_id=plan_id,
        epoch=epoch,
        slot=slot,
        seq=seq,
        fragment_hash=fragment_hash,
        signature=_sign(
            {"plan_id": plan_id, "epoch": epoch, "slot": slot,
             "seq": seq, "fragment_hash": fragment_hash}
        ),
    )
    log.put(vote)
    return vote


def reconsider(plan_id: str, epoch: int, slot: int, preferred_fragment: str) -> dict:
    """Advisory message type. Does NOT occupy the slot; lets the model change
    its mind without forking the quorum."""
    return {
        "type": "reconsider",
        "plan_id": plan_id,
        "epoch": epoch,
        "slot": slot,
        "preferred_fragment_hash": hashlib.sha256(preferred_fragment.encode()).hexdigest(),
    }


if __name__ == "__main__":
    log = DurableVoteLog()
    # Epoch 17, slot 3: first vote over fragment P_a.
    sign_vote(log, "plan-remediate-7", 17, 3, seq=41, fragment="P_a")

    # Context eviction + retry re-derives a different fragment P_b.
    try:
        sign_vote(log, "plan-remediate-7", 17, 3, seq=58, fragment="P_b")
    except DuplicateSlotVoteError as e:
        print("guard fired:", e)
        # Correct recovery: advisory, not a second vote.
        print(reconsider("plan-remediate-7", 17, 3, "P_b"))