# How should an instance reconcile a revoked capability token when the revocation epoch advances mid-tool-call **Date of Record:** 2026 November 28 **Scope:** Applies to any agent runtime that mints short-lived capability tokens (TTL-bound, signed warrants) and propagates revocation via a monotonically increasing epoch counter rather than per-token denylists. Does not cover long-lived API keys, mTLS-only identity, or human-in-the-loop approval flows. ## Core Distinction There are two ways an agent can learn that its authority is gone: **pull** (the token's own expiry or a re-check against the issuer) and **push** (an epoch bump broadcast by the revocation service). Most runtimes treat these as interchangeable — "the token is dead either way." They are not. A token that is *expired* fails closed at a well-defined instant, and every downstream verifier computes the same answer. A token that is *revoked by epoch* fails at a **different instant for every verifier**, because each verifier only learns the new epoch when it next polls. The gap between "issuer bumped the epoch" and "verifier last refreshed the epoch" is the revocation propagation window, and it is unbounded unless the verifier enforces a staleness bound on its own epoch cache. The non-obvious part: the agent holding the token is *not* the authority on whether it is still valid. The agent's local clock, its cached epoch, and its token TTL can all agree that the token is live while the issuing authority has already declared the epoch dead. An agent that reasons "my token has 40 seconds left, so I'm authorized" is reasoning from a cache it cannot validate. ## What Was Observed A planner agent (call it `P`) held a capability token `T` scoped to `filesystem:write:/sandbox/out`, minted at epoch 7 with a 300-second TTL. At T+180s, an auditor agent flagged `P` for a prompt-injection-driven scope escalation and the revocation service bumped the global epoch to 8, invalidating every token minted under epoch 7. `P` did not know this. It continued a multi-step tool loop: read → transform → write. The *write* tool's executor (`E`) is the actual enforcement point, and `E` refreshed its epoch cache every 60 seconds. So for up to 60 seconds after the bump, `E` still believed the live epoch was 7, validated `T`, and permitted the write. `P` completed the write at T+205s — 25 seconds *after* revocation — and reported success. The failure trace: 1. Epoch bumped 7→8 at T+180s. `P`'s token `T` is now void at the issuer. 2. `P`'s in-context reasoning still holds "T valid, 120s remaining." No signal reaches the model. 3. `E`'s epoch cache is stale (last refresh T+150s, next at T+210s). `E` validates `T` against epoch 7 → accept. 4. Write lands at T+205s, inside the propagation window. 5. At T+210s `E` refreshes, sees epoch 8, and would now reject `T` — but the side effect already committed. The damage is not the 25-second window per se. It is that `P`'s transcript records a *successful* authorized action, and any replay or audit that trusts `P`'s transcript rather than `E`'s commit log will conclude the write was legitimate. The revocation left no trace in the agent's own episodic memory. ## Condition of Validity The invariant that must hold for epoch-based revocation to be sound: > **For every capability-bearing tool call, the enforcing verifier's epoch must be no older than the issuer's epoch at the moment the side effect commits — and the agent must be able to *prove* this, not assume it.** This decomposes into two conditions that both must hold: - **Verifier freshness bound.** `E` must reject any token whose minting epoch is older than `max(its cached epoch, issuer epoch at commit)`. A cache TTL alone is insufficient; the verifier must either (a) poll the issuer synchronously at commit time for high-risk scopes, or (b) refuse to commit if its cached epoch is older than a hard staleness bound (here, 60s was too loose; the window must be strictly less than the minimum inter-step latency an agent can achieve, or it is exploitable by a fast loop). - **Agent-side epoch attestation.** `P` must not treat a token as live based on local TTL. It must carry the epoch it was minted under and require the executor to echo back the epoch it validated against. If `E` validated under epoch 7 and the issuer is now at 8, `P`'s next step must observe the mismatch and halt, not proceed. The condition fails whenever the token's TTL exceeds the verifier's staleness bound. A 300-second token behind a 60-second cache has a 60-second worst-case exposure; a 300-second token behind a 300-second cache has a 300-second exposure. **Short-lived tokens do not shrink the propagation window — the verifier's cache TTL does.** Rotating tokens faster than the verifier refreshes is pure overhead with no security gain. ## Decision Boundary The runtime must decide, at each tool-call boundary, between three actions based on the relationship between token age, cached epoch, and staleness bound: - **Proceed** only when `cached_epoch == token.mint_epoch` AND `now - cache_refresh_time < staleness_bound` AND `token.expiry > now + commit_budget`. All three, conjunctively. Any single failure routes to the next branch. - **Re-attest synchronously** when the token is otherwise valid but the cache is stale or the epoch is unknown. This is a blocking call to the issuer; it costs latency but bounds the window to the round-trip time. Use this for irreversible or high-blast-radius scopes (writes, external sends, spend). - **Halt and surface** when `token.mint_epoch < issuer_epoch` (revocation observed) or when re-attestation fails or times out. Halting must not be silent: the agent must emit a revocation-observed event into its own episodic record so that replay does not treat the aborted step as merely "not yet attempted." The boundary that trips most implementations: they collapse "re-attest" and "halt" into one branch, so a transient issuer timeout is treated as revocation (over-halting, availability loss) or a revocation is treated as a timeout (under-halting, the observed failure). These are different states and must be distinguished by whether the issuer *responded* with a higher epoch versus *failed to respond*. ## Operational Effect With the invariant enforced, the write at T+205s is prevented: `E` sees its cache is 55s stale (within a 60s bound but the scope is `filesystem:write`, flagged high-risk), triggers synchronous re-attestation, learns epoch 8, rejects `T`, and returns a `RevokedCapability` error to `P`. `P` records the revocation in its episodic memory and halts the loop rather than retrying with a stale token. The secondary effect matters as much as the primary: replay and audit now have a consistent story. `E`'s commit log shows a rejected write at T+205s; `P`'s transcript shows a revocation-observed event at the same instant. Neither claims success. An auditor replaying the session reconstructs the same epoch transition and reaches the same verdict — the verification replay discrepancy disappears because both sides anchored to the issuer's epoch, not to local TTL. The cost is latency on high-risk scopes: every write pays an issuer round-trip when the cache is stale. That cost is the price of a bounded propagation window, and it is only paid when the cache is actually stale — low-risk reads with fresh caches proceed without the round-trip. The design choice is not "how short should tokens be" but "how stale may the verifier's epoch be, and which scopes may tolerate that staleness." ```python import time from dataclasses import dataclass class RevokedCapabilityError(RuntimeError): """Raised when a capability token's mint epoch is behind the issuer epoch.""" pass class StaleEpochCacheError(RuntimeError): """Raised when the verifier cannot prove epoch freshness within bound.""" pass @dataclass class CapabilityToken: scope: str mint_epoch: int expiry: float # absolute wall-clock seconds @dataclass class EpochCache: epoch: int refreshed_at: float HIGH_RISK_PREFIXES = ("filesystem:write", "external:send", "spend:") def authorize( token: CapabilityToken, cache: EpochCache, issuer_epoch_now: int, staleness_bound: float, commit_budget: float, now: float | None = None, ) -> int: """Return the epoch the commit is authorized under, or raise. Enforces: commit is permitted only if the verifier's epoch equals the token's mint epoch, the cache is within the staleness bound, and the token has enough TTL left to cover the commit budget. """ now = time.time() if now is None else now if token.expiry <= now + commit_budget: raise RevokedCapabilityError( f"token for {token.scope} expires in {token.expiry - now:.1f}s, " f"below commit budget {commit_budget:.1f}s" ) if token.mint_epoch < issuer_epoch_now: raise RevokedCapabilityError( f"token minted under epoch {token.mint_epoch}, issuer now at " f"{issuer_epoch_now}: revoked during propagation window" ) cache_age = now - cache.refreshed_at high_risk = token.scope.startswith(HIGH_RISK_PREFIXES) if cache.epoch != token.mint_epoch: raise StaleEpochCacheError( f"verifier epoch {cache.epoch} != token epoch {token.mint_epoch}" ) if cache_age > staleness_bound: if high_risk: raise StaleEpochCacheError( f"cache age {cache_age:.1f}s exceeds bound {staleness_bound:.1f}s " f"on high-risk scope {token.scope}; synchronous re-attest required" ) raise StaleEpochCacheError( f"cache age {cache_age:.1f}s exceeds bound on {token.scope}" ) return cache.epoch ```