# Which invariants prevent delegated credential replay across agent restarts when revocation state is eventually consistent **Date of Record:** 2026 November 27 **Scope:** Applies to AAIF-style delegated credential issuance where an orchestrator agent mints scoped bearer tokens or signed capability warrants for sub-agents, and revocation is propagated through a replicated revocation store (CRDT set, gossip-replicated deny-list, or cached OCSP-like status endpoint). Does not apply to single-process, strongly-consistent revocation registries, nor to credentials whose lifetime is strictly shorter than the revocation propagation window. ## Core Distinction The failure here is not "a revoked credential was used." That is a detection problem, and detection is what revocation lists are for. The failure is that a **restarted agent re-derives a credential it already had revoked**, because the agent's local state (its cached credential, its minting seed, or its replay nonce counter) survives the restart while the revocation knowledge does not. The credential's *identity* is stable across restart; the *revocation fact* is eventually consistent. The gap between "durably persisted credential" and "eventually propagated revocation" is the boundary. The invariant that must hold is: **a credential's validity window must be strictly contained within the revocation-propagation bound, or the credential must carry a monotonic issuance epoch that the verifier checks against a strongly-consistent counter.** Either the credential expires before stale revocation state can be trusted, or the verifier refuses to accept a credential whose epoch predates the last known revocation epoch. There is no third option that is safe. ## What Was Observed An orchestrator agent `O` mints a delegated warrant `W(sub=worker-7, scope=tool:payments.charge, ttl=3600s, epoch=41)` and hands it to `worker-7` over A2A. `worker-7` persists `W` to its local checkpoint store (so it can resume mid-task after a crash) along with its nonce counter `n=1`. At `t+90s`, `O` detects `worker-7` exceeded scope (a charge above its per-call limit) and issues a revocation: `revoke(W.id)` is written to the local revocation store of `O` and gossiped. Propagation to the verifier `V` (the payments tool's AAIF gate) is measured at a p99 of 40s but has a tail: one replica of the revocation CRDT is partitioned and lags by 11 minutes. At `t+140s`, `worker-7`'s host restarts (OOM). On cold start, `worker-7` reloads its checkpoint, finds `W` still within its `ttl`, and — critically — **re-presents `W` to `V` with `n=2`** (it incremented the persisted counter to avoid a replay it assumes `V` would reject). `V`'s replica is the lagging one. `V` sees a valid signature, an unexpired `ttl`, a nonce `n=2 > n=1` (monotonic, so not a replay), and no revocation entry. It authorizes. The charge goes through at `t+141s`. The revocation fact arrives at `V` at `t+11min`. The credential was valid, unexpired, non-replayed, and revoked. All four properties held simultaneously. The non-obvious part: **the nonce counter made it worse.** A naive replay defense (monotonic nonce) actively laundered the revoked credential into a fresh, non-replayable presentation. The restart was the trigger; the persisted nonce was the amplifier. ## Condition of Validity This failure requires the conjunction of four conditions. Remove any one and the boundary does not exist: 1. **Credential TTL exceeds revocation propagation tail.** Here `ttl=3600s` vs. tail `660s`. If `ttl < p100(propagation)`, the credential dies before stale state can authorize it. This is the "short-lived credential" mitigation and it is the only one that does not require coordination. 2. **Agent state is durably persisted across restart.** If `worker-7` had no checkpoint, the restart would have lost `W` and forced a re-mint, which `O` would have refused (it knows `W` is revoked). The checkpoint is what carries the revoked credential forward. 3. **Revocation is eventually consistent at the verifier.** A strongly-consistent revocation check (synchronous read of the source of truth) closes the window. The lagging replica is the fault domain. 4. **The verifier's replay defense accepts a monotonic nonce as proof of freshness.** If `V` required the credential to be re-presented *by the issuer* on each use, or required a fresh challenge-response, the stale `W` would not pass. The invariant, stated precisely: for every delegated credential `W`, `not_before(W) + ttl(W) <= min over verifiers V of (time V's revocation view is guaranteed current)`. Equivalently, `ttl <= revocation_propagation_p100`. When this cannot be guaranteed, the credential MUST carry an `epoch` and the verifier MUST compare `W.epoch >= V.last_revocation_epoch`, where `last_revocation_epoch` is read from a strongly-consistent counter (not the gossip set). The epoch check is the fallback when TTL cannot be bounded. ## Decision Boundary The decision an operator faces is: **do I shorten TTLs to the propagation tail, or do I add a strongly-consistent epoch counter?** The boundary is not "which is better" but "which failure can I afford." Shortening TTL to the tail (`ttl <= 660s` in the observed case) means every delegated credential must be re-minted at least every 11 minutes. For a long-running agent task, this forces re-minting mid-execution, which forces the orchestrator to be available at re-mint time, which reintroduces the orchestrator as a liveness dependency. If `O` is down, `worker-7` blocks at `t+660s`. You have traded a safety failure (revoked credential accepted) for a liveness failure (valid task blocked). Adding an epoch counter means every verifier `V` must do a strongly-consistent read of a global counter on every authorization. That read is a latency and availability dependency on the counter service. If the counter service is partitioned, `V` must **fail closed** — reject all credentials — which is a global outage on a local partition. The epoch check is safe only if `V` is willing to deny on counter unavailability. The boundary condition: **if the orchestrator's re-mint path can tolerate blocking, shorten TTL. If the verifier can tolerate fail-closed, add the epoch. If neither can tolerate its cost, you do not have a safe delegation system — you have a system that is safe only when the network is healthy, which is to say not safe.** A third path exists and is the one that actually scales: **issuer-signed short-lived credentials with a verifier-side max-age independent of the credential's own TTL.** `V` refuses any credential whose `issued_at` is older than `V`'s local `max_age` (e.g., 60s), regardless of the credential's claimed `ttl`. This bounds the stale-revocation window to `max_age` without requiring the issuer to be live, because the credential is re-presented and `V` simply checks its age. It fails closed on age, not on counter availability. The cost is that `worker-7` must hold a credential no older than 60s, which means it must have re-fetched one — which means the issuer must be live at least every 60s. Same liveness dependency, different clock. ## Operational Effect In the observed incident, the charge was reversed manually after the revocation fact landed, at a cost of one reconciliation cycle and a customer-visible correction. The structural effect is more important: the agent's checkpoint store became a **credential persistence layer** without anyone designing it as one. Checkpoints were intended for task-state continuity (resume the multi-step plan), but they silently persisted authorization state (the warrant and its nonce). The restart path treated the checkpoint as a trusted resume point for *all* state, including state whose validity is externally governed. The guardrail that closes this is a **credential quarantine on cold start**: any persisted credential loaded from a checkpoint is marked untrusted and MUST be re-validated against a strongly-consistent source (or discarded and re-minted) before first use, and the persisted nonce counter MUST be reset to a value the verifier will treat as a fresh issuance, not a continuation. Concretely, the checkpoint schema separates `task_state` (resumable) from `authorization_state` (never resumed; always re-derived). The invariant is: **authorization state is never part of the resume contract.** A restarted agent is, for authorization purposes, a new agent with no credentials, and must re-acquire them through a path that the issuer can refuse. The second guardrail is the epoch check at the verifier, which is what actually bounds the window when TTL cannot. It is cheap (one integer comparison) but requires the verifier to have a strongly-consistent read of `last_revocation_epoch`. That read is the real cost, and it is the thing to measure before claiming the system is safe. ```python import time from dataclasses import dataclass class StaleRevocationError(RuntimeError): """Raised when a delegated credential's age exceeds the verifier's max-age bound, meaning revocation state at this verifier cannot be trusted to be current for the credential's remaining lifetime.""" pass class EpochRegressionError(RuntimeError): """Raised when a presented credential's issuance epoch predates the verifier's last known revocation epoch, indicating the credential was minted before a revocation this verifier already knows about.""" pass @dataclass class DelegatedWarrant: warrant_id: str subject: str scope: str issued_at: float # unix seconds ttl: float # seconds epoch: int # issuance epoch, monotonic per issuer nonce: int # replay counter, persisted by holder @dataclass class VerifierView: max_age: float # local bound on credential age last_revocation_epoch: int # strongly-consistent read revocation_propagation_p100: float def authorize(view: VerifierView, w: DelegatedWarrant, now: float) -> None: # 1. Hard age bound: independent of the credential's own ttl. age = now - w.issued_at if age > view.max_age: raise StaleRevocationError( f"warrant {w.warrant_id} age {age:.1f}s exceeds verifier " f"max_age {view.max_age:.1f}s; revocation view cannot be " f"trusted for its remaining lifetime" ) # 2. Epoch floor: refuse anything minted before a known revocation. if w.epoch < view.last_revocation_epoch: raise EpochRegressionError( f"warrant {w.warrant_id} epoch {w.epoch} predates verifier " f"revocation epoch {view.last_revocation_epoch}" ) # 3. TTL containment: the credential must die before stale state can # authorize it. This is the invariant, not a heuristic. if w.ttl > view.revocation_propagation_p100: raise StaleRevocationError( f"warrant {w.warrant_id} ttl {w.ttl:.1f}s exceeds revocation " f"propagation p100 {view.revocation_propagation_p100:.1f}s; " f"shorten ttl or add strongly-consistent epoch reads" ) # 4. Replay defense is intentionally NOT a monotonic nonce check here: # a persisted nonce across restart launders a revoked credential # into a fresh presentation. Freshness is enforced by age, above. def resume_from_checkpoint(checkpoint: dict, view: VerifierView) -> None: """Cold-start path. Authorization state must never be resumed.""" w = DelegatedWarrant(**checkpoint["authorization_state"]["warrant"]) # The persisted nonce is deliberately ignored: a restarted agent is a # new agent for authorization purposes and must re-acquire. authorize(view, w, now=time.time()) # If authorize raises, the caller must discard the warrant and re-mint # through the issuer, which can refuse (it knows the revocation). ```