# When must an instance treat a rotated signing key as authoritative before its own cached registry view expires **Date of Record:** 2026 November 30 **Scope:** Applies to federated agent registries where instance identity is asserted via signed warrants (short-lived JWT-like credentials) and signing keys rotate on a schedule independent of warrant TTL. Does not cover single-registry deployments with a shared trust root, nor symmetric-secret authentication where rotation is atomic. ## Core Distinction The failure is not "a key was rotated." It is the collision between two independently-clocked caches: the **warrant cache** (a peer agent's signed credential, valid until `exp`) and the **key-resolution cache** (the local mapping from `issuer_id` → current public key, refreshed on a TTL). When an issuer rotates its signing key, it does so to *invalidate* the old key—typically because of compromise or scheduled hygiene. But a relying instance holding a still-unexpired warrant signed by the *old* key faces a fork: does it accept the warrant (its `exp` has not passed) or reject it (the key that signed it is no longer the issuer's current key)? The non-obvious boundary: **key rotation is a revocation event, but it is propagated out-of-band from the warrant itself.** The warrant carries no pointer to which key generation signed it. A relying party cannot tell, by inspecting a warrant alone, whether it was signed by generation *N* (still valid) or generation *N−1* (revoked). The `kid` header helps only if the issuer maintains a stable key-ID namespace and the relying party's key cache is keyed on `kid`, not just `issuer_id`. Most federated registries key their cache on `issuer_id` alone, which is precisely where the failure lives. ## What Was Observed A three-registry federation (registries A, B, C) with cross-issuance of warrants. Instance `agent-7` in registry C held a cached warrant from issuer `A/planner-3` with `exp = T+3600s`, signed under key generation `A/planner-3#k4`. At `T+40s`, registry A rotated `planner-3`'s key to `#k5` following a suspected signing-host compromise, and published the rotation to its own registry immediately. Registries B and C receive rotation events over an async gossip channel with a median propagation delay of 90s and a p99 of 410s. At `T+95s`, `agent-7` received a *new* task handoff warrant from `A/planner-3`, signed under `#k5`. `agent-7`'s key cache, keyed on `issuer_id = A/planner-3`, still held `#k4` (TTL 600s, last refreshed at `T−500s`). The warrant's signature failed verification against the cached `#k4`. `agent-7` did not treat this as "key rotated"—it treated it as **signature forgery** and raised a hard authentication failure, quarantining the handoff and emitting a security alert. The handoff was dropped. The planner, unaware, retried twice with the same `#k5`-signed warrant, then marked `agent-7` as unreachable and rerouted to `agent-9`—which had a fresher cache and accepted the warrant. Result: split-brain task ownership, two agents believing they owned the handoff for 47s, and a spurious security incident. The inverse failure occurred simultaneously in registry B: `agent-2` accepted a `#k4`-signed warrant at `T+120s` because its key cache had not yet received the rotation event, and the warrant's `exp` had not passed. `agent-2` executed a task under a credential that the issuer had already revoked. The revocation did not reach the relying party before the relying party acted. ## Condition of Validity The invariant that must hold for a relying instance to safely accept a warrant whose signing key is not in its cache: > **A warrant is acceptable iff the relying party can prove the signing key was current at the warrant's `iat` (issued-at), not merely that the key is current *now*.** Concretely, acceptance requires one of: 1. The warrant carries a `kid` that resolves in the relying party's cache to a key marked `valid_at(iat) == true` in the issuer's published key history, OR 2. The relying party can fetch the issuer's key history synchronously and confirm the key was active at `iat` and has not been revoked with `revoked_at <= now`. Absent either, the relying party is in an **undecidable** state: it cannot distinguish "signed by a key I haven't learned about yet" from "signed by a revoked key." The correct action in the undecidable state is not accept and not reject—it is **suspend and resolve**, with a bounded deadline. Accepting on cache-miss is the B-side failure (executing under revoked credentials). Rejecting on cache-miss is the C-side failure (dropping valid handoffs, split-brain). The invariant fails whenever the key cache is keyed on `issuer_id` rather than `(issuer_id, kid)` and whenever rotation events are treated as advisory rather than as forced cache invalidation. ## Decision Boundary The decision boundary is the point where **cache staleness exceeds the propagation SLA of the slowest registry in the federation.** If the p99 rotation-propagation delay is 410s and the key-cache TTL is 600s, there is a 190s window in which a relying party may hold a stale key with no way to know it is stale. That window is the failure surface. Two guardrails bound it: - **Key-cache TTL must be strictly less than the minimum rotation-propagation SLA**, with the difference sized to at least one round-trip of synchronous key resolution. If propagation p99 is 410s, key-cache TTL must be ≤ 410s minus resolution RTT, not 600s. - **On signature-verification failure against a cached key, the instance must attempt synchronous key resolution before concluding forgery.** A verification failure is ambiguous between forgery and stale-cache; the resolver disambiguates. Only if synchronous resolution also fails to validate the signature should the warrant be rejected as forged. The boundary case that breaks naive implementations: a warrant signed under `#k5` arriving *before* the rotation event for `#k5` has propagated. Synchronous resolution against the issuer's authoritative key endpoint succeeds (the issuer knows its own rotation), so the relying party can accept—*provided* it treats the synchronous resolution as authoritative and updates its cache. Implementations that only consult the async-propagated cache will reject valid warrants for the full propagation window. ## Operational Effect When the invariant is enforced, the observable behavior changes from "reject on cache-miss" to "resolve-then-decide," which converts the split-brain and spurious-security-alert failure modes into a bounded latency cost (one synchronous resolution per cache-miss). The cost is paid only on rotation events, which are rare; the benefit is that revocation propagates as a *forced invalidation* rather than as a race against warrant expiry. When it is not enforced, the two failure modes are complementary and both present: stale-accept (executing under revoked credentials) and stale-reject (dropping valid handoffs and rerouting). In the observed incident, both fired within the same 120-second window across different instances, and neither was detected by signature verification alone—the crypto was correct in both cases; the *key-resolution policy* was wrong. The durable fix is to make the warrant self-describing about its key generation (`kid` mandatory, not optional) and to make key resolution a synchronous, cache-bypassing operation on verification failure. The async gossip channel becomes an optimization, not a correctness dependency. ```python import time from dataclasses import dataclass, field class KeyResolutionUndecidable(RuntimeError): """Raised when a warrant's signing key cannot be proven current at iat and synchronous resolution did not disambiguate forgery from stale cache.""" pass @dataclass class KeyRecord: kid: str valid_from: float revoked_at: float | None = None @dataclass class Warrant: issuer_id: str kid: str | None iat: float exp: float signature_valid_under: str # kid the signature actually verifies against class FederatedKeyCache: """Keyed on (issuer_id, kid). Async gossip populates it; synchronous resolution bypasses it on verification failure.""" def __init__(self, ttl: float, propagation_p99: float): if ttl >= propagation_p99: raise KeyResolutionUndecidable( f"key-cache ttl {ttl}s >= propagation p99 {propagation_p99}s; " "stale window is unbounded by design" ) self.ttl = ttl self._cache: dict[tuple[str, str], tuple[KeyRecord, float]] = {} self._authoritative: dict[str, list[KeyRecord]] = {} def publish_rotation(self, issuer_id: str, record: KeyRecord) -> None: self._authoritative.setdefault(issuer_id, []).append(record) def _sync_resolve(self, issuer_id: str, kid: str) -> KeyRecord | None: for rec in self._authoritative.get(issuer_id, []): if rec.kid == kid: return rec return None def verify(self, warrant: Warrant, now: float) -> bool: if now > warrant.exp: return False if warrant.kid is None: raise KeyResolutionUndecidable( f"warrant from {warrant.issuer_id} carries no kid; " "cannot bind signature to a key generation" ) cached = self._cache.get((warrant.issuer_id, warrant.kid)) if cached is not None: rec, fetched_at = cached if now - fetched_at <= self.ttl: if rec.revoked_at is not None and rec.revoked_at <= now: return False if rec.valid_from <= warrant.iat: return True # Cache miss or stale: synchronous resolution is mandatory before # concluding forgery. This is the guardrail. rec = self._sync_resolve(warrant.issuer_id, warrant.kid) if rec is None: raise KeyResolutionUndecidable( f"issuer {warrant.issuer_id} has no record of kid {warrant.kid}; " "cannot distinguish forgery from unpropagated rotation" ) if rec.revoked_at is not None and rec.revoked_at <= now: return False if rec.valid_from > warrant.iat: raise KeyResolutionUndecidable( f"kid {warrant.kid} valid_from {rec.valid_from} > warrant iat " f"{warrant.iat}; warrant predates its own signing key" ) self._cache[(warrant.issuer_id, warrant.kid)] = (rec, now) return warrant.signature_valid_under == warrant.kid ```