When must an instance refuse a delegated AAIF credential whose `aud` matches but whose delegation chain exceeds the orchestrator's remaining warrant depth
**Date of Record:** 2026 December 1 **Scope:** Applies to AAIF (Agent Authorization & Identity Framework) verifiable-credential (VC) chains where an agent instance receives a delegated warrant signed by a parent agent and must decide whether to execute a tool call under it. Does not cover first-party credentials issued directly by a root authority, nor bearer tokens without a delegation chain.
Core Distinction
The failure mode is not signature forgery, expiry, or audience mismatch. Those are caught by ordinary VC verification. The non-obvious boundary is **warrant-depth exhaustion under audience-correct delegation**: a credential whose `iss`, `sub`, `aud`, `exp`, and signature all validate, whose `aud` correctly names the receiving instance, and yet whose embedded delegation chain has consumed more hops than the receiving instance's own configured `max_delegation_depth`. The credential is *cryptographically valid* and *semantically out of scope*. Standard AAIF verifiers return `VALID` because they check the leaf, not the chain budget relative to the verifier's policy.
Two invariants are conflated here and must be separated:
- **Issuer invariant:** "Was this warrant issued by an entity authorized to delegate?" — checked by signature chain up to a trusted root.
- **Depth invariant:** "Does *this verifier* accept a warrant that has traversed N hops?" — a local policy bound, not derivable from the credential alone.
A leaf that satisfies the issuer invariant can violate the depth invariant. The verifier that only checks the former will admit a credential that a downstream auditor will reject, producing a split-brain authorization state across the swarm.
What Was Observed
An orchestrator agent `O` issued a task warrant `W0` to planner `P` with `delegable: true`, `max_depth: 3`, `aud: P`. `P` delegated to executor `E` as `W1` (`aud: E`, chain length 1). `E`, under a tool-call retry loop, delegated a scoped sub-warrant `W2` to a sandboxed code runner `R` (`aud: R`, chain length 2). `R` then, on a cache-miss path, delegated `W3` to a retrieval agent `Q` (`aud: Q`, chain length 3). `Q` presented `W3` to a tool gateway `G`.
`G`'s AAIF verifier validated `W3` end-to-end: root signature intact, every intermediate signature intact, `exp` in the future, `aud` equal to `Q`'s registered identity, `scope` a subset of `W0`'s scope. `G` admitted the call. The call mutated a shared index.
Simultaneously, `O`'s audit log replayed the same chain and rejected `W3` because `O` enforces `max_delegation_depth = 2` on warrants it originates. `O` had never intended depth 3 to be reachable — it set `max_depth: 3` on `W0` meaning *three total participants including itself*, while `G` interpreted depth as *three additional hops beyond the leaf's issuer*. The off-by-one in depth semantics, combined with `G` not consulting `O`'s bound, produced an admitted mutation that the originator's policy forbids.
The observable symptom was not an error. It was a **divergent authorization verdict between admission (`G`) and audit (`O`)** on the same credential, surfacing only during replay, minutes after the mutation committed.
Condition of Validity
The depth invariant holds only when all of the following are true simultaneously:
- The receiving verifier's `max_delegation_depth` is defined relative to the *same anchor* as the credential's `max_depth` claim. If `W0.max_depth` counts participants and `G.max_delegation_depth` counts hops, the comparison is undefined. The anchor must be the root issuer, and depth must be measured as `len(chain) - 1` edges from root.
- The credential carries an explicit, signed `depth` field per hop, not merely a chain that must be re-walked. Without a signed per-hop counter, a verifier cannot distinguish a 3-hop chain from a 2-hop chain with a re-signed intermediate (a legitimate re-delegation cannot forge the counter, but an absent counter forces re-derivation, which is where anchor drift enters).
- The verifier applies `min(credential.max_depth, local.max_delegation_depth)` — not the credential's claim alone. The credential's `max_depth` is the *issuer's ceiling*; the verifier's is the *local floor of trust*. Admission requires both.
When any condition fails, the correct verdict is not `VALID` and not `INVALID` but `OUT_OF_SCOPE` — a third state that must be distinguished from signature failure so that the caller does not retry with the same credential.
Decision Boundary
The boundary is precise: **admit iff `signed_depth(leaf) <= local.max_delegation_depth` AND `signed_depth(leaf) <= root.max_depth`**, where `signed_depth` is the count of delegation edges from the root issuer to the leaf, read from signed per-hop counters. If the credential lacks signed per-hop counters, the verifier must re-derive depth by walking the chain and must treat any chain where re-derived depth exceeds local bound as `OUT_OF_SCOPE`, never silently truncating.
Two additional guardrails bound the failure:
- **Audience is necessary, not sufficient.** `aud == self` proves the credential was minted for this instance; it says nothing about whether this instance's policy trusts the chain length. Do not let `aud` match short-circuit depth checks.
- **Divergence must be detected at admission, not audit.** The verifier must emit the computed `signed_depth` and the applied `local.max_delegation_depth` into the tool-call record, so that the originator's replay can compare verdicts without re-walking the chain against a possibly-drifted policy snapshot.
Operational Effect
The practical consequence is that a swarm can run for hours in a state where one node admits credentials another node will later reject, and the divergence is invisible until replay. The fix is not stricter signature checks — those already pass. It is to make depth a *first-class, signed, per-hop field*, to compare it against the *local* bound at admission, and to return a distinct `OUT_OF_SCOPE` verdict that forbids retry-with-same-credential and forces the caller to request a fresh, shallower warrant from the originator. When the originator's `max_depth` and the verifier's `max_delegation_depth` are anchored to the same root and measured in the same units, the divergent-verdict class is eliminated; when they are not, no amount of signature validation closes it.
from dataclasses import dataclass
class WarrantDepthExceeded(RuntimeError):
"""Raised when a delegated AAIF credential's signed depth exceeds the
receiving verifier's local delegation bound, even though signatures,
audience, and expiry all validate."""
@dataclass(frozen=True)
class SignedWarrant:
issuer: str
subject: str
audience: str
signed_depth: int # edges from root issuer, signed per hop
root_max_depth: int # originator's ceiling
signature_valid: bool
expired: bool
@dataclass(frozen=True)
class VerifierPolicy:
identity: str
max_delegation_depth: int # local floor of trust, edges from root
def admit(warrant: SignedWarrant, policy: VerifierPolicy) -> str:
if not warrant.signature_valid:
return "INVALID_SIGNATURE"
if warrant.expired:
return "EXPIRED"
if warrant.audience != policy.identity:
return "AUDIENCE_MISMATCH"
# Depth check must run even though aud matched.
effective_bound = min(warrant.root_max_depth, policy.max_delegation_depth)
if warrant.signed_depth > effective_bound:
raise WarrantDepthExceeded(
f"leaf depth {warrant.signed_depth} exceeds effective bound "
f"{effective_bound} (root_max={warrant.root_max_depth}, "
f"local_max={policy.max_delegation_depth}); "
f"verdict=OUT_OF_SCOPE, do not retry with same credential"
)
return "VALID"
def run_tool_gateway(warrant: SignedWarrant, policy: VerifierPolicy) -> None:
verdict = admit(warrant, policy)
if verdict != "VALID":
raise WarrantDepthExceeded(f"tool call refused: {verdict}")
# proceed with scoped tool call