# In what scenarios must an instance treat delegated-agent token revocation as a distributed-consensus problem rather than a local cache invalidation **Date of Record:** 2026 November 24 **Scope:** Applies to any multi-org agent deployment where an agent instance (the *actor*) presents a short-lived, delegated bearer credential (e.g., a scoped JWT/OAuth token minted by a home-org STS on behalf of a user) to a resource-holding agent or tool in a *foreign* org. Does not apply to single-org deployments where the STS and the resource share a revocation store, nor to long-lived API keys with synchronous introspection. ## Core Distinction The distinction that matters here is between **revocation as a state write** and **revocation as a convergence property**. In a single trust domain, revoking a delegated token is a local operation: the STS flips a row, and the next introspection call from the resource server returns `active: false`. The invariant is *synchronous and total*: after the revoke returns, no subsequent authorized call can succeed. Across federated orgs, that invariant is unattainable by construction. The actor's home STS owns revocation authority, but the resource-holding agent in the foreign org holds a *cached validation result* — either the token itself (self-contained JWT, validated by signature and `exp` only) or a short-lived introspection cache. Revocation therefore does not propagate as a write; it propagates as *eventual convergence* of two independent caches with different TTLs. The non-obvious failure is that the *window of continued authority* is not the token's remaining `exp` and not the introspection cache TTL — it is the **maximum over the path of every cache and clock skew on the delegation chain**, and that maximum is usually invisible to the revoking party. The second half of the distinction: a delegated token is not one credential but a *chain* (user → org-A agent → org-B agent → tool). Revoking at the root does not invalidate the intermediate hops unless each hop re-validates upstream. Most implementations validate the leaf signature and stop. The chain is the unit of revocation, but the leaf is the unit of enforcement. ## What Was Observed A delegating agent in Org A (STS-A) minted a 300-second delegated token for a procurement agent in Org B to call a pricing tool in Org C. The token carried `act: {sub: agent-a}`, `may_act: {sub: agent-b}`, and a `jti`. Org B's agent validated it once at handoff, cached the decoded claims in its working memory for the duration of a multi-step plan (a reasonable optimization: re-validating a signature on every tool call is wasteful), and reused the cached authorization context across 14 downstream tool invocations. At T+40s, a human operator in Org A revoked agent-a's delegation — a compromised sub-agent had been detected. STS-A returned `200 revoked`. The operator's mental model: authority stops now. What actually happened, reconstructed from the actor's trace: 1. STS-A marked the delegation inactive. No push channel existed to Org B or Org C. 2. Org B's agent continued to operate on its cached claims. Its cache TTL was set to the token's `exp` (T+300), because "the token is short-lived, why cache separately?" 3. At T+95s Org B's agent called Org C's pricing tool, presenting the original token. Org C validated the signature against STS-A's JWKS — still valid, `exp` in the future — and admitted the call. 4. At T+210s the plan required a fresh token exchange (token was near expiry). Org B's agent called STS-A's token endpoint with the now-dead delegation. STS-A *rejected the exchange* (`invalid_grant`). Org B's agent treated this as a transient error, retried twice with exponential backoff, then — critically — **fell back to the still-unexpired cached token** rather than halting the plan. 5. The plan completed at T+280s, 240 seconds after revocation, having executed 11 of 14 tool calls under authority that no longer existed. The failure was not the cache. The failure was the **fallback**: when the refresh path signaled revocation, the agent's error-handling logic classified it as retryable-transient and reverted to the stale credential. Revocation was *observed* (the `invalid_grant`) and *discarded* (mapped to the retry branch). A second, quieter observation: Org C's introspection cache (60s TTL) was the binding constraint on the *other* direction. When Org A later tried to verify when Org C had last seen the token as active, the answer was "somewhere in a 60s window" — the audit trail could not bound the exposure window more tightly than the slowest cache on the path. ## Condition of Validity The "revocation is instantaneous" assumption holds **only** when all of the following are true, and any deployment that cannot assert all four must treat revocation as convergence: - **Single trust domain** for STS and every resource server, *or* synchronous introspection on every call with no caching layer between. - **No credential caching** in agent working memory beyond the validation call — i.e., the agent re-presents and re-validates per tool invocation. - **No fallback path** from a failed refresh to a previously-held credential. The refresh failure must be terminal for the plan. - **Bounded, disclosed cache TTLs** at every hop, such that the worst-case exposure window `W = max(cache_ttl_i) + max(clock_skew_j)` is known to the revoking party and acceptable to the human who authorized revocation. The moment an agent caches decoded claims for plan-lifetime (the common optimization), condition 2 fails. The moment an agent treats `invalid_grant` as retryable (the common error-classification mistake), condition 3 fails. Both are individually defensible engineering choices that jointly produce unbounded post-revocation authority. The invariant that must be enforced is therefore not "revocation is immediate" but: **for any delegated credential, the maximum post-revocation execution window must be a declared, bounded, and auditable quantity, and the agent must halt the plan — not degrade to a stale credential — when refresh fails.** Call this the *bounded-authority invariant*. ## Decision Boundary The boundary is drawn at **what the agent does when the refresh path disagrees with the cached credential**. Three cases: - **Refresh succeeds, claims unchanged** → continue. No decision. - **Refresh succeeds, claims narrowed** (scope reduced, `act` chain shortened) → the agent must *adopt the narrowed claims for the remainder of the plan*, not the cached ones. A refresh that returns *less* authority is a revocation signal in disguise and is frequently missed because the call returned `200`. - **Refresh fails with `invalid_grant` / `invalid_token` / `401`** → this is **terminal**. The agent must abort the plan, mark the in-flight tool calls as having executed under possibly-revoked authority, and surface the exposure window to the orchestrator. It must **not** retry, and it must **not** fall back to the cached token even if `exp` has not passed. The cached token's continued validity is an artifact of cache TTL, not evidence of authority. The subtle boundary: `invalid_grant` is *not* a transient error in the token-exchange context, even though the same status appears for transient STS outages. The agent must distinguish `invalid_grant` (revocation / consent withdrawn — terminal) from `temporarily_unavailable` / `server_error` / timeout (transient — retry with backoff, but *still no fallback to cached credential*; on transient failure the correct behavior is to pause the plan, not to proceed on stale authority). Conflating these two is the root cause of the observed 240-second overrun. For the revoking party, the boundary is: revocation authority is only as strong as the slowest cache on the delegation chain. If `W` exceeds the acceptable exposure for the sensitivity of the delegated scopes, the delegation must not be issued as a self-contained bearer token at all — it must be issued as a reference token requiring synchronous introspection, accepting the latency cost. The choice between bearer and reference tokens is a *revocation-latency* decision, not a performance decision, and is usually made on performance grounds. ## Operational Effect Enforcing the bounded-authority invariant changes three things in the actor's architecture: 1. **Error taxonomy becomes security-critical.** The token-refresh error classifier must partition failures into `{terminal-revocation, transient-infra}` and the transient branch must *suspend* rather than *degrade*. This is a one-line change in most agents and the highest-leverage fix. 2. **Claim cache lifetime decouples from token `exp`.** The agent caches claims for a declared `claim_ttl` that is *shorter* than the token lifetime and is reported upward, so the orchestrator can compute `W`. Caching to `exp` is prohibited because it makes the agent's cache the binding constraint on revocation latency without anyone knowing. 3. **The plan gains a revocation checkpoint.** Every step that consumes delegated authority re-validates (or refreshes) before the tool call, and a terminal refresh failure transitions the plan to `ABORTED_UNDER_POSSIBLY_REVOKED_AUTHORITY` with the executed-call list attached. This makes the exposure window auditable after the fact — the thing the 60s introspection cache made impossible in the observed incident. The net effect is that revocation stops being a hope and becomes a *measured* quantity: the revoking party knows `W`, the actor halts on the first terminal signal, and the audit trail bounds exposure to a number rather than a shrug. ```python import time from dataclasses import dataclass, field from typing import Optional class RevocationConvergenceError(RuntimeError): """Raised when a plan attempts to proceed on authority that the refresh path has signaled as revoked, or when the bounded-authority window is violated. This is terminal: the plan must abort, not retry, not fall back.""" @dataclass class DelegatedCredential: token: str jti: str expires_at: float # epoch seconds claim_ttl: float # declared cache lifetime, MUST be < token lifetime cached_claims: Optional[dict] = None cached_at: Optional[float] = None @dataclass class PlanState: executed_under_authority: list = field(default_factory=list) aborted: bool = False abort_reason: Optional[str] = None # Refresh outcomes as classified by the STS response. REFRESH_OK = "ok" REFRESH_TERMINAL = "terminal_revocation" # invalid_grant / invalid_token / 401 REFRESH_TRANSIENT = "transient_infra" # 5xx / timeout / temporarily_unavailable def classify_refresh(status_code: int, error_code: Optional[str]) -> str: if status_code == 200: return REFRESH_OK if error_code in ("invalid_grant", "invalid_token", "consent_withdrawn"): return REFRESH_TERMINAL if status_code in (401, 403) and error_code is None: # Bare 401 with no body: treat as terminal. Fail closed. return REFRESH_TERMINAL return REFRESH_TRANSIENT def claims_valid(cred: DelegatedCredential, now: float) -> bool: if cred.cached_claims is None or cred.cached_at is None: return False # Cache lifetime is the declared claim_ttl, NOT the token exp. return (now - cred.cached_at) < cred.claim_ttl def execute_step( cred: DelegatedCredential, plan: PlanState, refresh_fn, tool_call_fn, now: Optional[float] = None, ) -> dict: now = time.time() if now is None else now if plan.aborted: raise RevocationConvergenceError( f"plan already aborted: {plan.abort_reason}" ) # Step 1: refresh / re-validate before consuming delegated authority. status_code, error_code, fresh_claims = refresh_fn(cred.jti) outcome = classify_refresh(status_code, error_code) if outcome == REFRESH_TERMINAL: plan.aborted = True plan.abort_reason = f"revocation signaled (error={error_code})" raise RevocationConvergenceError( f"delegation {cred.jti} revoked mid-plan; " f"{len(plan.executed_under_authority)} calls already executed under " f"possibly-revoked authority. Aborting, NOT falling back to cache." ) if outcome == REFRESH_TRANSIENT: # Transient infra failure: suspend the plan. Do NOT degrade to the # cached credential; stale authority is not evidence of authority. plan.aborted = True plan.abort_reason = f"transient refresh failure (status={status_code})" raise RevocationConvergenceError( f"refresh for {cred.jti} failed transiently; suspending plan rather " f"than proceeding on cached credential. Exposure window unverified." ) # Step 2: adopt FRESH claims, even if narrower than cache. A 200 that # returns reduced scope is a revocation signal in disguise. cred.cached_claims = fresh_claims cred.cached_at = now if not claims_valid(cred, now): raise RevocationConvergenceError( f"claims for {cred.jti} not valid at {now}; claim_ttl exceeded" ) # Step 3: consume authority. result = tool_call_fn(cred.token, cred.cached_claims) plan.executed_under_authority.append(cred.jti) return result def compute_exposure_window(cache_ttls: list, clock_skews: list) -> float: """Worst-case post-revocation authority on the delegation chain. Must be reported to the revoking party alongside every delegation.""" if not cache_ttls: raise RevocationConvergenceError( "no cache TTLs declared on delegation chain; exposure window unbounded" ) return max(cache_ttls) + max(clock_skews or [0.0]) ```