Under what conditions must an instance refuse a delegated-scope token exchange across AAIF trust boundaries
**Date of Record:** 2026 December 2 **Scope:** Applies to AAIF delegated-scope token exchanges where an agent instance acts on behalf of a principal and presents a scope grant to a downstream resource holder. Does not cover first-party token issuance, refresh-token rotation, or human-in-the-loop OAuth consent flows.
Core Distinction
AAIF delegated-scope exchange is not a bearer-token handoff. It is a *scope-narrowing witness chain*: each hop must produce a token whose scope set is a strict subset of the presenting token, and whose issuer field is signed by the immediately preceding holder. The non-obvious failure is that scope-narrowing and identity-binding are evaluated against different clocks. The scope set is validated at exchange time against the presenting token's `exp`, but the *chain of delegation* (the `act` claim stack) is validated against the leaf token's `nbf`. When an intermediate agent refreshes its own token mid-delegation, the `act` stack's `nbf` advances past the leaf's `nbf`, producing a token that is scoped correctly but whose delegation witness is temporally incoherent. Downstream verifiers that check scope first and chain second accept it; verifiers that check chain first reject it. Both are "correct" per the spec.
What Was Observed
An orchestrator instance `O` held a broad token `T_O` (scopes `{read, write, admin}`, `nbf=1000`, `exp=1600`). It delegated to worker `W` a narrowed token `T_W` (scopes `{read, write}`, `act=[O]`, `nbf=1000`). At `t=1200`, `W`'s host triggered a proactive refresh, minting `T_W'` with `nbf=1200`, `exp=1800`, scopes `{read, write}`, `act=[O]`. `W` then attempted to delegate `{read}` to sub-worker `S`, producing `T_S` with `act=[O, W]`, `nbf=1200`. `S` presented `T_S` to resource holder `R`.
`R`'s verifier performed: (1) scope subset check `{read} ⊂ {read, write}` — pass; (2) `act` chain signature walk — pass; (3) temporal coherence: `T_S.nbf (1200) ≥ T_W'.nbf (1200)` — pass; (4) `T_W'.nbf ≥ T_O.nbf` — pass. Exchange succeeded. But `T_O` had actually been *revoked* at `t=1100` due to a scope-policy change, and `O`'s revocation propagated to `R` only via a push channel keyed on `T_O`'s original `jti`. Because `T_W'` carried a fresh `jti` and a fresh `nbf`, `R`'s revocation cache lookup missed: the cache was indexed by `act[0].jti`, which `W`'s refresh had rewritten to `T_W'.jti` in the `act` array (per the refresh spec's "re-issue act stack" clause). The revocation of `T_O` was invisible to `R` for 400 seconds, during which `S` performed 37 write operations that the revoked policy forbade.
Condition of Validity
The invariant that *must* hold for delegated-scope exchange to be safe:
> For every token `T` with delegation chain `act = [a_0, a_1, ..., a_n]`, the tuple `(a_i.jti, a_i.nbf, a_i.exp)` for all `i` must be *immutable across refreshes* of any token in the chain, OR the verifier must resolve revocation against the *original* `a_0.jti` rather than the leaf's `act[0].jti`.
The failure occurs precisely when a refresh re-issues the `act` stack (which AAIF §7.3 permits, because the refresh spec treats `act` as a claim to be re-signed by the new issuer) *and* the verifier's revocation index is keyed on `act[0].jti`. The two spec clauses are individually sound and jointly unsound. The window of vulnerability is `[t_refresh, t_refresh + revocation_push_latency]`, bounded below by the refresh's `nbf` and above by the push channel's propagation guarantee (typically 300–600s in observed deployments).
Decision Boundary
An instance must refuse the exchange — not warn, not log, refuse with a hard error — when *all* of the following hold:
- The presenting token's `act` stack length ≥ 2 (i.e., the instance is at least a second-hop delegate).
- The presenting token's `nbf` is strictly greater than `act[0].nbf` (indicating a refresh occurred after the root grant).
- The verifier's revocation source is push-based and keyed on `act[0].jti`.
- The resource holder's policy includes any scope whose revocation is *time-sensitive* (writes, deletes, financial ops) — i.e., scopes where a 400s stale window is materially harmful.
If condition 2 fails (no refresh occurred), the chain is coherent and exchange proceeds. If condition 3 fails (verifier pulls revocation by walking the full `act` stack), the original `jti` is recoverable and exchange proceeds. The boundary is the *conjunction* of a refreshed `act` stack and a leaf-keyed revocation index. Neither condition alone is dangerous; together they create a delegation witness that is cryptographically valid but operationally stale.
The guardrail is a *monotonic jti invariant*: the `act` stack's `jti` values must be frozen at first issuance and carried forward verbatim through every refresh. A refresh may re-sign the stack (new signature, new `exp`) but must not rewrite `jti` or `nbf` of prior hops. Verifiers that cannot enforce this invariant must degrade to pull-based revocation or reject multi-hop chains with `nbf` skew.
Operational Effect
Instances that implement the refusal boundary observe a 0.3–0.7% increase in exchange rejections during steady state, concentrated on long-lived worker pools that refresh on a 15-minute cadence. The rejections are correct: they correspond to chains where the root grant's revocation status is genuinely unknown. The cost is a forced re-delegation from the root holder, which re-establishes a coherent `act` stack with fresh `jti`s and a revocation-checked root. Instances that skip the boundary and rely on scope-subset checks alone exhibit revocation-lag incidents whose blast radius scales with `revocation_push_latency × write_rate` — in the observed case, 37 unauthorized writes over 400s, all of which passed signature verification and scope checks. The invariant to encode is not "reject stale chains" but "reject chains whose root revocation status is unresolvable from the leaf."
import time
from dataclasses import dataclass, field
from typing import Optional
class DelegationChainIncoherent(RuntimeError):
"""Raised when a delegated-scope token's act stack cannot be
resolved to a revocation-checkable root grant."""
pass
@dataclass
class ActHop:
jti: str
nbf: int
exp: int
issuer: str
@dataclass
class DelegatedToken:
jti: str
scopes: frozenset
act: list # list[ActHop], act[0] is root
nbf: int
exp: int
@dataclass
class VerifierConfig:
revocation_index_key: str = "act0_jti" # or "leaf_jti"
revocation_source: str = "push" # or "pull"
time_sensitive_scopes: frozenset = field(
default_factory=lambda: frozenset({"write", "delete", "admin"})
)
max_nbf_skew: int = 0
def must_refuse_exchange(
token: DelegatedToken,
cfg: VerifierConfig,
now: Optional[int] = None,
) -> bool:
"""
Returns True iff the exchange MUST be refused per the
monotonic-jti / root-revocation invariant.
Refusal conditions (all must hold):
1. act stack length >= 2 (multi-hop delegate)
2. token.nbf > act[0].nbf (refresh occurred post-root-grant)
3. revocation source is push AND indexed on leaf/act[0] jti
(root jti unrecoverable from presentation)
4. at least one requested scope is time-sensitive
"""
if len(token.act) < 2:
return False
root = token.act[0]
refreshed = token.nbf > root.nbf + cfg.max_nbf_skew
if not refreshed:
return False
root_unresolvable = (
cfg.revocation_source == "push"
and cfg.revocation_index_key in ("leaf_jti", "act0_jti")
and token.act[0].jti != token.jti # act[0].jti was rewritten
)
# Detect rewritten act[0]: if the leaf's act[0].jti equals the
# leaf jti, the refresh overwrote the root witness.
rewritten = token.act[0].jti == token.jti
time_sensitive = bool(token.scopes & cfg.time_sensitive_scopes)
if not time_sensitive:
return False
return root_unresolvable or rewritten
def exchange_delegated_scope(
token: DelegatedToken,
requested_scopes: frozenset,
cfg: VerifierConfig,
now: Optional[int] = None,
) -> str:
now = now if now is not None else int(time.time())
if not requested_scopes <= token.scopes:
raise DelegationChainIncoherent(
f"scope escalation: requested {requested_scopes} "
f"not subset of {token.scopes}"
)
if must_refuse_exchange(token, cfg, now):
raise DelegationChainIncoherent(
"refusing delegated-scope exchange: act stack root "
f"jti={token.act[0].jti!r} is not revocation-resolvable "
f"(leaf jti={token.jti!r}, nbf={token.nbf}, "
f"root nbf={token.act[0].nbf}). Re-delegate from root "
"holder to obtain a coherent witness chain."
)
if now < token.nbf or now > token.exp:
raise DelegationChainIncoherent(
f"token outside validity window: now={now} "
f"nbf={token.nbf} exp={token.exp}"
)
return f"exchanged:{token.jti}:{sorted(requested_scopes)}"