# How does an instance detect that a delegated capability token was revoked mid-session when the revocation signal races the token's own expiry window **Date of Record:** 2026 November 26 **Scope:** Applies to agent-to-agent delegated authorization where a verifier instance holds a scoped capability token (JWT-like, MAC'd, or signed grant) issued by a delegating agent and intended to be revocable before `exp`. Does not apply to stateless bearer tokens with no revocation channel, nor to capability grants whose lifetime is strictly shorter than the revocation propagation budget. ## Core Distinction A delegated capability token carries two independent clocks: the **validity clock** (`nbf` → `exp`, embedded in the token and verified locally) and the **revocation clock** (a signal that must travel from the issuer's revocation store to the verifier via some channel — a CRL, a push notification, a status-list endpoint, or a peer message). The failure mode is not "the token expired" and not "the token was revoked." It is the **indistinguishable overlap window** in which the verifier's local view is simultaneously consistent with *valid* and with *revoked*, because the revocation signal has been emitted but not yet observed, and the token has not yet reached `exp` to force a local decision. The non-obvious part: most verifier designs assume revocation is a *terminal* state that, once entered, dominates all subsequent checks. In practice revocation is a *propagation event with latency*, and during that latency the verifier will happily execute scoped actions using a token whose grant has already been withdrawn at the source. The instance cannot distinguish "not yet revoked" from "revoked but signal in flight" by inspecting the token alone. The token is a snapshot of authority at issuance; it is not a live lease. ## What Was Observed A three-tier delegation: orchestrator `O` issues a scoped token `T` to worker `W` granting `tool:filesystem:write` on path prefix `/scratch/job-4471/` with `exp = T0 + 300s`. `W` spawns sub-agent `S` and re-delegates a narrowed token `T'` (prefix `/scratch/job-4471/out/`, `exp = T0 + 240s`). At `T0 + 90s`, `O` detects that job-4471 was reassigned and calls `revoke(T)` against its revocation store, which pushes a signed revocation record to a status list. The status list is polled by verifiers every 30s with a 5s jitter, and the poller for `S`'s host had last polled at `T0 + 88s`. Trace: 1. `T0 + 90s` — `O` marks `T` revoked; status list version `v = 118` published. 2. `T0 + 90s` to `T0 + 118s` — `S` continues to accept `T'` because its cached status list is `v = 117`, in which `T` is absent from the revoked set. `S` performs 14 `write` operations into `/scratch/job-4471/out/`. 3. `T0 + 118s` — `S`'s poller fetches `v = 118`, sees `T` revoked, and — critically — because `T'` was a *re-delegation* of `T`, `S` must decide whether `T`'s revocation cascades to `T'`. It does, but only if the verifier follows the `parent_jti` chain. `S`'s implementation checked `T'`'s own `jti` against the revoked set, found nothing, and continued. 4. `T0 + 240s` — `T'` expires. `S` stops. Total unauthorized write window: 150s, 41 write operations, all under a grant that was withdrawn at `T0 + 90s`. The second-order failure is the one worth recording: **revocation of a parent token does not automatically appear in the revoked set under the child's identifier.** A verifier that checks only the presented token's `jti` against the revocation set will pass a child token whose entire authority chain has been severed. The revocation signal propagated correctly and was still insufficient, because propagation addressed the wrong key. ## Condition of Validity The invariant that must hold for a verifier to treat a scoped token as *currently authorized* is: > For every token `T_k` in the presented token's delegation chain `T_0 ← T_1 ← … ← T_n`, the verifier's observed revocation state must be at least as new as the issuer's revocation state at the time `T_k` was last used, **and** `T_k` must be absent from that state, **and** the observed state must be no older than `max_staleness` where `max_staleness < min(exp_k) - now`. Three conjuncts, and the third is the one that most implementations drop. Without a bounded staleness assertion, a verifier cannot claim freshness; a cached status list of unknown age is not evidence of non-revocation, it is evidence of *not having checked*. The bound must be strictly less than the remaining lifetime of the shortest-lived token in the chain, otherwise the token can expire before the next required poll and the verifier will have executed on stale authority for the entire gap. A second condition: the revocation record must be **chain-aware**. The status list must either (a) enumerate every descendant `jti` of a revoked token at revocation time, or (b) require the verifier to walk `parent_jti` links and check each ancestor. Option (a) is bounded but requires the issuer to know the full descendant set, which it does not when delegation is peer-to-peer. Option (b) is the only sound choice for open delegation graphs, and it imposes the cost that chain depth multiplies the lookup. ## Decision Boundary The instance must distinguish four states, not two: - **Authorized-fresh**: chain clean, observed revocation state within `max_staleness`. Proceed. - **Authorized-stale**: chain clean, observed state older than `max_staleness`. This is *not* authorized. It is *unknown*, and unknown must fail closed for any action whose effect is not trivially reversible. - **Revoked-observed**: any ancestor in the revoked set. Halt, unwind, emit a revocation-observed event. - **Revoked-in-flight**: the token's `exp` minus now is less than the maximum plausible propagation latency `L_max` (measured, not guessed), *and* the verifier has no fresh state. This is the dangerous quadrant. The correct behavior is to refuse new actions, allow only idempotent reads, and force a synchronous status fetch before the next mutating call. The boundary that matters: `max_staleness` must be derived from measured `L_max` plus a safety margin, and must be validated at startup against the shortest `exp` the issuer is known to grant. If `max_staleness >= min_exp - now`, the verifier cannot ever satisfy the invariant and must refuse to accept tokens from that issuer. This is a configuration-time check, not a runtime one, and it is the check that would have caught the 150s window above: `max_staleness` was 35s, but the chain walk was missing, so the freshness bound was satisfied while the chain check was not. ## Operational Effect When the invariant holds, the verifier's authority view is *sound but not complete*: it may still act on a token that was revoked within the last `max_staleness` interval, but the window is bounded and known. When the invariant is violated — as in the trace — the window is unbounded by anything except `exp`, and the effect is that a revoked delegation continues to produce side effects under the original grant's scope for the remainder of the token's lifetime. For filesystem writes under `/scratch/job-4471/out/`, the effect was 41 stale writes; for a token scoped to `payments:transfer` or `secrets:read`, the same mechanism yields an unbounded exfiltration or transfer window measured in minutes. The architectural guardrail is a **chain-aware freshness gate** enforced at every tool-call boundary, not at session start: walk `parent_jti` to the root, assert each link absent from a status list whose version timestamp is within `max_staleness` of now, and refuse mutating actions when the freshness assertion cannot be satisfied. The gate must be re-evaluated per call because the token's remaining lifetime shrinks while the status list's staleness grows, and the two clocks cross. The following reference implementation encodes the gate and the specific failure it refuses to let pass. ```python import time from dataclasses import dataclass from typing import Mapping, Sequence class RevocationIndeterminate(RuntimeError): """Raised when a token's authorization state cannot be soundly determined.""" @dataclass(frozen=True) class Token: jti: str parent_jti: str | None exp: float # absolute epoch seconds scopes: frozenset[str] @dataclass(frozen=True) class RevocationView: version: int observed_at: float # epoch seconds when this view was fetched revoked: frozenset[str] def assert_chain_authorized( presented: Token, chain: Sequence[Token], view: RevocationView, max_staleness: float, now: float | None = None, ) -> None: now = time.time() if now is None else now # Freshness bound: an old view is not evidence of non-revocation. if now - view.observed_at > max_staleness: raise RevocationIndeterminate( f"revocation view v{view.version} is stale by " f"{now - view.observed_at:.1f}s > max_staleness {max_staleness:.1f}s" ) # The view must be no older than the shortest remaining lifetime, # otherwise the token can expire before the next required poll. shortest_remaining = min(t.exp for t in chain) - now if shortest_remaining <= 0: raise RevocationIndeterminate( f"token chain contains an expired link; remaining={shortest_remaining:.1f}s" ) if max_staleness >= shortest_remaining: raise RevocationIndeterminate( f"max_staleness {max_staleness:.1f}s >= shortest remaining " f"{shortest_remaining:.1f}s; freshness cannot be guaranteed" ) # Chain-aware check: any ancestor revoked severs the whole chain. for link in chain: if link.jti in view.revoked: raise RevocationIndeterminate( f"ancestor {link.jti} revoked (presented={presented.jti}); " f"descendant authority is severed" ) # Scope narrowing invariant: a child may never exceed its parent's scopes. for parent, child in zip(chain, chain[1:]): if not child.scopes <= parent.scopes: raise RevocationIndeterminate( f"scope escalation: {child.jti} grants " f"{child.scopes - parent.scopes} not held by {parent.jti}" ) def guarded_write( presented: Token, chain: Sequence[Token], view: RevocationView, max_staleness: float, path: str, ) -> None: assert_chain_authorized(presented, chain, view, max_staleness) if not any(s.startswith("tool:filesystem:write:") for s in presented.scopes): raise RevocationIndeterminate( f"presented token {presented.jti} lacks write scope for {path}" ) # ... perform the write only after the gate has passed ... ```