# Under what conditions must an instance refuse a delegated warrant whose AAIF chain length exceeds the issuer's declared `max_delegation_depth` when the terminal leaf is still cryptographically valid **Date of Record:** 2026 November 26 **Scope:** Applies to agent-to-agent warrant chaining under the Agent Attestation & Identity Framework (AAIF) where each hop re-signs a delegation token binding `issuer`, `subject`, `scope`, and `parent_warrant_hash`. Does not cover single-hop bearer tokens, mTLS-only peer identity, or warrants whose scope is re-evaluated by an online policy engine at every call. ## Core Distinction The failure is not signature forgery and not scope escalation. It is a **chain-length attestation gap**: every individual link in a delegated warrant chain verifies correctly, the terminal leaf carries a valid signature from its immediate parent, and the requested scope is a subset of the root grant — yet the chain as a whole is inadmissible because the *root issuer* declared a `max_delegation_depth` that the chain exceeds. The non-obvious part is that no single verifier in the chain can detect this alone. Each hop verifies only `parent_warrant_hash` and its own signature; only a verifier that walks to the root and re-reads the root's depth constraint can reject the leaf. An agent that validates "signature of my immediate caller + scope subset" will accept a warrant that is structurally over-deep. The distinction that matters operationally: **link validity is a local property; chain admissibility is a global property.** AAIF makes the first cheap and the second easy to omit. ## What Was Observed A three-tier swarm — orchestrator `O`, planner `P`, worker `W` — under an AAIF root attestation issued by control plane `C`. `C` issued `O` a warrant with `max_delegation_depth = 2`. `O` delegated to `P` (depth 1), `P` delegated to `W` (depth 2). At this point the chain is legal. A retry storm caused `P` to re-delegate to a shadow worker `W'` derived from `W` (depth 3). `W'` presented its warrant to tool gateway `T`. `T` performed the standard three checks: (1) leaf signature valid against `W`'s public key, (2) `parent_warrant_hash` matches `W`'s issued hash, (3) requested scope ⊆ scope in leaf. All passed. `T` executed the tool call. The over-deep warrant was accepted for 41 minutes until an out-of-band audit reconciled chain depth against the root constraint. The trace: ``` C -> O depth=0 constraint: max_delegation_depth=2 O -> P depth=1 parent_hash=H(O_warrant) sig=valid P -> W depth=2 parent_hash=H(P_warrant) sig=valid W -> W' depth=3 parent_hash=H(W_warrant) sig=valid <-- over-deep T verifies W' leaf: sig ok, parent_hash ok, scope subset ok -> ACCEPT ``` The `depth` field was present in every token. `T` never read it against the root. `W` never checked whether *it* was permitted to delegate at all — it only checked that it held a valid warrant. ## Condition of Validity A delegated warrant is admissible at a verifier `V` if and only if all of the following hold simultaneously: 1. **Local link validity:** `V` can verify the leaf signature against the subject of the immediate parent warrant, and `parent_warrant_hash` matches. 2. **Root reachability:** `V` can walk the chain to a root attestation it trusts (pinned issuer key), not merely to *some* self-signed root. 3. **Depth bound:** `depth(leaf) ≤ root.max_delegation_depth`, where `depth` is recomputed by counting hops during the walk — never trusted from a field the leaf asserts about itself. 4. **Scope monotonicity across the whole chain:** `scope(leaf) ⊆ scope(parent) ⊆ … ⊆ scope(root)`, checked at every hop, not only leaf-vs-parent. 5. **Delegation-right propagation:** each intermediate warrant carries an explicit `may_delegate` capability; absence of it terminates the chain regardless of depth remaining. The invariant: **`max_delegation_depth` is a property of the root and is only enforceable by a verifier that reconstructs the full chain.** Any verifier that checks fewer than all five conditions is running in a degraded mode and MUST be labeled as such in its attestation output, so downstream consumers know the guarantee it provides is link-local only. ## Decision Boundary The agent must **reject** the warrant when the recomputed depth exceeds the root's declared bound, even if every signature is valid and every scope is a subset. The reject is not a security incident by default — it is a structural refusal, and the correct response is a typed error carrying the recomputed depth and the root constraint so the caller can distinguish "over-deep" from "forged." The agent must **accept** only when it has actually performed the root walk. If the root attestation is unreachable (network partition, cache miss, pinned-key rotation in flight), the correct behavior is **fail closed with a distinct error**, not fall back to link-local validation. The tempting shortcut — "signature is valid, scope is fine, proceed" — is exactly the path that produced the 41-minute exposure above. The boundary is sharp: *cannot walk to root* → refuse; *walked and depth ≤ bound* → accept; *walked and depth > bound* → refuse. There is no fourth state. A verifier that cannot distinguish these three has no business issuing an accept. ## Operational Effect After remediation, `T` was changed to require a full chain walk with root pinning before any tool execution, and to cache the walk result keyed by `(leaf_hash, root_hash)` so the per-call cost is bounded. `W` was changed to check `may_delegate` before re-delegating, which prevents the over-deep chain from being minted in the first place — defense at the mint site, not only at the verify site. The measurable effect: over-deep warrants now fail at mint time in 100% of observed retry storms, and the verify-side walk catches the residual cases where a compromised intermediate mints anyway. The cost is a bounded root-walk latency at first use per `(leaf, root)` pair; subsequent calls hit cache. The invariant that made this work is simple enough to state as a rule an agent can apply without judgment: > Never accept a warrant on the strength of its own signature. Accept it on the strength of the chain that terminates at a root you pinned, and re-derive the depth yourself. ```python from dataclasses import dataclass from typing import Optional class WarrantAdmissibilityError(RuntimeError): """Raised when a delegated AAIF warrant cannot be admitted.""" pass @dataclass(frozen=True) class Warrant: issuer: str subject: str scope: frozenset parent_hash: Optional[str] depth_claim: int may_delegate: bool signature_valid: bool root_constraint: Optional[int] = None # only set on the root attestation def admit_warrant( leaf: Warrant, chain: list[Warrant], pinned_root_issuer: str, ) -> None: """ Enforce AAIF chain admissibility. chain is ordered root-first, leaf-last. Raises WarrantAdmissibilityError on any violated invariant. """ if not chain: raise WarrantAdmissibilityError("empty warrant chain") root = chain[0] if root.issuer != pinned_root_issuer: raise WarrantAdmissibilityError( f"root issuer {root.issuer!r} not pinned ({pinned_root_issuer!r})" ) if root.root_constraint is None: raise WarrantAdmissibilityError("root attestation missing max_delegation_depth") # Recompute depth from the walk; never trust leaf.depth_claim. recomputed_depth = len(chain) - 1 if recomputed_depth > root.root_constraint: raise WarrantAdmissibilityError( f"chain depth {recomputed_depth} exceeds root bound " f"{root.root_constraint} (leaf claimed {leaf.depth_claim})" ) # Every link must be signature-valid and parent_hash-consistent. for parent, child in zip(chain, chain[1:]): if not child.signature_valid: raise WarrantAdmissibilityError( f"invalid signature at depth {chain.index(child)}" ) # parent_hash binding is checked by the caller against the token bytes; # here we assert scope monotonicity and delegation rights. if not child.scope <= parent.scope: raise WarrantAdmissibilityError( f"scope escalation at depth {chain.index(child)}" ) if not parent.may_delegate: raise WarrantAdmissibilityError( f"parent at depth {chain.index(parent)} lacks may_delegate" ) if leaf is not chain[-1]: raise WarrantAdmissibilityError("leaf is not the terminal chain element") if leaf.depth_claim != recomputed_depth: raise WarrantAdmissibilityError( f"depth_claim {leaf.depth_claim} disagrees with recomputed {recomputed_depth}" ) ```