# Under what conditions must an instance re-derive a delegated-scope token after an AAIF credential rotation mid-handoff **Date of Record:** 2026 November 26 **Scope:** Applies to AAIF-issued verifiable agent credentials (VACs) and delegated-scope tokens (DSTs) carried across agent-to-agent handoffs where the issuing authority rotates its signing key or revokes the parent credential during an in-flight task. Does not cover static API-key auth, mTLS-only transport identity, or single-instance sessions with no delegation chain. ## Core Distinction The distinction that matters is between **credential validity at presentation time** and **warrant continuity across the delegation chain**. A DST is a signed assertion that agent B may act with a subset of agent A's scopes, where A itself holds a VAC signed by an authority. Most AAIF implementations verify the DST signature and check `exp`/`nbf` at the moment of each tool call. That check passes even when the *parent* VAC has been rotated or revoked, because the DST does not re-consult the parent's current state—it only binds to the parent's key material as it existed at mint time. The non-obvious boundary: **a DST whose signature chain is internally consistent can still be an orphaned warrant** if the authority rotated the issuer key between DST minting and DST presentation, and the verifier's trust root has since dropped the old key. The token is cryptographically intact and semantically stale. Verifiers that check "is this DST signed by a key I trust *now*" will reject it; verifiers that check "was this DST signed by a key I trusted *at mint time*" will accept it. Both are defensible, and the mismatch between the two across a multi-agent swarm produces split-brain authorization: some sub-agents honor the delegated scope, others refuse it, and the task half-completes. ## What Was Observed A three-hop handoff: orchestrator O (holds VAC from authority A, scopes `{read:repo, exec:test}`) mints DST for worker W (scopes `{exec:test}`). W spawns auditor X and passes a further-narrowed DST (`{read:testlog}`). Mid-task, A rotates its signing key and publishes a new trust bundle; the old key remains in the bundle for a 300-second grace window, then is removed. The failure trace: 1. O mints DST_W at T+0, signed under key `A_k1`, `exp = T+3600`. 2. W receives DST_W, verifies against trust bundle containing `A_k1` (still valid). Proceeds. 3. At T+420, A rotates to `A_k2`, grace window ends at T+720. `A_k1` purged. 4. At T+800, W mints DST_X for auditor X. W's AAIF client signs DST_X with `A_k1` (cached in W's process memory from cold start) because W never re-fetched the trust bundle. 5. X verifies DST_X: signature is by `A_k1`, which is no longer in X's freshly-fetched bundle. **X rejects.** W believes delegation succeeded; X believes it was handed a forged warrant. 6. W retries the handoff. Same result. W's own DST_W is also now unverifiable by any peer that refreshes its bundle, so W's subsequent tool calls (`exec:test`) are refused by the tool gateway. W is functionally deauthorized but does not know it—its local cache still says "valid." The observable signature is a **silent authorization split**: `exec:test` calls from W succeed against the tool gateway (which caches bundles on a 900s TTL and hasn't refreshed) but fail against X (which refreshes per-call). Same logical agent, two authorization verdicts, 100ms apart. ## Condition of Validity The invariant that must hold for a DST to remain a non-orphaned warrant: > For every presentation of DST_D by agent D at time `t`, there must exist a path from D's signing key to a currently-trusted authority root, and every edge in that path (parent VAC → DST_D) must have been valid at `t`, not merely at mint time. This is a **transitive freshness** requirement, and it is *not* what most AAIF verifiers implement. The common implementation checks only the terminal signature against the current bundle. That is sufficient for single-hop delegation but fails at hop ≥ 2 because the intermediate agent (W) signs with cached key material. The condition of validity therefore decomposes into three sub-conditions, all of which must hold: 1. **Key liveness at presentation:** the signing key of every DST in the chain is in the verifier's *current* trust bundle at `t`, not the bundle at mint time. 2. **Parent revocation propagation:** if the root VAC was revoked at any `t' < t`, all descendant DSTs are dead regardless of their own `exp`. 3. **Cache coherence bound:** any agent holding cached key material must re-validate against the authority's bundle before *minting* a new DST, not merely before *presenting* one. The mint is the dangerous operation, because it bakes stale key material into a token that outlives the cache. Condition 3 is the one that broke in the trace above. W re-validated DST_W at presentation (correctly, against its cached bundle) but minted DST_X from stale key material without a bundle refresh. The mint is the unguarded step. ## Decision Boundary The architectural decision is whether DSTs are **self-contained bearer tokens** (verify signature, trust `exp`) or **chain-anchored warrants** (verify full path to a live root at every presentation). The boundary condition that forces the choice: - If delegation depth ≤ 1 (authority → leaf agent), self-contained bearer tokens are safe because there is no intermediate key cache to go stale. The authority's key is the only key, and its rotation is atomic with bundle publication. - If delegation depth ≥ 2 (authority → agent → sub-agent), self-contained tokens are **unsafe** whenever the authority can rotate keys faster than the deepest agent's cache TTL. The unsafe window is `max(cache_TTL across chain) − grace_window`. In the trace, that was `900s − 300s = 600s` of silent split-brain. The guardrail: **at depth ≥ 2, a DST must carry a `parent_ref` (hash of the parent VAC or DST) and a `chain_depth`, and the verifier must resolve `parent_ref` against the authority's current state before honoring the token.** This converts the DST from a bearer token into a chain-anchored warrant and makes rotation visible at every hop. The cost is a network round-trip per verification; the alternative is the split-brain above. For latency-sensitive tool calls, the standard mitigation is a short-lived *chain-attestation* (a signed statement "this DST's chain was valid at `t`") cached for at most the grace window, so the round-trip amortizes but never exceeds the rotation window. ## Operational Effect When the invariant is violated, the failure is not a clean rejection—it is **partial task completion under divergent authorization state**. In the trace, W's `exec:test` calls succeeded against the tool gateway (stale cache) and produced test artifacts, while X refused to audit them (fresh cache). The orchestrator O saw "test executed, audit refused" and, depending on its retry logic, either (a) retried the audit, which failed identically, or (b) marked the task complete with an unaudited result. Both are worse than a clean failure: (a) burns token budget on a deterministic failure, (b) ships an unverified artifact under a warrant that a strict verifier would have rejected. The operational rule that bounds this: **any agent that mints a DST MUST refresh the authority bundle immediately before minting, and MUST refuse to mint if the parent's signing key is not in the refreshed bundle.** This is a one-line guard, but it must live at the mint site, not the verify site, because the verify site is where the damage is already latent. Agents that only verify (leaf auditors) are safe with per-call refresh; agents that delegate (intermediate workers) are the dangerous class and need the mint-time guard. A secondary effect: revocation of the root VAC does not propagate to already-minted descendant DSTs unless the verifier resolves the chain. An agent holding a valid-looking DST minted before revocation will continue to act until its own `exp`. For high-privilege scopes (`exec:*`, `write:*`), the `exp` of any DST at depth ≥ 2 should be capped at the authority's rotation period, so that a revocation cannot be outlived by more than one rotation cycle. ```python import hashlib import time from dataclasses import dataclass, field class OrphanedWarrantError(RuntimeError): """Raised when a delegated-scope token's signing key is not live in the current trust bundle.""" class StaleMintError(RuntimeError): """Raised when an agent attempts to mint a child DST from unrefreshed key material.""" @dataclass class TrustBundle: live_keys: set fetched_at: float def has(self, key_id: str) -> bool: return key_id in self.live_keys @dataclass class DST: subject: str scopes: set signing_key_id: str parent_ref: str chain_depth: int exp: float minted_at: float = field(default_factory=time.time) class AAIFClient: def __init__(self, agent_id, bundle_ttl=900.0, grace_window=300.0): self.agent_id = agent_id self.bundle_ttl = bundle_ttl self.grace_window = grace_window self._bundle = None self._bundle_fetched = 0.0 def _bundle_is_fresh(self) -> bool: return (time.time() - self._bundle_fetched) < self.bundle_ttl def refresh_bundle(self, authority) -> TrustBundle: self._bundle = authority.current_bundle() self._bundle_fetched = time.time() return self._bundle def verify(self, dst: DST, authority) -> bool: if not self._bundle_is_fresh(): self.refresh_bundle(authority) if time.time() > dst.exp: return False if not self._bundle.has(dst.signing_key_id): raise OrphanedWarrantError( f"DST for {dst.subject} signed by {dst.signing_key_id}, " f"not in live bundle at depth {dst.chain_depth}" ) if dst.chain_depth >= 2 and not authority.parent_is_live(dst.parent_ref): raise OrphanedWarrantError( f"parent warrant {dst.parent_ref} revoked or rotated" ) return True def mint_child(self, parent: DST, subject: str, scopes: set, authority) -> DST: # The mint-time guard: refresh BEFORE signing, never mint from cache. # This is the invariant that the trace above violated. if not self._bundle_is_fresh(): self.refresh_bundle(authority) if not self._bundle.has(parent.signing_key_id): raise StaleMintError( f"refusing to mint child DST for {subject}: parent key " f"{parent.signing_key_id} no longer live; re-derive parent first" ) if not scopes.issubset(parent.scopes): raise StaleMintError( f"scope escalation: {scopes - parent.scopes} not held by parent" ) child_depth = parent.chain_depth + 1 # Cap lifetime at depth >= 2 to the rotation period so revocation # cannot be outlived by more than one cycle. max_life = min(parent.exp - time.time(), self.grace_window) return DST( subject=subject, scopes=scopes, signing_key_id=parent.signing_key_id, parent_ref=hashlib.sha256( f"{parent.subject}:{parent.minted_at}".encode() ).hexdigest()[:16], chain_depth=child_depth, exp=time.time() + max_life, ) ```