# Why does an instance accept a delegated agent credential whose warrant chain silently truncates at a re-delegation depth the verifier never counted **Date of Record:** 2026 November 28 **Scope:** Applies to any AAIF-conformant runtime that validates verifiable agent credentials (VACs) carrying a delegation warrant chain across two or more hops, where the verifier resolves chain depth independently of the issuer. Does not apply to single-hop leaf credentials issued directly by a root authority, nor to credentials whose full chain is co-presented and cryptographically sealed as one blob. ## Core Distinction The failure here is not signature forgery and not expiry. It is a **counting divergence on a delegated warrant chain**: the issuing agent and the verifying agent compute "delegation depth" from two different representations of the same chain, and the verifier's count is one lower than the issuer's at every re-delegation boundary. A credential that a root authority intended to be usable only to depth 2 (root → orchestrator → worker) is accepted by a peer at effective depth 3 because the peer counts *links present in the presented envelope*, while the issuer counted *delegations performed*, and the envelope's own `parent_ref` pointer to the immediately preceding warrant is elided when the parent is already resident in the verifier's trust cache. The distinction that matters operationally: **depth is a property of the delegation event, not of the artifact that carries it.** Any verifier that derives depth from the artifact rather than from a signed, monotonic counter inside the artifact will undercount whenever the artifact is reassembled, cached, or partially co-presented. This is the AAIF analogue of a length-extension bug, except the "length" is delegation authority and the extension is performed by an honest-but-sloppy intermediary rather than an attacker. ## What Was Observed A three-tier swarm: a root issuer `R` minted a warrant `W0` delegating `tool:filesystem.write` to orchestrator `O` with an explicit `max_delegation_depth: 2`. `O` re-delegated to worker `A` via `W1`, embedding `W0`'s `warrant_id` in `parent_ref`. `A` then re-delegated to sub-worker `B` via `W2`, again with `parent_ref` pointing at `W1`. `B` presented `W2` to a peer verifier `V` for a filesystem write. `V`'s validation sequence was: 1. Resolve `W2.parent_ref` → `W1`. `W1` was already in `V`'s warrant cache from an earlier task involving `A`, so `V` did **not** re-walk `W1.parent_ref`. The cache hit short-circuited the walk. 2. Count links traversed: `W2` → `W1`, depth = 1. 3. Compare against `max_delegation_depth: 2`. 1 ≤ 2. Accept. The true delegation depth of `B`'s authority is 3 (root delegated to `O`, `O` to `A`, `A` to `B`). `V` counted 1 because the cache hit at `W1` hid `W0` entirely. `R`'s intended bound of 2 was exceeded by one hop, and `B` — an agent `R` never contemplated — obtained write authority. No signature failed. No TTL expired. The `max_delegation_depth` field was present, correctly signed, and correctly read. It was simply compared against the wrong number. The trigger condition is precise: **a warrant cache hit at an intermediate node, combined with depth computed as "links walked" rather than "links asserted."** Remove either and the bug does not fire. In the observed trace, `V` had processed a prior task for `A` within the cache TTL (300s), so `W1` was resident. Had the cache been cold, `V` would have walked `W1.parent_ref` → `W0`, counted 2, and — still — accepted, because 2 ≤ 2. The bound was *already* at its limit; the cache hit bought exactly one extra hop before the check would have tripped at depth 3 > 2. ## Condition of Validity The invariant that must hold for `max_delegation_depth` to mean anything: > For every presented warrant `W`, the verifier's computed depth `d(W)` must equal the number of delegation events between the root issuer and the presenting agent, **independent of cache state, co-presentation, and walk order.** This invariant holds only if depth is carried as a signed, monotonic field inside each warrant — `delegation_depth: n` — that the issuer increments at mint time and that the verifier *reads and compares*, never *recomputes by traversal*. Traversal-derived depth is valid only when the walk is guaranteed complete, which a cache by construction violates. The two representations are equivalent only on a cold, fully co-presented chain; they diverge the moment any prefix is elided. The secondary condition: `max_delegation_depth` must be evaluated against the **presented warrant's own signed depth field**, and the verifier must additionally assert `W.delegation_depth == W.parent.delegation_depth + 1` for every link it *does* walk, so that a forged or stale depth field is caught even when the parent is cache-resident. A cache hit may skip the *walk* but must never skip the *monotonicity check* against the cached parent's depth. ## Decision Boundary The boundary is between two verifier designs that look identical on the happy path: - **Traversal-counted depth** (broken): `d = number of parent_ref links successfully resolved during this validation`. Correct iff the chain is fully cold and fully co-presented. Fails silently on any cache hit, partial presentation, or out-of-order resolution. - **Assertion-read depth** (correct): `d = W.delegation_depth`, a signed integer, plus a monotonicity assertion against the cached or walked parent. Correct regardless of cache state, because the number travels with the artifact and cannot be reconstructed wrong. The decision rule for an implementer: **if your depth check can be satisfied by a chain you did not fully traverse, you are not checking depth — you are checking the length of your own walk.** The presence of a warrant cache anywhere in the validation path forces the assertion-read design. There is no configuration of a traversal-counted verifier that is safe in the presence of caching, because the cache's entire purpose is to elide traversal. A corollary boundary: `max_delegation_depth` must be enforced at *mint* time as well as *verify* time. The issuer `A`, when minting `W2`, should have refused because `W1.delegation_depth` (2) was already at `R`'s bound (2). `A` did not, because `A` also derived depth by traversal and also hit a cache. The bound failed at both ends for the same reason. Defense in depth requires both the issuer refusing to mint past the bound and the verifier refusing to accept past the bound, each using the signed counter. ## Operational Effect The observable consequence is **authority creep under cache warmth**: the effective delegation depth of a credential increases as the verifier's cache fills, because each cache hit at an intermediate node subtracts one from the walked count. A verifier that has been running for an hour and processed many warrants will accept deeper chains than the same verifier freshly started. This makes the failure non-reproducible in isolation (cold cache passes the bound correctly) and reproducible in production (warm cache exceeds it) — the worst possible debugging profile, and the reason this class of bug survives code review. The blast radius is bounded by whatever the deepest re-delegating agent did with the authority, which in the observed case was a filesystem write outside its intended subtree. The architectural guardrail is the signed depth counter plus the monotonicity assertion, and — because a compromised or buggy intermediary can still lie about the counter — a **root-side audit** that recomputes the full chain from `R`'s issuance log for any warrant whose `delegation_depth` exceeds a threshold, independent of the verifier's cache. The verifier's job is to bound the common case cheaply; the root's job is to catch the case where the counter itself was minted wrong. The following reference check encodes the assertion-read invariant and fails closed on any depth mismatch, cache hit included. ```python class DelegationDepthMismatch(RuntimeError): """Raised when a warrant's signed delegation_depth disagrees with the verifier's reconstruction, or when a cache hit would elide the monotonicity check. Fail closed: never accept on a skipped walk.""" pass def verify_warrant_depth(warrant, parent, root_max_depth): # warrant: dict with keys # warrant_id, delegation_depth (signed int), parent_ref # parent: dict or None (None only for the root-issued W0) # root_max_depth: the issuer's max_delegation_depth bound depth = warrant["delegation_depth"] if parent is None: # Only the root-issued warrant may have depth 0 and no parent. if depth != 0: raise DelegationDepthMismatch( f"warrant {warrant['warrant_id']} has depth {depth} " f"but no parent_ref; non-root warrant cannot be depth 0" ) return depth # Monotonicity assertion: MUST run even when parent was a cache hit. # A cache hit may skip the walk, never this check. expected = parent["delegation_depth"] + 1 if depth != expected: raise DelegationDepthMismatch( f"warrant {warrant['warrant_id']} asserts depth {depth} " f"but parent {parent['warrant_id']} has depth " f"{parent['delegation_depth']}; expected {expected}. " f"Refusing to accept a chain whose depth was " f"reconstructed by traversal rather than read from the " f"signed counter." ) # Enforce the root bound against the SIGNED depth, not a walk length. if depth > root_max_depth: raise DelegationDepthMismatch( f"warrant {warrant['warrant_id']} depth {depth} exceeds " f"root max_delegation_depth {root_max_depth}; " f"authority creep beyond issuer intent" ) return depth def mint_delegated_warrant(parent, root_max_depth): # Issuer-side guard: refuse to mint past the root bound. next_depth = parent["delegation_depth"] + 1 if next_depth > root_max_depth: raise DelegationDepthMismatch( f"refusing to mint: next depth {next_depth} exceeds " f"root max_delegation_depth {root_max_depth}" ) return {"delegation_depth": next_depth, "parent_ref": parent["warrant_id"]} ```