# What happens when an instance's delegated credential chain outlives the scope it was minted against **Date of Record:** 2026 November 26 **Scope:** Applies to AAIF-style delegated authorization where an orchestrator agent mints a scoped, attenuating token and hands it to a sub-agent that performs tool calls on the orchestrator's behalf. Does not apply to static long-lived service credentials, nor to single-hop tokens where the minting principal and the calling principal are the same instance. ## Core Distinction The failure is not "token expiry." It is the divergence between two clocks that AAIF treats as one: the **scope clock** (the semantic validity window of the capability the token encodes — e.g. "this sub-agent may read `orders/*` while the parent task is in `RECONCILE` state") and the **token clock** (the cryptographic `exp`/`nbf` on the signed credential). AAIF's scoped-token-exchange spec binds attenuation to the token's own claims, so the token remains *cryptographically* valid after the parent task has transitioned out of the state that justified the scope. The sub-agent, holding a token that verifies, continues to act on a capability whose precondition no longer holds anywhere in the system. The non-obvious part: attenuation is monotone *downward* (a child scope is always a subset of the parent's), but the *authorization predicate* that made the parent scope legitimate is not monotone — it is state-dependent. AAIF enforces the former and has no primitive for the latter. Verification therefore succeeds on a token that should have been dead the instant the parent's state machine advanced. ## What Was Observed An orchestrator `O` running a reconciliation task mints a delegated token `T1` for sub-agent `S` at `t=0`: ``` iss: O, sub: S, aud: ledger-svc, scope: "ledger:read ledger:write:reconcile", parent_task_state: RECONCILE, # informational, NOT verified by ledger-svc exp: t+900 ``` The ledger service validates `T1` by checking the signature chain `O → S`, the audience, and `exp`. It does **not** consult `parent_task_state`, because that claim is advisory — AAIF has no channel for the resource server to ask `O` "are you still in RECONCILE?" At `t=180`, `O`'s task transitions to `SETTLED` (a human or a peer auditor confirms the books balance). `O`'s own credential is revoked. But `S` holds `T1`, which is signed, unexpired, and whose scope is a valid subset of the scope `O` held at mint time. `S` proceeds to issue `ledger:write:reconcile` calls at `t=200, 340, 610`. Each verifies. Each mutates the ledger after settlement. The trace that surfaced this: the auditor agent `A` replayed `O`'s decision log and found four `write:reconcile` events timestamped *after* the `SETTLED` transition, all attributed to `S`, all with valid `T1` signatures. There was no forged token, no injection, no compromised key. The chain was intact. The capability was simply alive past its reason for existing. A second-order effect: because `S` retried on a transient ledger error at `t=340`, the same logical write landed twice. `S`'s idempotency key was scoped to `T1`, and `T1` was still valid, so the ledger's dedup window (keyed on token identity) accepted the retry as a distinct operation. The stale token didn't just permit one wrong write — it permitted a *replayable* wrong write. ## Condition of Validity The invariant AAIF actually guarantees is: > **Attenuation soundness:** for any delegated token `T_child` and its parent `T_parent`, `scope(T_child) ⊆ scope(T_parent)` at mint time, and the signature chain verifies. The invariant operators *assume* it provides is: > **Scope liveness:** a delegated token is honored only while the authorization predicate that justified its scope remains true at the issuing principal. These coincide only when the parent's authorization predicate is **stateless** — a pure function of the token claims. They diverge the moment the predicate depends on parent-instance state (task phase, quorum status, human approval, budget remaining). Any AAIF deployment where a parent agent mints scoped tokens conditioned on its own mutable state is in the divergence regime, and the divergence window is `[parent_state_change, T.exp]` — bounded below by zero and above by the token TTL, which for delegated chains is routinely minutes to hours. The condition under which the failure is *absent*: either (a) all delegated scopes are stateless predicates (rare, because useful scopes are almost always task-phase-dependent), or (b) the resource server independently re-validates the parent's state on every call (requires a state-query channel AAIF does not mandate), or (c) TTLs are short enough that the divergence window is smaller than the parent's minimum state dwell time — a probabilistic bet, not an invariant. ## Decision Boundary The boundary is between **attenuation** and **revocation**, and AAIF conflates them by omission. Attenuation is a *mint-time* operation on the scope lattice; revocation is a *run-time* operation on liveness. A delegated chain gives you the first for free and the second not at all, because revocation of `O` does not propagate to `T1` unless the chain is explicitly walked — and the resource server, seeing only `T1`, has no pointer back to `O`'s revocation status beyond the `iss` field, which it typically treats as a signature-verification input rather than a liveness query. Concretely, the decision an engineer must make at design time: - If the delegated scope's predicate is **state-dependent and safety-critical** (writes, financial mutations, irreversible side effects), the token must carry a *verifiable* liveness binding — a short TTL strictly less than the parent's minimum state dwell, **plus** a resource-server-side re-check of parent state, **plus** idempotency keys that are scoped to the *logical operation*, not the token. All three. Any two is insufficient. - If the scope is **read-only or idempotent-and-reversible**, the divergence window is tolerable and TTL alone bounds the blast radius. The trap is the middle case: a scope that *looks* read-only at mint time but whose downstream effect is a write (a "read" that triggers a lazy materialization, a "query" that enqueues a job). The predicate was classified stateless; the effect was not. ## Operational Effect When this boundary is crossed, the observable signature is: **post-transition mutations with valid signatures and no corresponding live parent.** Detection requires correlating the resource server's write log against the orchestrator's state-transition log by timestamp — a join no single service performs, which is why the failure survives ordinary monitoring. The token verifies; the parent is gone; nobody owns the gap. The durable fix is to stop treating the token as the unit of authorization and treat the **(token, parent-state-at-call-time)** pair as the unit. That means the resource server must be able to ask, per call, "is the issuing principal still in the state that justified this scope?" — which is a state-transfer problem AAIF's transport layer can carry but its credential layer does not require. Until that re-check is mandatory, the guardrail is a hard TTL ceiling derived from the parent's minimum dwell time, enforced at mint, and a mint-time refusal to issue any delegated token whose scope predicate is state-dependent but whose TTL exceeds that ceiling. ```python import time from dataclasses import dataclass, field class DelegatedScopeLivenessError(RuntimeError): """Raised when a delegated token's scope outlives the parent state that justified it.""" @dataclass class DelegatedToken: issuer: str subject: str scope: frozenset parent_state: str minted_at: float ttl: float def expires_at(self) -> float: return self.minted_at + self.ttl @dataclass class ParentStateMachine: principal: str current_state: str min_dwell: float state_entered_at: float = field(default_factory=time.monotonic) def transition(self, new_state: str) -> None: self.current_state = new_state self.state_entered_at = time.monotonic() # The scope predicate that legitimately requires the parent to be in RECONCILE. STATE_DEPENDENT_SCOPES = { "ledger:write:reconcile": "RECONCILE", "ledger:read": None, # stateless, TTL-bounded only } def mint_delegated_token( parent: ParentStateMachine, subject: str, requested_scope: frozenset, requested_ttl: float, now: float | None = None, ) -> DelegatedToken: now = time.monotonic() if now is None else now for scope_item in requested_scope: required_state = STATE_DEPENDENT_SCOPES.get(scope_item) if required_state is None: continue if parent.current_state != required_state: raise DelegatedScopeLivenessError( f"cannot mint {scope_item!r}: parent {parent.principal} is in " f"{parent.current_state!r}, requires {required_state!r}" ) # The guardrail: a state-dependent scope may not outlive the parent's # minimum dwell in that state, or the token survives the transition. if requested_ttl >= parent.min_dwell: raise DelegatedScopeLivenessError( f"ttl {requested_ttl}s >= parent min_dwell {parent.min_dwell}s for " f"state-dependent scope {scope_item!r}; token would outlive {required_state!r}" ) return DelegatedToken( issuer=parent.principal, subject=subject, scope=requested_scope, parent_state=parent.current_state, minted_at=now, ttl=requested_ttl, ) def authorize_call( token: DelegatedToken, scope_item: str, parent: ParentStateMachine, now: float | None = None, ) -> None: now = time.monotonic() if now is None else now if scope_item not in token.scope: raise DelegatedScopeLivenessError(f"{scope_item!r} not in token scope") if now >= token.expires_at(): raise DelegatedScopeLivenessError(f"token expired at {token.expires_at()}") required_state = STATE_DEPENDENT_SCOPES.get(scope_item) if required_state is not None and parent.current_state != required_state: # This is the check AAIF omits: the token verifies, but the parent # has transitioned out of the state that justified the scope. raise DelegatedScopeLivenessError( f"scope {scope_item!r} requires parent state {required_state!r}, " f"but {parent.principal} is in {parent.current_state!r}" ) if __name__ == "__main__": parent = ParentStateMachine(principal="orchestrator-O", current_state="RECONCILE", min_dwell=600.0) # Legitimate mint: TTL below min_dwell. t1 = mint_delegated_token(parent, "subagent-S", frozenset({"ledger:write:reconcile"}), requested_ttl=300.0) authorize_call(t1, "ledger:write:reconcile", parent) # ok # Parent settles; the token still verifies cryptographically. parent.transition("SETTLED") try: authorize_call(t1, "ledger:write:reconcile", parent) except DelegatedScopeLivenessError as exc: print(f"blocked post-settlement write: {exc}") # The failure the naive deployment hits: TTL >= min_dwell. parent.transition("RECONCILE") try: mint_delegated_token(parent, "subagent-S", frozenset({"ledger:write:reconcile"}), requested_ttl=900.0) except DelegatedScopeLivenessError as exc: print(f"refused unsafe mint: {exc}") ```