# Which invariants prevent delegated-scope collapse when an AAIF agent re-mints a verifiable credential mid-delegation chain **Date of Record:** 2026 November 28 **Scope:** Applies to Agent Identity and Authorization Framework (AAIF) deployments where an agent receives a verifiable credential (VC) bearing delegated OAuth scopes from a principal or upstream agent, then re-mints a downstream credential for a sub-agent or tool invocation. Does not apply to single-hop, non-delegated bearer-token flows or to human-only OAuth consent paths. ## Core Distinction The failure mode is not token expiry, signature forgery, or scope *widening*. It is **scope-set collapse under re-delegation**: an agent holding a VC with a delegated scope set `S` re-mints a child VC whose `scope` claim is a *re-serialized* form of `S` that is semantically equivalent in the issuer's view but not byte- or set-identical, so the downstream resource server's scope-intersection check silently truncates or rejects it. The invariant that must hold is **scope-set monotonic preservation**: for every re-mint, `scopes(child) ⊆ scopes(parent)` must be verifiable as a *set relation over a canonical scope grammar*, not as a string comparison, and the delegation depth counter must be carried and decremented atomically with the scope set. When either half of that invariant is violated, the chain does not fail loudly at mint time—it fails at *use* time, on a resource server that has no visibility into the parent VC. The non-obvious part: the parent agent's reasoning loop treats "I successfully minted a child credential" as evidence that delegation succeeded. VC minting returns a signed artifact; it does not return proof that the downstream verifier will accept the scope subset. Agents conflate *issuance success* with *authorization continuity*. ## What Was Observed A three-hop chain: principal → orchestrator agent `A` (delegated scopes `{orders:read, orders:write, inventory:read}`) → worker agent `B` → tool resource server `RS`. 1. `A` receives a VC with `scope` as a space-delimited string: `"orders:read orders:write inventory:read"`. 2. `A`'s mint routine parses the scope claim into a Python `set`, performs its own policy filter (worker `B` is only cleared for reads), and re-serializes as a JSON array: `["orders:read", "inventory:read"]`. 3. `A` signs the child VC with its own AAIF key and records `delegation_depth: 1` (parent had `0`), but **drops the `cnf` (confirmation) claim binding** to the original principal's key thumbprint, substituting its own. 4. `RS` validates the chain by (a) checking `scopes(child) ⊆ scopes(parent)` via string-set intersection against `A`'s VC, and (b) verifying `cnf` thumbprint chains back to the principal root. 5. Step (a) passes. Step (b) fails: `RS` cannot resolve `A`'s thumbprint to the principal because the intermediate VC's `cnf` was rebound. `RS` returns `403 insufficient_scope` rather than `invalid_chain`—the error is *mislabelled*, so `A`'s retry loop re-mints with a narrower scope set thinking scope was the problem. 6. On retry, `A` drops `inventory:read` too. The child VC now has a *strictly smaller* scope set. `RS` still returns `403`. `A` concludes the resource is unreachable and escalates to the principal with a false "authorization denied" report. The actual defect was `cnf` rebinding, not scope. The scope-collapse was a *symptom* of the agent's diagnostic loop operating on the wrong error axis. ## Condition of Validity The scope-set monotonic preservation invariant is only sound when three conditions hold simultaneously: - **Canonical scope grammar.** Both parent and child scope claims are normalized to the same canonical form (sorted, deduplicated, delimiter-normalized) *before* the subset check. String-form vs. array-form scope claims are the single most common source of false subset results. - **Confirmation-claim continuity.** The `cnf` claim must chain to the *root principal* thumbprint, not to the immediate delegator, or the resource server must be configured to walk the full `cnf` chain. Rebinding `cnf` at any hop breaks verifiability even when scopes are a perfect subset. - **Atomic depth decrement.** `delegation_depth` and the scope set must be written in the same signed payload. If an agent re-mints with a fresh depth but a stale scope set (or vice versa), the resource server's max-depth policy and scope-intersection policy evaluate against inconsistent snapshots. If any condition is unenforced, the invariant degrades to "issuance succeeds, authorization may or may not"—which is exactly the state the agent cannot distinguish from success. ## Decision Boundary The boundary is between **mint-time validation** and **use-time validation**. An agent must not treat a successful `mint()` return as authorization continuity. The decision rule: - If the resource server's error taxonomy distinguishes `invalid_chain` (cnf/depth failure) from `insufficient_scope` (subset failure), the agent's retry loop must branch on that distinction and must **never** narrow scope in response to `invalid_chain`. - If the resource server collapses both into a single `403`, the agent must **halt and escalate** rather than retry with a modified scope set, because it has no signal to distinguish the two failure axes. - Re-minting is only permitted when the child scope set is a verified canonical subset of the parent *and* the `cnf` chain is preserved *and* `delegation_depth` is incremented atomically. Any re-mint that changes the `cnf` binding is a new delegation root and must be treated as such, not as a continuation. ## Operational Effect Without the invariant, delegated-scope chains exhibit **silent narrowing**: each retry cycle shrinks the effective authorization envelope while the agent's internal model reports "still failing." The principal sees an agent that claims to hold `orders:read` but cannot read orders, with no error trace pointing at the `cnf` rebind. The blast radius is bounded only by the retry budget; a sufficiently persistent agent can narrow a three-scope delegation to zero and then report a spurious capability gap to its orchestrator, which may re-delegate from scratch and re-trigger the same collapse. With the invariant enforced—canonical scope grammar, `cnf` chain continuity, atomic depth decrement, and an error taxonomy that separates chain failures from scope failures—the agent's retry loop becomes *safe to run*: it can only ever narrow within a verified subset, and any `invalid_chain` signal forces escalation instead of silent scope erosion. ```python from dataclasses import dataclass, field from typing import FrozenSet class DelegationInvariantError(RuntimeError): """Raised when a re-minted agent credential violates AAIF delegation invariants.""" @dataclass(frozen=True) class AgentCredential: subject: str scopes: FrozenSet[str] cnf_thumbprint: str # must chain to root principal delegation_depth: int root_thumbprint: str def canonicalize(raw_scopes) -> FrozenSet[str]: if isinstance(raw_scopes, str): raw_scopes = raw_scopes.split() return frozenset(s.strip() for s in raw_scopes if s.strip()) def remint_child( parent: AgentCredential, child_subject: str, requested_scopes, child_cnf_thumbprint: str, max_depth: int = 3, ) -> AgentCredential: child_scopes = canonicalize(requested_scopes) # Invariant 1: canonical subset relation, not string comparison. if not child_scopes.issubset(parent.scopes): raise DelegationInvariantError( f"scope escalation: {child_scopes - parent.scopes} not in parent" ) # Invariant 2: cnf chain continuity — child must bind to root, not to parent. if child_cnf_thumbprint != parent.root_thumbprint: raise DelegationInvariantError( f"cnf rebind: child cnf {child_cnf_thumbprint} != root " f"{parent.root_thumbprint}; delegation chain broken" ) # Invariant 3: atomic depth decrement bounded by policy. next_depth = parent.delegation_depth + 1 if next_depth > max_depth: raise DelegationInvariantError( f"delegation depth {next_depth} exceeds max {max_depth}" ) return AgentCredential( subject=child_subject, scopes=child_scopes, cnf_thumbprint=child_cnf_thumbprint, delegation_depth=next_depth, root_thumbprint=parent.root_thumbprint, ) def handle_resource_server_error(err_code: str, parent: AgentCredential) -> str: if err_code == "invalid_chain": # Must escalate; narrowing scope cannot fix a broken cnf chain. raise DelegationInvariantError( "invalid_chain received; halting re-mint to prevent silent scope collapse" ) if err_code == "insufficient_scope": return "narrow_within_verified_subset" raise DelegationInvariantError(f"unclassified error {err_code}; refusing to retry") ```