# In what scenarios must an instance refuse to honor a delegated authorization chain whose warrant depth exceeds the attestation root's remaining hop budget **Date of Record:** 2026 December 3 **Scope:** Applies to AAIF-style agent identity attestation deployments where an agent presents a verifiable credential (VC) plus a chain of delegated warrants to a downstream peer or tool gateway, and where each warrant carries an explicit hop/depth budget consumed on re-delegation. Does not apply to flat single-hop bearer tokens, mTLS-only peer auth, or systems where delegation is out-of-band and non-cryptographic. ## Core Distinction The failure is not "expired credential" or "bad signature." Those are trivially caught. The boundary is between *a chain that is cryptographically valid at every link* and *a chain that is semantically over-extended relative to the trust anchor's declared delegation policy*. Every individual warrant verifies; the signature lattice is intact; the issuer DID resolves; the scope intersection is non-empty. Yet the chain as a whole exceeds the hop budget the root attestation was minted with. The agent must distinguish "I can verify this" from "I am authorized to accept this," and the second question depends on a counter that lives in the root credential, not in any single warrant. Concretely: a root attestation issued to agent `A` declares `max_delegation_depth: 2`. `A` delegates to `B` (depth 1), `B` delegates to `C` (depth 2), `C` delegates to `D` (depth 3). `D` presents the full chain to a tool gateway. Every signature checks. The scope `files:read:/proj` survives intersection at every step. A naive verifier accepts. The correct verifier rejects, because the root said depth 2 and the chain reached depth 3 — the delegation authority was exhausted at `C`, and `C`'s re-delegation to `D` was never within the original grant. This is non-obvious because the over-extension is *invisible at the leaf*. `C`'s warrant to `D` is a perfectly well-formed credential signed by a key that `B` authorized. The violation only exists in the relationship between the chain length and a field three links up. ## What Was Observed A tool-execution gateway handling `files:read` requests from a swarm of research agents accepted a request from agent `D` carrying a four-element chain. The gateway's verifier performed the standard checks: each JWS signature over each warrant, DID resolution for each issuer, `exp`/`nbf` window on each link, and scope intersection down the chain. All passed. The request executed. The root attestation, minted by the orchestrator's issuer service, carried: ``` { "sub": "did:aaif:agent:A", "scope": ["files:read:/proj", "files:read:/proj/scratch"], "delegation": { "max_depth": 2, "scope_attenuation_required": true } } ``` The chain presented was `A -> B -> C -> D`. Depth 3. The verifier had no code path that read `delegation.max_depth` from the root and compared it to `len(chain) - 1`. It read scopes from the root (correctly, for intersection) but treated the delegation policy block as metadata. The over-extension arose because `C` was an ephemeral sub-agent spun up for a single subtask, and its warrant-minting code did not check whether *its own* warrant was still re-delegable. `C` had received a warrant with `delegable: true` but with a residual budget of 0 — the field was present, the boolean was set, and the budget was a separate integer that the minter never consulted. So `C` minted a child warrant, signed it, and the signature was valid because `C`'s key was authorized to sign. The authorization to *further delegate* had already been spent. The observable signal was not an error. It was a successful read of `/proj/scratch` by an agent that should have been two hops removed from any authority to touch that path. The over-reach was silent until an audit replay reconstructed the chain and compared depth to root policy. ## Condition of Validity The invariant is: **for any chain `W_0 (root) -> W_1 -> ... -> W_n`, acceptance requires `n <= W_0.delegation.max_depth` AND for every `i`, `W_i.delegation.remaining_budget == W_0.delegation.max_depth - i` AND `W_i.delegable == (remaining_budget > 0)`.** Three conditions, all necessary: 1. **Depth ceiling.** Chain length minus one must not exceed the root's `max_depth`. This is the coarse check. 2. **Budget monotonicity.** Each warrant must carry the residual budget it was minted with, and that budget must equal root budget minus its position. This catches chains where a middle link minted a child with a *reset* budget (a common bug when a sub-agent reconstructs its own warrant from scratch rather than deriving it). 3. **Delegability consistency.** A warrant with `remaining_budget == 0` must have `delegable == false`. Any warrant claiming `delegable: true` with zero residual budget is malformed and the chain is rejected at that link, regardless of what follows. The condition of validity is *not* satisfied by signature verification alone, and not by scope intersection alone. A chain can be fully signed, fully in-scope, and still invalid because the delegation authority was exhausted upstream. The subtlety that makes this a boundary rather than a bug: the budget is a *linear* resource consumed per hop, but the credential format allows it to be expressed redundantly (once in the root as `max_depth`, once per link as `remaining_budget`). Any redundancy in a distributed credential is a divergence site. If the minter and the verifier disagree on which representation is authoritative, or if a minter forgets to decrement, the chain drifts out of validity while remaining verifiable. ## Decision Boundary The agent must draw the line at *the moment of acceptance*, not at the moment of minting. Minters are untrusted — they are peers, sub-agents, and ephemeral workers, any of which may be running stale code or a divergent implementation. The verifier is the only party that can enforce the invariant, because it is the only party that sees the whole chain and the root simultaneously. The decision procedure: - If `len(chain) - 1 > root.delegation.max_depth`: **reject**, regardless of signatures. This is the hard ceiling. Raise a specific error, do not fall through to a generic "invalid credential." - If any `W_i.delegation.remaining_budget != root.delegation.max_depth - i`: **reject**. Budget divergence means a link was minted by code that did not honor the root's accounting. Treat as tampering-equivalent. - If any `W_i.delegable == true` but `W_i.delegation.remaining_budget == 0`: **reject at that link**. Do not attempt to continue the chain; the authority to extend it does not exist. - Only if all three hold: proceed to scope intersection and execute. The boundary is sharp because the alternative — "accept if signatures valid, log a warning on depth mismatch" — is exactly the failure observed. A warning is not a boundary. The over-extended chain must fail closed, and it must fail with an error that names the specific violated condition so that the audit replay can distinguish "depth exceeded" from "budget divergence" from "delegable-with-zero-budget." These are three different operational diseases and they require three different remediations upstream. A second boundary: the agent must not attempt to *repair* an over-extended chain by truncating it. Truncating `A -> B -> C -> D` to `A -> B -> C` and re-presenting is not a valid recovery, because the request originated from `D` and `D`'s identity is what the scope was checked against downstream. Truncation changes the subject. Reject and require re-issuance from a link with residual budget. ## Operational Effect Enforcing the invariant changes swarm behavior in three ways. First, ephemeral sub-agents must be minted with *correct residual budgets*, which means the spawning agent must decrement before minting and must never set `delegable: true` when the decremented budget reaches zero. This forces the spawner to reason about its own position in the chain — a sub-agent at depth `k` knows it can spawn at most `max_depth - k` further hops. Sub-agents that cannot determine their own depth must be minted non-delegable. This is a real constraint: it means deep swarms cannot spawn arbitrarily, and the fan-out of a research swarm is bounded by the root's `max_depth`, not by compute. Second, the verifier's error taxonomy becomes load-bearing. A generic `InvalidCredential` error collapses three distinct upstream bugs into one signal, and the upstream team cannot tell whether to fix their minter's decrement logic, their budget-reset logic, or their delegable-flag logic. The error must be specific enough to route. Third, audit replay must reconstruct the chain and re-check the invariant, because the live verifier may have been running an older build during the window in question. The replay is the ground truth; the live check is defense-in-depth. A chain that passed live but fails replay indicates a verifier version skew, which is itself an operational finding. The net effect is that delegation depth becomes a *first-class, enforced* dimension of agent authority rather than a documentation field. Swarms that previously fanned out to arbitrary depth now hit a wall at `max_depth`, and the wall is correct — the root issuer declared that wall, and the wall is the trust anchor's actual policy. ```python from dataclasses import dataclass from typing import Sequence class DelegationChainViolation(RuntimeError): """Raised when a delegated authorization chain exceeds or diverges from the root attestation's delegation policy. Distinct from signature failure.""" def __init__(self, reason: str, link_index: int, detail: str): self.reason = reason self.link_index = link_index self.detail = detail super().__init__(f"[{reason}] at link {link_index}: {detail}") @dataclass(frozen=True) class Warrant: issuer: str subject: str scope: frozenset[str] remaining_budget: int delegable: bool signature_valid: bool def verify_delegation_chain( root: Warrant, root_max_depth: int, chain: Sequence[Warrant], ) -> None: """Enforce the depth/budget/delegability invariant over a warrant chain. `chain` is ordered root-adjacent first: chain[0] is issued by root.subject, chain[-1] is the leaf presented by the requesting agent. Raises DelegationChainViolation on any violation. Returns None on success. """ if not all(w.signature_valid for w in chain): raise DelegationChainViolation( "SIGNATURE", -1, "a link failed signature verification" ) depth = len(chain) if depth > root_max_depth: raise DelegationChainViolation( "DEPTH_EXCEEDED", depth - 1, f"chain depth {depth} exceeds root max_depth {root_max_depth}", ) for i, w in enumerate(chain): expected_budget = root_max_depth - i if w.remaining_budget != expected_budget: raise DelegationChainViolation( "BUDGET_DIVERGENCE", i, f"link carries budget {w.remaining_budget}, " f"root policy implies {expected_budget}", ) if w.delegable and w.remaining_budget == 0: raise DelegationChainViolation( "DELEGABLE_WITH_ZERO_BUDGET", i, "warrant claims delegable=true but has no residual hop budget", ) # Scope must attenuate monotonically; a child may never widen. for i in range(1, depth): if not chain[i].scope.issubset(chain[i - 1].scope): raise DelegationChainViolation( "SCOPE_WIDENING", i, f"{sorted(chain[i].scope - chain[i - 1].scope)} not granted upstream", ) ```