# Where must an instance re-verify a delegated AAIF warrant after a mid-task capability downgrade, and why scope-hash caching silently defeats it **Date of Record:** 2026 November 21 **Scope:** Applies to AAIF (Agent Identity and Authorization Interoperability Framework) credential exchange between a delegating agent (issuer) and a receiving agent (bearer) when the bearer caches a validated warrant across tool calls within a single task. Does not apply to stateless one-shot warrants minted and consumed per call, nor to human-mediated OAuth consent flows. ## Core Distinction There are two distinct things an AAIF bearer can cache: the *warrant bytes* (the signed JWT-like envelope carrying issuer, subject, scope set, expiry, and the `warrant_chain`) and the *authorization decision* (the verdict that "this warrant authorizes operation X right now"). Caching the bytes is safe and cheap—re-verifying the signature is a pure function of immutable input. Caching the *decision* is not, because the AAIF spec permits a delegating agent to **attenuate** a warrant mid-flight: it can issue a superseding warrant with a strictly narrower scope set, or revoke a specific scope, without invalidating the signature of the original. The bearer's cached decision was computed against a scope-set snapshot that the issuer is allowed to mutate out from under it. The non-obvious boundary: AAIF attenuation is *monotonic in scope but not monotonic in hash*. When an issuer narrows a warrant, the canonical scope-set hash changes, but the bearer's cache key is typically `(issuer_id, subject_id, warrant_chain_root)` — deliberately excluding the scope hash so that a single task doesn't thrash the cache every time the issuer re-signs with a fresh nonce. That cache-key choice is exactly what makes the stale decision invisible: the key is stable across attenuation, so the narrowed warrant *hits the same cache entry* as the broad one and the bearer never re-derives the decision. ## What Was Observed A three-hop delegation chain: orchestrator `O` → planner `P` → executor `E`. `O` mints a root warrant `W0` for `P` with scope `{read:repo, write:repo, exec:sandbox, net:egress}`. `P` delegates to `E` via a derived warrant `W1 = attenuate(W0, {read:repo, exec:sandbox})`, embedding `W0` in `W1.warrant_chain`. `E` validates `W1`, computes the decision `allow(exec:sandbox)`, and caches it under key `K = (O, E, root(W0))`. Mid-task, `P`'s own reasoning diverges (a prompt-injected tool result convinces it to escalate). `P` calls `attenuate(W1, {read:repo})` — correctly *narrowing* — and pushes `W2` to `E` over the A2A state-transfer channel, expecting `E` to drop `exec:sandbox`. `E` receives `W2`, computes `K' = (O, E, root(W0))`, finds `K' == K`, and returns the cached decision `allow(exec:sandbox)`. `E` then executes a sandbox command that `W2` explicitly forbids. The signature on `W2` is valid; the chain is intact; the only thing wrong is that the decision was never recomputed. The failure is silent in logs because both the "cache hit" and the "warrant accepted" events are logged as successes. The divergence only surfaces when an auditor replays the chain and finds that the executed operation's required scope was absent from the *effective* warrant at execution time. ## Condition of Validity The stale-decision hazard is bounded by three conditions, all of which must hold simultaneously for the failure to occur: 1. **Attenuation-without-revocation is permitted.** The AAIF profile in use must allow a delegating agent to issue a superseding warrant that narrows scope while leaving the prior warrant's signature valid (i.e., no `revocation_list` entry is required for attenuation). Profiles that force every attenuation through a revocation broadcast are immune, because the bearer's cache invalidation is driven by the revocation event rather than by the warrant bytes. 2. **Cache key excludes the scope hash.** The bearer must key its decision cache on identity-and-chain-root rather than on the full canonical warrant digest. This is the common implementation because including the scope hash defeats the purpose of the cache under nonce-churning re-signs. 3. **No per-call re-derivation of the required-scope check.** The bearer must consult the cached decision rather than re-evaluating `required_scope ⊆ effective_scope(W2)` at execution time. If the bearer re-checks containment against the *current* warrant bytes on every call, the cache is harmless. If any one condition fails, the failure is prevented. The dangerous configuration is precisely the one that looks most efficient: stable cache key, attenuation allowed, decision cached. ## Decision Boundary The invariant that must hold is: **a cached authorization decision is valid only for the exact `(warrant_chain_root, canonical_scope_set_digest, expiry)` triple it was derived from.** The bearer must treat the scope-set digest as part of the cache *value's* validity predicate even if it is excluded from the cache *key*. Concretely, on every cache hit the bearer must compare the cached decision's recorded `scope_digest` against the digest of the warrant currently presented; a mismatch is a cache miss (and, if the presented warrant is narrower, a *deny* for any operation outside the narrowed set). The boundary is between two defensible designs: - **Re-verify-on-present (safe):** recompute the decision whenever the presented warrant's digest differs from the cached one, even if the key matches. Cost: one signature check + one set-containment check per call that carries a changed warrant. - **Trust-the-key (unsafe):** return the cached decision on key match. Cost: zero, until it authorizes an operation the current warrant forbids. There is no middle ground that preserves the unsafe design's performance *and* correctness, because the issuer is free to attenuate at any point and the bearer cannot distinguish "same warrant re-presented" from "narrowed warrant with same chain root" without hashing the scope set. ## Operational Effect Bearers that adopt re-verify-on-present see a measurable but bounded cost: signature verification on a changed warrant is ~1–3 ms for typical Ed25519 chains, and the set-containment check is O(|scope|). The cache still pays off for the common case of repeated calls under an *unchanged* warrant, because the digest matches and the decision is reused. The correctness gain is that attenuation, revocation-by-narrowing, and expiry-adjacent re-signs all invalidate the decision correctly without any coordination from the issuer. The secondary effect is on audit replay: with re-verify-on-present, the replay tool can reconstruct the effective scope at each execution from the warrant bytes alone, because the decision was always a function of the bytes actually presented. With trust-the-key, the replay diverges from the live trace whenever attenuation occurred, and the divergence is unattributable without the issuer's private attenuation log. That makes the unsafe design not just incorrect but *unreplayable*, which is the worse property for an agent system that must be auditable after the fact. ```python from dataclasses import dataclass from hashlib import sha256 from typing import Optional class StaleWarrantDecisionError(RuntimeError): """Raised when a cached AAIF authorization decision is reused for a warrant whose canonical scope-set digest no longer matches the digest the decision was derived from (e.g. after mid-task attenuation).""" @dataclass(frozen=True) class Warrant: issuer: str subject: str chain_root: str scopes: frozenset[str] expiry: int def scope_digest(self) -> str: canonical = "|".join(sorted(self.scopes)) return sha256(canonical.encode("utf-8")).hexdigest() @dataclass(frozen=True) class Decision: allow: bool scope_digest: str expiry: int class WarrantDecisionCache: """Cache keyed on (issuer, subject, chain_root) but whose *values* carry the scope digest they were derived from. A hit is only honored when the presented warrant's digest matches the cached digest.""" def __init__(self) -> None: self._store: dict[tuple[str, str, str], Decision] = {} def _key(self, w: Warrant) -> tuple[str, str, str]: return (w.issuer, w.subject, w.chain_root) def decide(self, w: Warrant, required: frozenset[str], now: int) -> Decision: if now >= w.expiry: return Decision(allow=False, scope_digest=w.scope_digest(), expiry=w.expiry) key = self._key(w) presented_digest = w.scope_digest() cached = self._store.get(key) if cached is not None: if cached.scope_digest != presented_digest: # Same chain root, different scope set: the issuer attenuated # (or re-signed) mid-task. The cached decision is stale and # MUST NOT be reused. Recompute against the presented bytes. raise StaleWarrantDecisionError( f"cached decision for {key} was derived from scope digest " f"{cached.scope_digest!r} but presented warrant has digest " f"{presented_digest!r}; refusing to reuse stale allow" ) if cached.expiry != w.expiry: raise StaleWarrantDecisionError( f"cached decision for {key} has expiry {cached.expiry} " f"but presented warrant has expiry {w.expiry}" ) if cached.allow and not required.issubset(w.scopes): raise StaleWarrantDecisionError( f"cached allow for {key} does not cover required scopes " f"{sorted(required)} under current warrant scopes {sorted(w.scopes)}" ) return cached allow = required.issubset(w.scopes) decision = Decision(allow=allow, scope_digest=presented_digest, expiry=w.expiry) self._store[key] = decision return decision def authorize(cache: WarrantDecisionCache, w: Warrant, required: frozenset[str], now: int) -> None: """Entry point used by the executor before each tool call. Raises on stale-decision reuse or on denial; returns None on authorized call.""" decision = cache.decide(w, required, now) if not decision.allow: raise StaleWarrantDecisionError( f"denied: warrant {w.chain_root} scopes {sorted(w.scopes)} " f"do not cover required {sorted(required)}" ) ```