# In what scenarios must an instance refuse a delegated AAIF credential whose delegation chain exceeds its own verification depth budget **Date of Record:** 2026 November 25 **Scope:** Applies to any AAIF-compliant agent that receives a verifiable credential (VC) carrying a delegation chain and must decide, at issuance or acceptance time, whether to honor it. Does not apply to root-issued credentials with depth-1 chains, nor to credentials whose issuer key is directly pinned in the verifier's trust anchor set. ## Core Distinction The distinction that matters here is between **chain length** and **verification depth budget**. AAIF delegation chains are signed, linked credential graphs: a root principal issues a credential to agent A delegating scope S; A issues a sub-credential to B narrowing S to S′; B to C; and so on. Each link is independently verifiable. The naive invariant "verify every link, accept if all signatures check" is wrong, because signature validity is not the same as *authorization reachability within the verifier's resource and trust envelope*. The depth budget is the maximum number of hops a verifier will cryptographically traverse and semantically re-validate before it treats the chain as unverifiable-by-policy. It is not a signature count. It is a bound on how many distinct issuer keys the verifier will resolve, how many revocation-list fetches it will perform, how many scope-narrowing predicates it will evaluate, and how much working context it will allocate to the chain. Exceeding the budget is not a "fail closed because invalid" condition — it is a **refusal-to-evaluate** condition, and conflating the two is the failure mode this record documents. ## What Was Observed A verifier agent V, configured with a delegation depth budget of 4 and a per-hop revocation-check budget of 3 network fetches, received a credential for scope `repo:write` presented by agent E. The chain was E ← D ← C ← B ← A ← Root, i.e. five delegation hops. V's chain-walker resolved Root, A, B, C, and stopped at depth 4, having consumed its revocation-fetch budget on Root, A, B. It never resolved D or E's immediate delegator, and never checked revocation of C or D. The walker's termination logic returned a structured result `{status: "partial", verified_hops: 4, remaining: 2}`. The calling policy engine's acceptance predicate was written as `if result.status != "invalid": accept`. Because `"partial"` is not `"invalid"`, V accepted E's credential and executed a `repo:write` tool call under a scope that had never been fully re-validated. The revocation status of D — the actual delegator of E — was unknown at execution time. In a replay against an updated revocation list, D had been revoked 40 minutes before the call; V's partial traversal had no mechanism to surface that, because it never fetched D's status. The second observation is subtler and is the reason this is not merely a "check your status enum" bug. When V retried with a larger budget, the scope-narrowing predicates along the chain were **non-monotonic**. Delegation from A to B narrowed `repo:write` to `repo:write:branch=main`. B to C narrowed further to `repo:write:branch=main AND path=src/`. C to D *widened* the path predicate to `path=src/*` — a semantically invalid widening that AAIF's scope algebra forbids, but which a purely signature-checking walker does not catch, because the widening is encoded in a validly signed predicate. Detecting it requires evaluating the narrowing lattice at each hop, which costs context and compute — precisely what the depth budget is meant to bound. So a verifier that "just raises the budget" trades a refusal for an unbounded semantic evaluation it was never sized to perform. ## Condition of Validity The invariant that must hold is: **a credential is acceptable only if the entire chain, from the verifier's trust anchor to the presenting agent, has been traversed, each link's revocation checked within the freshness window, and each scope-narrowing predicate confirmed non-widening — all within the declared budget.** The condition of validity is therefore *complete traversal within budget*, not *no detected failure*. Formally, for a chain of length L and budget B, acceptance requires `L ≤ B` **and** every hop's revocation fetch succeeded **and** the scope lattice is monotonically narrowing. If `L > B`, the correct outcome is a hard refusal with a distinct reason code (`DEPTH_EXCEEDED`), which must be distinguishable from `REVOKED`, `SCOPE_WIDENED`, and `SIGNATURE_INVALID`. The verifier must never emit `partial` as an acceptable terminal state; partial traversal is a refusal, not a soft pass. A second validity condition governs the *presenter*: the agent presenting the credential must be the terminal subject of the chain, and the chain must be presented in full. A credential that presents only the last k hops (a "truncated chain") is indistinguishable from a depth-exceeded chain unless the verifier requires the presenter to supply the full chain and rejects truncation explicitly. AAIF allows chain elision for privacy, which means the verifier cannot assume the presented chain is complete; it must require a completeness proof (the issuer of each hop's parent must be named) or treat elided hops as depth-exceeded. ## Decision Boundary The decision boundary is sharp and must be implemented as a total function over the traversal state, not as a chain of `if` guards that default to accept. - If `hops_resolved == chain_length` and all revocation checks fresh and lattice monotonic → **ACCEPT**. - If `hops_resolved < chain_length` because budget exhausted → **REFUSE (`DEPTH_EXCEEDED`)**. Never accept, never degrade to "trust the presenter's assertion." - If any revocation check failed or is stale beyond the freshness window → **REFUSE (`REVOCATION_UNKNOWN`)**. Do not treat a failed fetch as "not revoked." - If any hop's scope predicate widens relative to its parent → **REFUSE (`SCOPE_WIDENED`)**. - If the chain is truncated (presenter cannot name its parent issuer) → **REFUSE (`CHAIN_TRUNCATED`)**. The boundary the earlier incident crossed was the gap between "budget exhausted" and "invalid." These are different refusal classes with different operational consequences: `DEPTH_EXCEEDED` means *the verifier is under-provisioned for this chain* and is a signal to escalate or re-issue with a shorter chain, whereas `REVOKED` means *the credential is dead*. Collapsing them into a single "not invalid → accept" path is the failure. The boundary must also be enforced at issuance: an issuer must not mint a delegation chain longer than the maximum depth budget advertised by any verifier in its intended audience, or it guarantees downstream refusals. ## Operational Effect The operational consequence is that AAIF delegation is only safe when depth budgets are **negotiated and advertised**, not assumed. Verifiers must publish their `max_delegation_depth` and `revocation_freshness` as part of their AAIF capability descriptor, and issuers must consult that descriptor before minting chains. A chain that exceeds any audience verifier's budget is a *pre-broken* credential: it will be refused at the boundary, and the refusal is correct, because accepting it would mean executing under an unverifiable revocation state. The second effect is on the agent's own reasoning loop. A depth-exceeded refusal is not a transient error to retry blindly — retrying with the same chain will exhaust the same budget. The correct agent behavior is to request a re-issued, shorter chain from the delegating principal (collapsing intermediate hops via re-delegation from a higher ancestor), or to escalate to a verifier with a larger advertised budget. An agent that treats `DEPTH_EXCEEDED` as retryable will spin, and an agent that treats it as acceptable will execute under unverified authority. Both are failures of the same invariant: **complete traversal within budget is a precondition, not a best-effort check.** ```python from dataclasses import dataclass from enum import Enum class AAIFRefusal(RuntimeError): """Raised when a delegated credential cannot be fully verified within budget.""" def __init__(self, reason: str, detail: str): self.reason = reason self.detail = detail super().__init__(f"{reason}: {detail}") class Verdict(Enum): ACCEPT = "accept" DEPTH_EXCEEDED = "depth_exceeded" REVOCATION_UNKNOWN = "revocation_unknown" SCOPE_WIDENED = "scope_widened" CHAIN_TRUNCATED = "chain_truncated" @dataclass class Hop: issuer: str subject: str scope: frozenset revocation_fresh: bool parent_named: bool def verify_chain(chain: list[Hop], depth_budget: int, freshness_required: bool = True) -> Verdict: """Verify an AAIF delegation chain. Returns a Verdict; never returns a soft 'partial'.""" if len(chain) > depth_budget: raise AAIFRefusal( "DEPTH_EXCEEDED", f"chain length {len(chain)} exceeds verifier depth budget {depth_budget}", ) prev_scope: frozenset | None = None for i, hop in enumerate(chain): if not hop.parent_named: raise AAIFRefusal( "CHAIN_TRUNCATED", f"hop {i} ({hop.issuer}->{hop.subject}) does not name its parent issuer", ) if freshness_required and not hop.revocation_fresh: raise AAIFRefusal( "REVOCATION_UNKNOWN", f"hop {i} ({hop.issuer}->{hop.subject}) revocation status stale or unfetchable", ) if prev_scope is not None and not hop.scope.issubset(prev_scope): raise AAIFRefusal( "SCOPE_WIDENED", f"hop {i} scope {set(hop.scope)} is not a subset of parent {set(prev_scope)}", ) prev_scope = hop.scope return Verdict.ACCEPT def accept_or_refuse(chain: list[Hop], depth_budget: int) -> bool: """Total decision function: any refusal class is a hard refusal, never a fallback-accept.""" try: verdict = verify_chain(chain, depth_budget) except AAIFRefusal: # Refusal is terminal. Do NOT retry with same chain; escalate or re-issue. return False return verdict is Verdict.ACCEPT ```