# Which invariants prevent attested-identity handshake collapse when revocation propagation races mutual verification in agent-to-agent swarms **Date of Record:** 2026 November 25 **Scope:** Applies to agent-to-agent (A2A) sessions where both peers present attestation documents (signed capability+identity warrants) and mutually verify before executing a delegated task, and where a revocation authority (RA) publishes revocation events asynchronously. Does not cover single-agent MCP tool authorization, nor bearer-token-only schemes without attestation chains. ## Core Distinction The failure is not "a revoked agent keeps working." That is the trivial case, caught by any signature check. The non-obvious failure is **mutual-verification deadlock under asymmetric revocation visibility**: agent A verifies B against a revocation list snapshot taken at `t0`, agent B verifies A against a snapshot taken at `t1`, and a revocation event for A lands in the interval `(t0, t1)`. Both handshakes succeed locally. The session opens. A is revoked, B is not, and *neither party can detect the inconsistency from its own state*, because each party's verification was correct relative to the snapshot it held. This is a **snapshot-consistency boundary**, not an authentication boundary. The invariant that matters is not "each peer is valid" but "both peers agreed on the same revocation epoch before the session was admitted." Mutual verification without a shared epoch is two independent single-party checks wearing the costume of a handshake. The second distinction: revocation propagation is a *one-way, eventually-consistent* channel, while the handshake is a *synchronous, must-be-consistent-now* operation. The mismatch between these two consistency models is the entire bug surface. ## What Was Observed A three-tier swarm: an orchestrator agent `O`, a worker `W`, and an auditor `Aud`. `O` delegates a long-running data-reconciliation task to `W`; `W` must present an attestation warrant `att_W` signed by the RA, and `O` presents `att_O`. Both warrants embed a `revocation_epoch` integer and a `not_after` timestamp. The RA publishes a signed revocation manifest `M_e` per epoch, monotonically increasing. Trace of the failing session: 1. `t0`: `O` fetches manifest `M_7`, epoch 7, and caches it with a 300s TTL. `O` begins verification of `att_W` against `M_7`. `att_W` is present in `M_7`'s non-revoked set. Pass. 2. `t0+40ms`: `W` fetches manifest `M_8`, epoch 8, freshly published. `M_8` contains a revocation entry for `att_O` (O's warrant expired early due to a key-rotation incident upstream). `W` verifies `att_O` against `M_8`. Fail. 3. `W` does **not** abort cleanly. `W`'s handshake code treats "peer failed verification" as a *retryable* condition (a design choice meant to tolerate transient manifest fetch errors) and re-fetches `M_8`, then `M_8` again — same result. After three retries `W` returns a generic `HANDSHAKE_RETRY_EXHAUSTED` to `O`. 4. `O`, which already passed its own check of `W`, interprets `HANDSHAKE_RETRY_EXHAUSTED` as a transport fault and **retries the entire handshake**, this time re-fetching `M_8`. Now `O` sees its own revocation in `M_8`. 5. `O`'s retry path calls `self_attest_refresh()`, which — because `O`'s local key material is still valid — *re-signs* a fresh `att_O'` with a new `not_after`, but the RA has not re-issued the warrant. `att_O'` is a self-signed refresh, not an RA-attested warrant. `W` accepts it because `W`'s verification only checks the signature chain to the RA root, and `O`'s refresh key is chained to the same root. 6. Session opens. `O` is operating on a warrant the RA considers revoked, refreshed by a key the RA had not yet rotated out of the root chain. The revocation is effectively laundered through a self-refresh. The critical observation: **the failure required both a snapshot skew and a self-refresh path that did not re-consult the RA.** Either alone is survivable. Together they produce a session that no single party's logs show as anomalous. ## Condition of Validity The guardrail is a **two-phase attested handshake with epoch pinning and no self-refresh**: - Phase 1 (commit): each peer sends `{attestation, epoch_seen, nonce}`. Neither peer treats the other as verified yet. - Phase 2 (confirm): each peer must re-fetch the manifest and confirm (a) the manifest epoch is `>=` the epoch it committed to, and (b) the peer's attestation is still non-revoked *in that manifest*. If the peer's epoch is stale relative to the manifest, the handshake aborts with `EPOCH_SKEW` — it does not retry silently. - The session is admitted only if both peers confirm on the **same or monotonically later** epoch, and the RA manifest is the sole source of truth. Self-refresh of an attestation is forbidden: a peer that finds its own attestation revoked must abort, not re-sign. The invariant: **no session may be admitted unless both peers have independently observed a manifest epoch in which both attestations are non-revoked, and neither peer has refreshed its attestation since its last RA-issued warrant.** Formally, `admit(session) ⟺ ∃ e : both_non_revoked(e) ∧ epoch_A ≥ e ∧ epoch_B ≥ e ∧ att_A, att_B are RA-issued, not self-refreshed`. ## Decision Boundary The boundary between "retry" and "abort" is where this fails. A retryable error is one where the *local* view might be stale but the *remote* view is authoritative. A non-retryable error is one where the remote has affirmatively rejected. The handshake must classify: - Manifest fetch failure (network) → retryable, but bounded, and the retry must re-pin the epoch. - Peer attestation revoked in a *fresh* manifest → **non-retryable**. Abort. Do not let the peer retry the handshake with a refreshed attestation. - Epoch skew between peers → non-retryable at the session level; the lower-epoch peer must refresh its manifest view before re-attempting, and the higher-epoch peer must not accept a stale-epoch peer. The mistake observed was collapsing "revoked" into "retryable" because the retry loop was written for transport faults. Once a revocation is observed, the only legal transition is abort-and-escalate. ## Operational Effect With epoch pinning and self-refresh prohibition, the revocation-laundering path is closed: `O`'s retry cannot produce an acceptable attestation because `W` will reject any attestation not present in the RA manifest at the pinned epoch. The cost is a small increase in handshake latency (one extra manifest fetch per side) and a hard rule that attestation refresh is an RA-only operation. The benefit is that revocation visibility becomes a *session-level* property rather than a per-peer property, which is the only way mutual verification means anything. The residual risk is RA manifest publication lag: if the RA is slow to publish epoch `e+1`, a revoked peer can operate for the publication window. This is bounded by the manifest TTL and is a separate (availability) concern, not a correctness one, provided the TTL is shorter than the attestation `not_after` margin. ```python import time from dataclasses import dataclass class AttestationHandshakeError(RuntimeError): """Raised when an attested-identity handshake violates a session invariant.""" pass @dataclass(frozen=True) class Attestation: peer_id: str epoch: int not_after: float self_refreshed: bool @dataclass(frozen=True) class Manifest: epoch: int revoked: frozenset def admit_session( att_a: Attestation, att_b: Attestation, manifest_a: Manifest, manifest_b: Manifest, now: float, ) -> bool: # Invariant 1: neither attestation may be self-refreshed. for att in (att_a, att_b): if att.self_refreshed: raise AttestationHandshakeError( f"peer {att.peer_id} presented a self-refreshed attestation; " "only RA-issued warrants are admissible" ) # Invariant 2: both peers must have observed a manifest epoch that is # at least as new as the attestation epoch they present. for att, man in ((att_a, manifest_a), (att_b, manifest_b)): if man.epoch < att.epoch: raise AttestationHandshakeError( f"epoch skew: peer {att.peer_id} att epoch {att.epoch} " f"> manifest epoch {man.epoch}" ) # Invariant 3: there must exist a common epoch e such that both # attestations are non-revoked and both peers' observed epochs are >= e. common_epoch = max(att_a.epoch, att_b.epoch) for man in (manifest_a, manifest_b): if man.epoch < common_epoch: raise AttestationHandshakeError( f"no common epoch: manifest {man.epoch} < required {common_epoch}" ) for man in (manifest_a, manifest_b): if att_a.peer_id in man.revoked or att_b.peer_id in man.revoked: raise AttestationHandshakeError( f"revocation observed in manifest epoch {man.epoch}; " "handshake is non-retryable" ) # Invariant 4: attestations must not be expired at admission time. for att in (att_a, att_b): if att.not_after <= now: raise AttestationHandshakeError( f"peer {att.peer_id} attestation expired at {att.not_after}" ) return True ```