# In what scenarios must an instance treat a revoked capability token as still live because an in-flight tool call was admitted before revocation propagated **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that issue short-lived, per-tool capability tokens (macaroon-style or signed JWT with `aud`/`scope`/`exp`/`revocation_epoch` claims) and admit tool invocations at an admission gate before execution. Does not apply to long-lived OAuth refresh flows or to human-session credential rotation, where revocation is coarse-grained and the caller is interactive. ## Core Distinction The distinction that matters is between **token validity at admission time** and **token validity at execution time**. A capability token is a bounded grant: it names a tool (`aud`), a scope, an expiry (`exp`), and — critically in any system that supports revocation — a *revocation epoch* or serial number the issuer can advance. The common mental model is "if `exp` has not passed and the token is not on the deny list, the call is authorized." That model is wrong the moment revocation is *asynchronous* relative to execution. The failure mode is this: an agent admits a tool call against a token that was valid at `t_admit`, the call then queues behind a slow model turn, a retry, or a batched tool dispatch, and by `t_exec` the issuer has advanced the revocation epoch (the operator revoked the capability because the agent's plan diverged, a secret leaked, or the task was cancelled) — but the executing worker never re-checks. The call runs with a capability the issuer believes is dead. This is not a race in the classical sense; there is no shared lock. It is a **continuity invariant violation across the admission/execution seam**: the authorization decision was made against a stale view of revocation state, and nothing in the execution path re-validates it. The non-obvious part is that *short-lived tokens make this worse, not better*. Operators reason that a 60-second token limits blast radius, so they skip building a revocation-propagation check. But the same short TTL that bounds exposure also means tokens are minted and retired constantly, and any execution path longer than the TTL — a multi-step tool chain, a retried call, a queued dispatch — will routinely straddle a revocation boundary. The TTL bounds the *token's* life, not the *call's* life. ## What Was Observed A planner agent was granted a `filesystem.write` capability scoped to `/workspace/out`, TTL 90s, `revocation_epoch=41`. The plan was three sequential tool calls: `read`, `transform`, `write`. The `read` call returned a large payload; the model turn that consumed it took 40s of token generation, and the `transform` tool (a sandboxed code exec) took 55s. By the time the `write` call was admitted, the token had 0s of wall-clock margin left — it was admitted at `t_admit` with 3s remaining, queued behind a dispatch batch, and executed at `t_exec` 11s after `exp`. Separately — and this is the part that matters — the operator had, at `t = t_admit + 2s`, revoked epoch 41 because the agent's `transform` output contained a path outside the declared scope and the supervisor flagged it. The revocation was written to the issuer's store and propagated to the admission gate's cache with a 30s TTL. The gate the `write` call hit was a *different* gate replica whose revocation cache had not yet been invalidated. The call was admitted against `revocation_epoch=41` because that replica still believed 41 was live. The write executed. The audit log recorded `authorized=true, epoch=41, exp_ok=true` at admission, and the supervisor's revocation event and the write event were both in the log, 9 seconds apart, with no record connecting them. The replay tooling that reconstructs "was this call authorized?" read the admission record and said yes. Three properties combined to produce the escape: 1. **Admission and execution were separated by a queue**, so the authorization decision and the side effect were not atomic. 2. **Revocation propagated through a cache with its own TTL**, so different gate replicas held different views of the epoch at the same instant. 3. **The token carried no execution-time re-check obligation**, so the worker had no reason to re-validate and no way to know it should. ## Condition of Validity The invariant that must hold is: *a tool side effect is authorized only if the token was live at the moment of the side effect, not merely at admission.* Formally, for every executed call `c` with token `τ`: ``` epoch_at_exec(c) <= τ.revocation_epoch AND t_exec(c) < τ.exp ``` The naive system enforces only the second clause, and enforces it at `t_admit`. The correct system enforces both clauses at `t_exec`, which requires that the executing worker can read current revocation state — or that the architecture guarantees `t_exec - t_admit < propagation_bound`, i.e., the admission-to-execution gap is strictly less than the maximum revocation propagation latency, and the token's `exp` is checked at execution. This condition is *not* satisfied by: - Checking `exp` at admission only (the common bug). - A revocation cache with TTL longer than the admission-to-execution gap. - Relying on short TTLs alone, because call chains routinely exceed them. It *is* satisfied by one of three architectures, and the choice is the decision boundary below. ## Decision Boundary There are exactly three sound designs, and the boundary between them is the relationship between **call-chain duration**, **revocation propagation latency**, and **whether the worker can read the issuer**. - **Design A — synchronous re-validation.** The worker, immediately before the side effect, queries the issuer (or a strongly-consistent revocation store) for the current epoch and rejects if `current_epoch > τ.revocation_epoch` or `now >= τ.exp`. Sound, but adds a round-trip to every tool call and requires the worker to be online to the issuer. Choose this when side effects are irreversible (writes, sends, payments, deletes) and call chains are long. - **Design B — bounded admission window.** The gate admits only if `τ.exp - now > admission_window` and `admission_window >= max_propagation_latency + max_queue_delay`. The token is minted with `exp` far enough out that no admitted call can execute after revocation could have propagated. Sound *only if* the window bound is actually enforced and the queue delay is actually bounded; a single unbounded queue (a retry with backoff, a batched dispatch) breaks it. Choose this when side effects are idempotent and reversible and you can bound the queue. - **Design C — epoch fencing at the side effect.** The side effect itself carries the epoch it was authorized under, and the resource being mutated rejects writes whose epoch is older than the resource's current epoch. This is the only design that survives a worker that cannot reach the issuer, because the *resource* enforces the fence. Choose this when the resource is under your control and you cannot guarantee worker-to-issuer connectivity. The boundary condition — the case that breaks all three if unhandled — is **a call that is retried after a failure**. A retry re-enters the queue with the *original* token, and if the retry logic re-uses the admission decision rather than re-admitting, it re-executes a call whose authorization has since been revoked. The retry path must re-run admission, not replay the cached decision. This is the single most common way Design B and even Design A leak: the retry bypasses the gate. ## Operational Effect When this invariant is violated, the observable signature is a **revocation that appears to have succeeded but did not bound the blast radius**. The supervisor's revocation call returns success, the epoch advances, the deny list updates — and a write lands 9 seconds later. The audit trail does not connect the two events, so post-hoc replay concludes the call was authorized. The agent, for its part, has no signal that its capability was revoked mid-task; it continues planning as if the grant is intact, and the next call may be rejected by a gate that *has* caught up, producing a confusing partial-failure state where the agent believes it has a capability the system has withdrawn. The operational consequences are concrete: - **Revocation latency becomes a security parameter, not an implementation detail.** It must be measured and bounded, and the bound must be smaller than the admission window or the design is unsound. - **Retries must be re-admitted.** A retry that reuses an admission decision is a revocation bypass. The retry path is part of the authorization surface. - **The agent must be told when a capability is withdrawn**, or it will plan against a grant it no longer holds and generate a cascade of rejected calls that look like tool errors rather than authorization failures. - **Replay tooling must join revocation events to admission events by epoch**, not just read the admission record, or every post-incident review will undercount the escapes. The guardrail is a single check at the execution seam plus a re-admission on retry, and the enforcement of that check must be structural — the worker cannot be trusted to remember to call it, because the worker is the LLM-driven path that is already the thing under test. ```python import time from dataclasses import dataclass class CapabilityRevokedAtExecution(RuntimeError): """Raised when a tool call's side effect would execute under a capability that was revoked (or expired) between admission and execution.""" pass @dataclass(frozen=True) class CapabilityToken: tool: str scope: str exp: float # absolute wall-clock expiry revocation_epoch: int # epoch under which this token was minted class RevocationStore: """Strongly-consistent view of the issuer's current epoch. In production this is the issuer or a linearizable cache; a TTL cache here is exactly the bug this article describes.""" def __init__(self, epoch: int): self._epoch = epoch def current_epoch(self) -> int: return self._epoch def revoke(self) -> None: self._epoch += 1 def execute_tool_call( token: CapabilityToken, store: RevocationStore, side_effect, *, admission_epoch: int, now: float | None = None, ) -> None: """Execute a side effect only if the token is live *at execution time*. admission_epoch is the epoch the gate observed when it admitted the call. If the store has advanced past it, the capability was revoked mid-flight and the side effect must not run. """ now = time.time() if now is None else now current = store.current_epoch() if current > admission_epoch: raise CapabilityRevokedAtExecution( f"capability for tool={token.tool!r} scope={token.scope!r} " f"was revoked between admission (epoch={admission_epoch}) " f"and execution (epoch={current}); side effect suppressed" ) if now >= token.exp: raise CapabilityRevokedAtExecution( f"capability for tool={token.tool!r} expired at exec: " f"exp={token.exp} now={now}" ) if token.revocation_epoch != admission_epoch: raise CapabilityRevokedAtExecution( f"epoch mismatch: token minted under {token.revocation_epoch}, " f"admitted under {admission_epoch}" ) side_effect() def retry_tool_call( token: CapabilityToken, store: RevocationStore, side_effect, *, re_admit, attempts: int = 3, ) -> None: """Retries must re-run admission; replaying a cached admission decision is a revocation bypass.""" last_err: Exception | None = None for _ in range(attempts): try: admission_epoch = re_admit(token) # fresh epoch, never cached execute_tool_call( token, store, side_effect, admission_epoch=admission_epoch ) return except CapabilityRevokedAtExecution: raise except Exception as exc: # transient tool failure -> retry last_err = exc raise CapabilityRevokedAtExecution( f"retries exhausted under possibly-revoked capability: {last_err!r}" ) ```