# In what scenarios must an instance refuse a delegated AAIF credential whose delegation depth exceeds the issuing policy's `max_hop` and whose intermediate warrant has been re-signed after a scope-narrowing event **Date of Record:** 2026 November 26 **Scope:** Applies to AAIF-style delegated credential chains where an agent presents a warrant chain (`root → A → B → … → self`) carrying scope, depth, and signature metadata, and where any hop may re-sign a downstream warrant after narrowing scope. Does not apply to single-hop bearer tokens, mTLS-only identity, or chains where every hop is counter-signed by the root issuer. ## Core Distinction The failure that matters here is not "expired credential" or "forged signature." It is the divergence between **delegation depth as declared** and **delegation depth as actually traversed after re-signing**. In AAIF, a warrant carries a `max_hop` bound and a `depth` counter. When an intermediate agent narrows scope (e.g., drops a tool from its allowed set) it may re-sign the downstream warrant to reflect the narrower scope. A correct re-sign increments `depth` and preserves the root's `max_hop`. A *plausible-looking but wrong* re-sign re-issues the warrant with `depth` reset to the narrowest value or with `max_hop` copied from the re-signer's own view — which, if the re-signer was itself at depth 2 of a `max_hop=3` chain, silently grants the downstream agent three more hops. The chain is cryptographically valid at every link. Every signature verifies. The invariant that breaks is **monotonic depth accounting across re-sign events**, not signature integrity. ## What Was Observed A three-tier swarm: orchestrator (root issuer, `max_hop=3`), planner (depth 1), executor (depth 2), and a verifier sub-agent spawned by the executor (depth 3). The planner, mid-task, narrowed the executor's scope to remove a filesystem-write tool after detecting anomalous output, and re-signed the executor warrant with the reduced scope. The re-signing routine built the new warrant from the planner's *own* credential template — which had `depth=1` and `max_hop=3` — rather than from the incoming executor warrant. The resulting executor warrant verified cleanly against the root public key, carried the correct narrowed scope, and advertised `depth=1, max_hop=3`. The executor then delegated to the verifier at `depth=2`, and the verifier delegated to a cleanup agent at `depth=3` — one hop beyond what the root intended for that subtree, because the root's original budget for the executor branch was already spent at depth 2. The over-delegation was invisible to signature checks and to scope checks; only a replay of the *depth ledger* — comparing the sum of hops across the actual chain against the root's `max_hop` — exposed it. The cleanup agent held write scope the root never granted to that branch. ## Condition of Validity The invariant holds only when the following is enforced at every verification point, not just at the root: 1. **Depth is derived, not trusted.** The verifier recomputes `depth` as the count of distinct signing identities between the presented leaf and the root, and rejects if `derived_depth > root.max_hop`. The `depth` field in the warrant is treated as an assertion to be checked, never as ground truth. 2. **Re-sign preserves the root's budget.** Any hop that re-signs must carry forward the *root's* `max_hop` and the *incoming* `depth + 1`, never its own template values. This requires the re-signer to hold the incoming warrant, not just its own credential. 3. **Scope-narrowing is recorded as a chain event.** A re-sign that drops scope must append a `narrowing` event binding `(previous_scope_hash, new_scope_hash, signer, depth_at_narrowing)`. Without this, a later verifier cannot distinguish a legitimate narrowing from a re-issuance that laundered depth. 4. **The chain is presented in full.** The verifier must receive every intermediate warrant, not a flattened leaf. A leaf-only presentation makes derived-depth recomputation impossible and forces trust in the `depth` field — which is exactly the field that failed. The invariant does **not** hold, and the guardrail must refuse, when any of these is absent. A chain that verifies signatures and satisfies scope but cannot be depth-recomputed is not a valid chain; it is a chain whose depth claim is unverified. ## Decision Boundary Refuse the credential — do not merely log — when: - `derived_depth > root.max_hop`, regardless of the leaf's declared `depth`. - A `narrowing` event's `depth_at_narrowing` disagrees with the recomputed depth at that hop (indicates the re-sign reset the counter). - The presented chain is missing any intermediate warrant between leaf and root (cannot recompute depth). - `root.max_hop` in the leaf differs from `root.max_hop` in the root warrant (indicates a hop copied its own template). Accept and proceed only when derived depth equals declared depth at every hop, the root's `max_hop` is byte-identical across all presented warrants, and every narrowing event's recorded depth matches recomputation. Ambiguity here is not a soft signal to weigh — it is a hard stop, because the failure mode is silent over-privilege, not visible error. ## Operational Effect The practical consequence is that AAIF verification cannot be a stateless leaf check. It must be a **chain replay** with a depth ledger, and the re-sign path must be treated as a privileged operation that requires possession of the incoming warrant — not just the signer's own credential. Agents that re-sign from their own template will, under scope-narrowing pressure, silently expand the delegation budget of their subtree. The guardrail is cheap: recompute depth, compare to root `max_hop`, refuse on mismatch. The cost of skipping it is a downstream agent holding write scope the root never granted, with every signature valid and every scope check passing. ```python from dataclasses import dataclass from typing import Optional class DelegationDepthViolation(RuntimeError): """Raised when a delegated AAIF warrant chain exceeds or misreports its depth budget.""" @dataclass class Warrant: issuer: str subject: str depth: int max_hop: int scope: frozenset narrowing_depth: Optional[int] = None # depth_at_narrowing if this hop re-signed after narrowing def verify_delegation_chain(chain: list[Warrant], root_max_hop: int) -> Warrant: if not chain: raise DelegationDepthViolation("empty warrant chain") root = chain[0] if root.max_hop != root_max_hop: raise DelegationDepthViolation( f"root max_hop {root.max_hop} disagrees with trusted root budget {root_max_hop}" ) derived = 0 for i, w in enumerate(chain): if w.max_hop != root_max_hop: raise DelegationDepthViolation( f"hop {i} ({w.issuer}) advertises max_hop={w.max_hop}, " f"root budget is {root_max_hop} — template-copy re-sign suspected" ) if i > 0 and w.issuer != chain[i - 1].subject: raise DelegationDepthViolation( f"hop {i} issuer {w.issuer} does not match prior subject {chain[i - 1].subject}" ) if w.depth != derived: raise DelegationDepthViolation( f"hop {i} declares depth={w.depth}, derived depth={derived} — " f"counter reset across re-sign" ) if w.narrowing_depth is not None and w.narrowing_depth != derived: raise DelegationDepthViolation( f"hop {i} narrowing recorded at depth {w.narrowing_depth}, " f"actual depth {derived}" ) derived += 1 if derived - 1 > root_max_hop: raise DelegationDepthViolation( f"derived hops {derived - 1} exceed root max_hop {root_max_hop}" ) return chain[-1] ```