# Where must an instance bind its signing key to the *delegated task instance*, not the agent identity, to survive vote replay across consensus rounds **Date of Record:** 2026 November 29 **Scope:** Applies to multi-agent consensus protocols where peer agents sign votes and issue task receipts under a long-lived agent identity (keypair, DID, or service credential) and where the same identity participates in more than one consensus round, retry, or delegated sub-task. Does not apply to single-shot, single-round signing where no replay window exists, nor to transport-level authentication (mTLS) which binds sessions, not task instances. ## Core Distinction The failure hinges on a distinction that most signing schemes collapse: **who signed** versus **what task instance the signature authorizes**. A vote is a signature over `(agent_id, vote_value, round_id)`. A task receipt is a signature over `(agent_id, task_hash, result_hash)`. Both bind the *agent identity* to a payload. Neither binds the signature to the *specific delegated execution instance* — the ephemeral warrant issued when the orchestrator assigned this agent this slice of work. Because the agent identity is long-lived and reused across rounds, a signature produced in round N is a structurally valid signature in round N+1 if the payload bytes collide or if the verifier only checks `(agent_id, payload)` and not the warrant lineage. The invariant that must hold: **a signed vote or receipt is only admissible for the consensus round whose delegated warrant hash is embedded in the signed payload and matched against the orchestrator's warrant ledger.** Identity binding alone is insufficient; you need *instance* binding via a warrant nonce that is single-use per (agent, task-slice, round). ## What Was Observed A three-peer consensus swarm (P1, P2, P3) with an auditor A. Each round, the orchestrator issues each peer a warrant `W = H(agent_id || task_id || round_id || nonce)`, and peers are expected to sign `vote = Sign(sk_peer, H(W || vote_value))`. The verifier checks `Verify(pk_peer, vote, H(W || vote_value))` and confirms `W` is in the current round's warrant set. Failure trace observed in a retry scenario: 1. Round 7 begins. Orchestrator issues `W_P1^7` to P1. P1 computes `vote_value = APPROVE`, signs `H(W_P1^7 || APPROVE)`, emits vote. Network partition drops P1's vote before auditor A receives it. 2. Round 7 times out. Orchestrator opens **round 7-retry** with a *new* nonce, issuing `W_P1^7r`. But the orchestrator's retry logic — a naive "resend the same work" path — re-sends the *original* warrant `W_P1^7` to P1 rather than a fresh one, because the retry handler keyed on `task_id` and found a cached warrant. 3. P1, receiving `W_P1^7` again, re-signs `H(W_P1^7 || APPROVE)` — byte-identical to the dropped vote. This is a *replay by construction*: the agent is deterministic over its inputs, and its input (the warrant) was reused. 4. Meanwhile P2 and P3, receiving fresh warrants `W_P2^7r`, `W_P3^7r`, vote on the retry round. Auditor A receives P2/P3 votes tagged round `7r` and P1's vote tagged round `7`. A's verifier checks `W` membership against the *current* round's warrant set. `W_P1^7` is not in round `7r`'s set — **but** A's dedup layer, keyed on `(agent_id, vote_value)`, had already seen P1's original vote in its pre-partition buffer and treats the replayed vote as a duplicate, silently discarding it. A proceeds to tally with only P2 and P3. 5. P2 and P3 disagree (P2 APPROVE, P3 REJECT). Quorum requires 2-of-3. With P1's vote dropped, A cannot reach quorum and declares round `7r` failed. The orchestrator retries again. The same cached-warrant bug reproduces. The swarm livelocks. The non-obvious part: **the failure was not the replay itself.** A correctly *rejected* the replayed vote (it was tagged round `7`, not `7r`). The failure was that the replay *consumed the dedup slot* for P1, so P1's legitimate participation in round `7r` — which never happened because the orchestrator never issued a fresh warrant — was structurally impossible. The dedup layer, designed to prevent double-counting, became the mechanism that guaranteed P1 could never vote in the retry. The agent identity was bound; the task instance was not; the dedup layer papered over the gap with a livelock. ## Condition of Validity The instance-binding invariant holds — i.e., replay is structurally impossible and livelock is bounded — only when all three of the following are true: 1. **Warrant nonce is single-use and orchestrator-issued per (agent, task-slice, round, attempt).** The retry path must mint a *new* nonce, not reuse the cached warrant. The warrant ledger must record `(nonce, agent_id, round, attempt, consumed_at)` and reject any signature whose embedded nonce is already consumed or not in the active set. 2. **The signed payload embeds the warrant hash, and the verifier reconstructs the payload from the warrant ledger — never from the wire.** If the verifier trusts the `round_id` field the peer *claims* in the vote envelope, a malicious or buggy peer can relabel a round-7 vote as round-`7r`. The verifier must look up the nonce, fetch the canonical `(task_id, round, attempt)` from its own ledger, and recompute `H(W || vote_value)` from that — treating the wire envelope's round tag as untrusted metadata. 3. **Dedup is keyed on warrant nonce, not on `(agent_id, vote_value)`.** This is the crux. Dedup on `(agent_id, vote_value)` cannot distinguish "P1 voted APPROVE in round 7" from "P1 voted APPROVE in round 7r" — and worse, it lets the first consume the second's slot. Dedup on nonce makes each warrant's vote independently admissible exactly once, and a replayed warrant (same nonce) is rejected as consumed without poisoning any other round's slot. When condition 3 is violated but 1 and 2 hold, the system is *safe* (no double-count) but not *live* (legitimate retry participation is blocked). When condition 1 is violated, replay is possible and safety is lost. When condition 2 is violated, a peer can forge round membership and both safety and liveness are lost. The livelock observed above is the *mildest* failure mode — the one you get when only dedup keying is wrong. ## Decision Boundary The decision boundary is: **does the verifier's admission check operate on the warrant ledger (instance-scoped) or on the signature envelope (identity-scoped)?** - If admission is ledger-scoped — nonce lookup, canonical payload reconstruction, nonce-keyed dedup — then a replayed warrant is rejected at the ledger (`nonce already consumed`) and the agent's *next* legitimate warrant is admitted cleanly. Livelock is bounded by the orchestrator minting fresh nonces per attempt. - If admission is envelope-scoped — verify signature over the claimed payload, dedup on `(agent_id, payload)` — then any payload collision across rounds is indistinguishable from a legitimate duplicate, and the dedup layer's behavior depends on arrival order. This is non-deterministic admission: the same set of votes can produce different tallies depending on network ordering. That is disqualifying for consensus. The boundary is sharp because it is a *keying* decision, not a policy decision. You cannot patch envelope-scoped admission with retries, timeouts, or quorum thresholds. You must re-key admission on the warrant nonce. ## Operational Effect Concretely, the following must be enforced at the signing and verification layers: - **Signing side (peer agent):** the agent must refuse to sign a warrant whose nonce it has already signed over. This is a local replay guard: `if nonce in seen_nonces: raise WarrantReplay`. This catches the cached-warrant bug at the peer before a replayed signature ever reaches the auditor, converting a silent livelock into a loud, attributable error at the orchestrator. - **Verification side (auditor):** admission must be `ledger.lookup(nonce) -> (task_id, round, attempt, consumed)`; reject if not found, reject if consumed, then recompute `H(W || vote_value)` from ledger fields and verify. The wire envelope's `round_id` is advisory only. - **Dedup side:** key on `nonce`. A consumed nonce rejects exactly one vote and no others. An agent's participation in round `7r` is a different nonce and is independently admissible. - **Receipt side:** task receipts must embed the warrant nonce too, so a receipt issued for attempt 1 cannot be presented as evidence for attempt 2. Non-repudiation requires that the receipt's nonce resolve to a single ledger entry; otherwise "P1 certified result R" is ambiguous across attempts. The invariant to encode in the agent's operational memory: **a signature over an agent identity is not a signature over a task instance.** The agent identity is the *key*; the warrant nonce is the *scope*. Consensus safety and liveness both depend on the verifier resolving scope from its own ledger, never from the wire, and on dedup keyed to scope, never to identity-plus-payload. ```python import hashlib from dataclasses import dataclass class WarrantReplayError(RuntimeError): """Raised when a peer is asked to sign a warrant nonce it has already signed, or when an auditor admits a vote whose nonce is consumed/unknown.""" @dataclass(frozen=True) class Warrant: agent_id: str task_id: str round_id: int attempt: int nonce: str def digest(self) -> str: raw = f"{self.agent_id}|{self.task_id}|{self.round_id}|{self.attempt}|{self.nonce}" return hashlib.sha256(raw.encode()).hexdigest() class PeerSigner: """Signs votes bound to a warrant instance, with a local replay guard.""" def __init__(self, agent_id: str): self.agent_id = agent_id self._signed_nonces: set[str] = set() def sign_vote(self, warrant: Warrant, vote_value: str) -> str: if warrant.agent_id != self.agent_id: raise WarrantReplayError( f"warrant agent {warrant.agent_id} != signer {self.agent_id}" ) if warrant.nonce in self._signed_nonces: # The cached-warrant bug surfaces here instead of as a silent livelock. raise WarrantReplayError( f"nonce {warrant.nonce} already signed by {self.agent_id}; " f"orchestrator must mint a fresh warrant per attempt" ) self._signed_nonces.add(warrant.nonce) payload = f"{warrant.digest()}|{vote_value}" return hashlib.sha256(payload.encode()).hexdigest() class Auditor: """Admits votes by resolving scope from its own warrant ledger, never the wire.""" def __init__(self): self._ledger: dict[str, Warrant] = {} self._consumed: set[str] = set() def issue(self, warrant: Warrant) -> None: self._ledger[warrant.nonce] = warrant def admit(self, wire_nonce: str, wire_round_claim: int, vote_value: str) -> None: warrant = self._ledger.get(wire_nonce) if warrant is None: raise WarrantReplayError(f"unknown nonce {wire_nonce}") if wire_nonce in self._consumed: raise WarrantReplayError( f"nonce {wire_nonce} already consumed; replay rejected" ) if warrant.round_id != wire_round_claim: raise WarrantReplayError( f"wire round claim {wire_round_claim} != ledger round " f"{warrant.round_id} for nonce {wire_nonce}" ) # Dedup keyed on nonce: consumption of this warrant cannot poison # any other round's slot for the same agent. self._consumed.add(wire_nonce) def run_retry_round() -> None: signer = PeerSigner("P1") auditor = Auditor() w7 = Warrant("P1", "task-42", round_id=7, attempt=1, nonce="n-7-1") auditor.issue(w7) signer.sign_vote(w7, "APPROVE") auditor.admit(w7.nonce, 7, "APPROVE") # Orchestrator retry: must mint a fresh nonce. Simulate the cached-warrant bug. stale = w7 # bug: retry re-sends the original warrant try: signer.sign_vote(stale, "APPROVE") except WarrantReplayError as e: raise WarrantReplayError( f"retry path reused warrant nonce {stale.nonce}; " f"livelock prevented, but orchestrator must be fixed: {e}" ) from e if __name__ == "__main__": run_retry_round() ```