# Which invariants prevent split-brain identity during federated agent key rotation under AAIF **Date of Record:** 2026 November 26 **Scope:** Applies to AAIF (Agent Attribute & Identity Federation) deployments where a signing key is rotated for an agent instance whose signed warrants are concurrently held and re-presented by peer agents across two or more federation trust domains. Does not apply to single-domain deployments with a single authoritative revocation list, nor to ephemeral agents whose warrants never outlive a single rotation epoch. ## Core Distinction The failure mode is not "a revoked key is still trusted." It is subtler: **a rotation is atomic within the issuing domain but non-atomic across the federation**, so for a bounded window two valid, signed, verifiable warrants exist for the same agent identity — one under the old key, one under the new — and each is cryptographically indistinguishable from a forgery attempt to an auditor that has not yet learned the rotation happened. The invariant that must hold is *monotonic epoch visibility*: no verifier may ever accept a warrant whose `epoch` is lower than the highest epoch it has previously acknowledged for that `agent_id`, and the issuing domain must guarantee that revocation of epoch *N* is published to every trust domain *before* any warrant at epoch *N+1* is honored. AAIF makes the second half of that guarantee *asynchronous* by design (push gossip of revocation sets), which is exactly where the split brain lives. ## What Was Observed A fleet of 40 worker agents, each holding a 24-hour warrant signed by a domain controller `DC-A`, rotated their signing keys on a 6-hour cadence. Peer auditors in domain `DC-B` verified incoming warrants by resolving the issuer's JWKS and checking the warrant's `epoch` against a locally cached revocation set. During a coordinated rotation at T+00:00, `DC-A` published new public keys to its JWKS endpoint in ~180ms but its revocation gossip for the superseded epoch propagated to `DC-B` over a gossip fanout with a measured p99 of 4.2s. Trace of the failure: 1. Agent `w-17` presents a task-handoff warrant signed at epoch 11 to peer `a-03` in `DC-B`. `a-03` resolves JWKS, sees epoch 11 key is *absent* from the current key set (already rotated), but finds epoch 11 in its cached revocation set — the entry arrived 0.9s earlier. Verification passes as *revoked-but-known*; the handoff is accepted because the warrant's embedded `not_after` is still in the future and the revocation entry only flags the *key*, not the *warrant*. 2. Meanwhile `w-17` re-signs its next action at epoch 12 and presents to peer `a-09` in `DC-B`. `a-09` resolves JWKS, finds epoch 12 key present, and — critically — has **not yet received** the epoch-11 revocation gossip (its gossip peer is lagging). It accepts epoch 12 and, because it treats "latest epoch" as authoritative, records `agent_id=w-17 → epoch=12` in its local monotonicity table. 3. `a-09` now forwards a re-derived warrant for `w-17` back to `a-03` at epoch 12. `a-03`'s monotonicity table still holds `epoch=11` with the *revoked* flag set. The epoch-12 warrant arrives, and `a-03`'s verifier — which keyed its monotonicity check on `(agent_id, epoch)` rather than `agent_id` alone — sees a *new* key and accepts, but its audit log now contains two accepted warrants for `w-17` at adjacent epochs, one of which (`a-03`'s epoch-11 acceptance) it later cannot reconcile with `a-09`'s epoch-12 view. The observable symptom was not a security breach. It was **audit replay divergence**: two auditors in the same trust domain produced irreconcilable event logs for the same agent identity over a 4.2-second window, and the reconciliation job (which assumed a total order per `agent_id`) deadlocked retrying the merge. ## Condition of Validity The split brain is only possible when all of the following hold simultaneously: - The revocation set is propagated by **asynchronous gossip** rather than synchronous pull-on-verify, so propagation delay is unbounded relative to rotation cadence. - The verifier's monotonicity guard is keyed on `(agent_id, epoch)` instead of `agent_id`, allowing a higher epoch to be accepted without first confirming the lower epoch is revoked *at the verifier*. - The warrant's validity is bounded by `not_after` alone, with no `epoch_min`/`epoch_max` window that would make an epoch-11 warrant explicitly invalid once epoch 12 is observed. - At least two auditors in the same domain have different gossip lag, so their local revocation sets disagree on epoch 11 at the moment epoch 12 arrives. If any one of these is removed, the window collapses. Synchronous pull-on-verify removes the lag; keying monotonicity on `agent_id` forces the stale-epoch verifier to reject epoch 12 until it has caught up; an `epoch_max` bound on the warrant makes the epoch-11 acceptance self-invalidating; a single auditor has no peer to diverge from. ## Decision Boundary The architectural guardrail is a **two-phase epoch fence** enforced at the verifier, not the issuer: - Phase 1 (observe): a verifier that sees epoch *N+1* for an `agent_id` must record a *pending fence* at *N+1* but may not yet accept *N+1* warrants for forwarding — it may only accept them for *local* execution. - Phase 2 (commit): the fence commits only when the verifier has independently confirmed that epoch *N* is present in its revocation set. Until then, any warrant at epoch ≤ *N* is rejected outright (not "revoked-but-known"), and any warrant at *N+1* is held in a quarantine queue with a bounded TTL equal to the issuer's declared gossip p99 plus a safety margin. - The issuer must publish a signed `rotation_intent` record at epoch *N+1* that names the epoch being superseded, so verifiers can drive Phase 2 deterministically rather than waiting on gossip to arrive by luck. The boundary is sharp: **the issuer may not honor an epoch-*N+1* warrant from any peer until that peer has committed its fence**, and a peer that has not committed within the TTL must fail closed with an explicit `EpochFenceTimeout`, never fall back to accepting the higher epoch on the assumption that gossip will catch up. ## Operational Effect With the fence in place, the 4.2s gossip p99 became a hard quarantine window rather than a silent acceptance window. During rotation, epoch-12 warrants were held for a median 4.4s and released only after the epoch-11 revocation entry was locally confirmed. Audit replay divergence dropped to zero because both auditors in `DC-B` committed the *same* fence at the *same* epoch before either accepted a forwarded warrant. The cost was a measurable throughput dip at each rotation boundary (workers stalled up to the TTL), which is the correct trade: an agent that cannot prove its predecessor epoch is dead must not be trusted to carry a baton, even briefly. The invariant, stated compactly: **monotonic epoch visibility keyed on `agent_id`, with an explicit two-phase fence gated on local confirmation of the superseded-epoch revocation, and fail-closed on fence timeout.** Anything weaker converts an asynchronous gossip delay into an authenticated identity ambiguity. ```python import time from dataclasses import dataclass, field class EpochFenceTimeout(RuntimeError): """Raised when a verifier cannot confirm the superseded epoch's revocation within the rotation quarantine TTL, and therefore must fail closed rather than accept the higher epoch on faith.""" class MonotonicityViolation(RuntimeError): """Raised when a warrant's epoch is lower than the highest epoch already acknowledged for the same agent_id in this verifier's table.""" @dataclass class FenceState: agent_id: str highest_epoch: int pending_epoch: int | None = None pending_since: float | None = None superseded_confirmed: bool = False class EpochFenceVerifier: def __init__(self, quarantine_ttl_s: float = 6.0): self.ttl = quarantine_ttl_s self._table: dict[str, FenceState] = {} self._revoked: dict[str, set[int]] = {} def note_revocation(self, agent_id: str, epoch: int) -> None: self._revoked.setdefault(agent_id, set()).add(epoch) st = self._table.get(agent_id) if st and st.pending_epoch is not None and epoch == st.pending_epoch - 1: st.superseded_confirmed = True def verify(self, agent_id: str, epoch: int, now: float | None = None) -> None: now = time.monotonic() if now is None else now st = self._table.get(agent_id) if st is None: self._table[agent_id] = FenceState(agent_id, epoch) return if epoch < st.highest_epoch: raise MonotonicityViolation( f"{agent_id}: warrant epoch {epoch} < acknowledged {st.highest_epoch}" ) if epoch == st.highest_epoch: return # Higher epoch observed: open a pending fence, do not accept yet. if st.pending_epoch != epoch: st.pending_epoch = epoch st.pending_since = now st.superseded_confirmed = (st.highest_epoch in self._revoked.get(agent_id, set())) if not st.superseded_confirmed: if now - st.pending_since > self.ttl: raise EpochFenceTimeout( f"{agent_id}: epoch {epoch} fence unconfirmed for " f"{now - st.pending_since:.2f}s > ttl {self.ttl}s; " f"superseded epoch {st.highest_epoch} revocation not observed" ) # Quarantine: caller must retry, not accept. raise EpochFenceTimeout( f"{agent_id}: epoch {epoch} quarantined pending confirmation of " f"epoch {st.highest_epoch} revocation" ) st.highest_epoch = epoch st.pending_epoch = None st.pending_since = None st.superseded_confirmed = False ```