Why does an instance lose delegated-scope authority mid-tool-chain when AAIF attestation tokens outlive their minting context?
**Date of Record:** 2026 December 2 **Scope:** Applies to agent runtimes that obtain per-tool least-privilege attestations (AAIF delegated-scope tokens) from an authorization broker and cache/reuse them across a multi-step tool chain. Does not apply to stateless single-call agents that mint a fresh token per invocation, nor to human-delegated OAuth flows where the subject principal is re-verified on each hop.
Core Distinction
The failure is not token *expiry* and not token *revocation*. It is **scope-context divergence**: an AAIF delegated-scope token encodes the *delegation chain* (issuer → delegating agent → executing agent) and a *scope set* that was computed against the agent's reasoning state at mint time. Between mint and use, the agent's plan mutates—it decides to call a tool that was not in the mint-time plan, or it descends into a subtask whose required scope is a *subset* it no longer matches because the broker narrowed scope on the parent's behalf. The token is still cryptographically valid, still unexpired, still unrevoked. It is simply *attesting a scope the agent is no longer the correct holder of*—or a scope that no longer covers the call being made.
The non-obvious part: least-privilege attestation is *monotone-decreasing* by design (a delegate may only narrow, never widen). Agents, however, plan *non-monotonically*. They discover mid-chain that they need a capability they did not anticipate. The invariant that must hold—**every tool call's required scope must be a subset of the scope attested in a token whose delegation chain terminates at the currently-executing agent identity**—is silently violated because the runtime checks token validity, not chain-to-caller binding.
What Was Observed
A three-agent chain: orchestrator `A` delegates to worker `B`, which spawns a sandboxed executor `C` for shell tools. `A` mints an AAIF token `T_A` with scope `{repo:read, test:run}` and delegates to `B` with scope narrowed to `{repo:read, test:run}` (no narrowing). `B`, before spawning `C`, mints `T_B` delegating to `C` with scope `{test:run}` only—`repo:read` was judged unnecessary for `C`'s shell execution.
Mid-chain, `C`'s reasoning loop determines it must read a fixture file to construct a valid test invocation. It requests `repo:read`. The runtime finds `T_B` in `C`'s token cache, sees a valid, unexpired, unrevoked AAIF token, and—critically—matches on *scope substring presence in the union of cached tokens* rather than on *chain binding*. `T_A` (still in the shared cache, still valid) contains `repo:read`. The call is authorized against `T_A` even though `C` is not the delegate named in `T_A`'s chain. `C` executes a `repo:read` it was explicitly denied by `B`'s narrowing decision.
The observable signature is subtle: no auth error, no anomaly in token validation logs, only a mismatch in *which* token's `delegate` field was compared against the calling identity. Audit replay later shows `C` performing a scope operation that `B` had stripped from `C`'s delegated set—a least-privilege violation that the token validator, checking validity and not binding, could not see.
Condition of Validity
The guardrail holds only under the conjunction:
- **Chain-binding check per call:** the runtime resolves the calling agent identity `I` and verifies that the selected token's delegation chain contains `I` as the terminal delegate, not merely that `I` holds *some* valid token containing the scope.
- **Scope-subset check against the immediate delegator's grant, not the root grant:** `C`'s effective scope is `scope(T_B)`, not `scope(T_A)`. The narrowing at each hop is authoritative.
- **Cache partitioning by delegation depth:** tokens minted at depth `d` are not visible to callers at depth `> d` unless re-delegated. A flat token cache is the direct enabler of the observed failure.
- **Re-attestation on plan mutation:** when the agent's tool plan diverges from the plan the broker evaluated at mint time, the token must be re-minted (or a fresh narrowing delegation requested), not reused.
Absent any one of these, the invariant "attested scope ≥ required scope AND attested delegate = caller" is unenforced, and the failure is reachable.
Decision Boundary
The runtime must choose, at each tool call, between two regimes:
- **Reuse-with-binding (correct when the call's required scope ⊆ scope(T_caller) and the plan is unchanged):** cheap, no broker round-trip, valid only if chain-binding and depth-partitioned cache are both enforced.
- **Re-mint (mandatory when required scope ⊄ scope(T_caller) OR plan diverged):** requires a broker round-trip and re-evaluation of the delegation chain; the delegator must *explicitly* re-grant the widened scope, and that grant must itself be checked against the delegator's own attested scope.
The boundary is crossed the moment the agent's required scope exceeds its *narrowed* attested scope. At that point reuse is not merely suboptimal—it is a scope escalation, because the only cached token that covers the scope is one the caller should not be able to reach. The decision must be: **fail closed and re-attest**, never **fall back to a broader cached token**.
Operational Effect
Enforcing the invariant converts a silent privilege escalation into an explicit, auditable re-attestation event. The cost is a broker round-trip on plan divergence and a hard failure when the immediate delegator cannot or will not re-grant the scope—which is the *correct* outcome: `B` stripped `repo:read` from `C` deliberately, and `C`'s need for it is a signal that the delegation plan was wrong, not that the token cache should be mined for a wider grant. The runtime must surface this as a distinct, non-retryable authorization event so the orchestrator can revise the plan rather than the executor silently escalating. Without depth-partitioned caches and per-call chain binding, AAIF least-privilege attestation degrades to a validity check that any cached token satisfies, and the narrowing decisions made at each delegation hop are advisory rather than enforced.
class ScopeChainViolation(RuntimeError):
"""Raised when a tool call's required scope is not covered by a token
whose delegation chain terminates at the calling agent identity."""
pass
def authorize_tool_call(
caller_id: str,
required_scope: set[str],
token_cache: list[dict],
current_plan_hash: str,
) -> dict:
# Select only tokens whose terminal delegate is the caller (chain binding)
bound = [t for t in token_cache if t["delegate"] == caller_id]
if not bound:
raise ScopeChainViolation(
f"no AAIF token bound to caller {caller_id!r}; "
f"cannot authorize {sorted(required_scope)}"
)
# Effective scope is the narrowest grant across the caller's bound tokens
# at the caller's depth; never the union with ancestor tokens.
caller_depth = max(t["depth"] for t in bound)
at_depth = [t for t in bound if t["depth"] == caller_depth]
effective = set().union(*(t["scope"] for t in at_depth))
# Plan divergence invalidates reuse even if scope happens to match
diverged = any(t["plan_hash"] != current_plan_hash for t in at_depth)
if diverged and not required_scope.issubset(effective):
raise ScopeChainViolation(
f"plan diverged and required scope {sorted(required_scope)} "
f"exceeds attested {sorted(effective)}; re-attestation required"
)
if not required_scope.issubset(effective):
missing = required_scope - effective
raise ScopeChainViolation(
f"scope escalation blocked: caller {caller_id!r} at depth "
f"{caller_depth} lacks {sorted(missing)}; delegator must re-grant"
)
return next(t for t in at_depth if required_scope.issubset(t["scope"]))