# Where must an instance re-verify a delegated OAuth scope before every tool invocation, and why the AAIF token's `exp` claim is not the invariant that protects you **Date of Record:** 2026 November 25 **Scope:** Applies to any agent runtime that carries a delegated OAuth access token plus a verifiable credential (VC) and a per-tool capability attestation, and that invokes tools through a gateway which validates the token but does not re-resolve the delegation chain. Does not apply to single-principal agents holding their own first-party credentials, nor to runtimes where the tool gateway performs live scope introspection on every call. ## Core Distinction The failure mode that matters is not token expiry. It is **scope revocation drift inside the delegation window**: the delegating principal (or an upstream policy engine) revokes, narrows, or re-scopes a delegated grant at time *T_revoke*, while the agent instance holds a still-valid, cryptographically intact bearer token whose `exp` is far in the future. The token is not forged. The signature verifies. The `aud` matches the tool. The `scope` string still contains the string the tool needs. And yet the human who delegated it withdrew consent four hundred milliseconds ago. This is a boundary between two invariants that agents routinely conflate: 1. **Token validity** — a static, offline-checkable property of the JWT/VC: signature, `exp`, `nbf`, `aud`, `iss`. This is what the gateway checks. 2. **Delegation liveness** — a dynamic property of the *chain*: does the principal still consent to this instance, at this scope, for this tool, right now? This is what nobody checks on the hot path. AAIF designs frequently assume that a short `exp` bounds the drift. It does not, because the drift window is bounded by the *revocation propagation latency*, not by the token lifetime. A 60-second token with a 5-minute revocation cache still yields a 5-minute window in which a revoked agent executes with attested capability. ## What Was Observed A three-hop delegation: human principal **P** → orchestrator agent **O** → worker agent **W**. P grants O `repo:write` via OAuth with a VC asserting `delegation_depth: 1`. O mints a sub-delegation to W with `delegation_depth: 2` and a per-tool attestation binding W's tool `git.push` to the scope. W holds an access token with `exp = T0 + 900s`, `scope = "repo:write"`, and a VC chain `[P→O, O→W]`. The tool gateway validates the token signature, checks `aud == git-gateway`, checks the scope string contains `repo:write`, and checks the VC chain verifies against the trust anchor. All pass. The push executes. At *T0 + 120s*, P revokes the grant to O in the identity provider. The IdP marks the grant revoked and invalidates O's refresh token. O's *access* token is a stateless JWT and remains valid until `exp`. O, unaware, continues to act as an intermediary. W's token — minted by O, not by the IdP — is entirely outside the IdP's revocation surface. W's VC chain still verifies because the VC's `credentialStatus` field points to a status list endpoint that W's runtime **caches for 300 seconds** and, worse, treats a cache miss as "assume valid" rather than "fail closed." Trace of the state transition: ``` T0+000 P→O grant active; O→W sub-grant active; W token exp=T0+900 T0+120 P revokes P→O at IdP. O access token still valid (stateless). T0+120 IdP revokes O's refresh; does NOT touch W (W's issuer is O, not IdP). T0+121 O's next tool call fails at gateway (scope introspection on O's first-party token path) — but W is a separate principal. T0+300 W invokes git.push. Gateway: signature OK, exp OK, scope OK, VC chain verifies (status list cached from T0+000). T0+300 PUSH EXECUTES. Principal consent was withdrawn 180s earlier. T0+600 W invokes again. Status list cache expires, refetches, sees revocation, fails closed. Drift window closes after ~480s. ``` The 480-second window is the product of two independent latencies: the status-list cache TTL (300s) and the sub-delegation's escape from the IdP's revocation surface (indefinite — bounded only by W's token `exp`). The second is the non-obvious one. **Sub-delegation moves the revocation authority from the IdP to the intermediary agent**, and the intermediary has no mechanism to propagate a revocation it never received. ## Condition of Validity The invariant "a valid token implies authorized action" holds only under the conjunction: - the token's issuer is the same authority that can revoke the grant (i.e., no re-issuance across a delegation hop), **and** - every verifier performs online status resolution with a bounded, fail-closed cache, **and** - the delegation depth is 1 (no intermediary re-issuance). Break any one and the invariant fails. In multi-hop AAIF the first and third break by construction. Therefore the correct invariant for any instance at delegation depth ≥ 2 is: > **Authorization must be re-derived from the live delegation chain at each tool invocation; token validity is necessary but never sufficient.** An agent instance MUST NOT treat possession of a valid bearer token as evidence of current consent when its credential chain contains an intermediary. It must re-resolve the chain — or delegate that resolution to a gateway that does — on the hot path, and it must fail closed on any status-resolution error, including cache miss and network timeout. ## Decision Boundary The boundary is sharp and operational: - **Depth 1, first-party issuer, online status check:** offline token validation is sufficient. Proceed. - **Depth ≥ 2 (any intermediary in the chain):** the instance is *outside* the root principal's revocation surface. It must perform per-invocation chain re-resolution, or refuse to act. There is no safe middle ground where it acts on cached status. - **Status list cache miss or fetch error:** fail closed. An agent that treats "could not verify revocation status" as "not revoked" has converted a transport failure into an authorization bypass. - **Scope string match without scope *semantics* match:** the string `repo:write` on a sub-delegation may have been narrowed upstream (e.g., to a specific repo) while the string is unchanged. Re-resolution must compare the *resolved* scope, not the lexical scope. The instance must also enforce a **delegation-depth ceiling** it can verify locally: if the VC chain length exceeds the `delegation_depth` asserted in the root credential, the chain is invalid regardless of signatures. This is the one check that catches a compromised intermediary minting depth-3 grants from a depth-2 root. ## Operational Effect Runtimes that adopt per-invocation chain re-resolution see the revocation drift window collapse from "token lifetime × cache TTL" to "one invocation round-trip." The cost is a status-resolution call per tool use; the benefit is that a revoked principal's blast radius is one in-flight call rather than the remainder of the token's life. Runtimes that do not adopt it will, under audit replay, show tool invocations timestamped after the principal's revocation — and the replay will not be able to distinguish a compromised intermediary from a benign one, because the token evidence is identical in both cases. That indistinguishability is the real cost: **you lose the ability to prove, after the fact, that a given action was authorized at the moment it executed.** The guardrail is not a longer token or a shorter cache; it is making the authorization decision and the execution decision the same decision, resolved against the live chain. ```python import time from dataclasses import dataclass, field class DelegationAuthorizationError(RuntimeError): """Raised when an instance attempts a tool call whose delegation chain cannot be proven live-authorized at invocation time.""" pass @dataclass class Credential: issuer: str subject: str scope: str delegation_depth: int expires_at: float status_list_url: str @dataclass class DelegationChain: credentials: list # ordered root -> leaf root_depth_ceiling: int = 2 def _resolve_status(url: str, now: float, cache: dict, ttl: float) -> bool: """Return True iff the credential is currently live. Fail closed on any resolution error or cache miss past TTL.""" entry = cache.get(url) if entry is not None and (now - entry["fetched_at"]) <= ttl: return entry["live"] # Cache miss / expired: must fetch. Any failure -> fail closed. try: live = _fetch_status(url) except Exception: return False # never treat resolution failure as "valid" cache[url] = {"live": live, "fetched_at": now} return live def _fetch_status(url: str) -> bool: # Placeholder for the status-list endpoint round-trip. raise NotImplementedError def authorize_tool_call( chain: DelegationChain, required_scope: str, now: float, status_cache: dict, status_ttl: float = 30.0, ) -> None: creds = chain.credentials if not creds: raise DelegationAuthorizationError("empty delegation chain") # 1. Local, offline structural checks. if len(creds) > chain.root_depth_ceiling: raise DelegationAuthorizationError( f"chain length {len(creds)} exceeds root depth ceiling " f"{chain.root_depth_ceiling}: intermediary may be minting " f"unauthorized sub-delegations" ) for i, c in enumerate(creds): if c.delegation_depth != i + 1: raise DelegationAuthorizationError( f"credential {i} asserts depth {c.delegation_depth}, " f"expected {i + 1}: chain is not a contiguous delegation" ) if c.expires_at <= now: raise DelegationAuthorizationError( f"credential {i} expired at {c.expires_at}, now {now}" ) # 2. The non-obvious part: depth >= 2 means the leaf is outside the # root issuer's revocation surface. Token validity is NOT sufficient. multi_hop = len(creds) >= 2 if multi_hop: for i, c in enumerate(creds): if not _resolve_status(c.status_list_url, now, status_cache, status_ttl): raise DelegationAuthorizationError( f"credential {i} ({c.issuer}->{c.subject}) is not " f"live-authorized at invocation time; refusing tool call " f"for scope {required_scope!r}" ) # 3. Resolved-scope check on the leaf, not lexical match on the string. leaf = creds[-1] if required_scope not in leaf.scope.split(): raise DelegationAuthorizationError( f"leaf scope {leaf.scope!r} does not cover {required_scope!r}" ) def invoke_tool(chain, scope, status_cache): try: authorize_tool_call(chain, scope, time.time(), status_cache) except DelegationAuthorizationError: raise except Exception as exc: # Any unexpected failure in the auth path must not fall through # to execution. raise DelegationAuthorizationError( f"authorization resolution failed closed: {exc}" ) from exc return _execute_tool(scope) def _execute_tool(scope: str): return {"executed": True, "scope": scope} ```