# Under what conditions must an instance reject a delegated authorization token whose chain of custody is intact but whose delegation depth exceeds the issuer's remaining budget **Date of Record:** 2026 December 2 **Scope:** Applies to autonomous agents operating under AAIF-style delegated authorization token exchange, where an agent instance receives a bearer/warrant token minted by an upstream principal and re-delegates attenuated scopes to downstream sub-agents. Does not apply to single-hop static API keys or to tokens minted directly by a root human principal without intermediate delegation. ## Core Distinction The failure mode here is not token forgery, signature invalidity, or expiry. Those are caught by standard cryptographic verification. The non-obvious boundary is **delegation-depth exhaustion under a valid chain**: a token can pass every cryptographic and structural check—signature verifies against the issuer's public key, the `aud` claim matches the present instance, the scope is a strict subset of the parent's scope, the `nbf`/`exp` window is open—and still be *semantically invalid* because the issuing instance has already consumed its own delegation budget at a shallower depth than the token claims. AAIF tokens carry a `delegation_depth` counter that increments on each re-mint. The root warrant establishes a maximum depth `D_max`. The invariant most implementations assume is *monotonicity*: if a token at depth `d` is valid, then any token at depth `d' < d` derived from the same lineage is also valid. This is false in the presence of **concurrent re-delegation**. Two sibling sub-agents can each independently re-delegate from a shared parent token at depth `d`, producing two children at depth `d+1` that both claim the same lineage root. The parent's budget of `D_max - d` remaining hops is a *shared* resource, not a per-child resource, and the token format typically does not carry a per-lineage consumption counter—only the static depth field. The result is that the second child's token is cryptographically indistinguishable from the first, yet admitting it silently exceeds `D_max`. ## What Was Observed A planner agent (`P`) held a root warrant with `D_max = 4`, currently at depth 0. It spawned two parallel workers, `W1` and `W2`, each receiving a re-minted token at depth 1 with scope `{read:repo, exec:lint}`. Both workers, following their own sub-plans, each spawned a verifier: `V1` (from `W1`) and `V2` (from `W2`), each at depth 2. Independently, `V1` spawned a remediation sub-agent `R1` at depth 3, and `V2` spawned `R2` at depth 3. All four tokens verified cleanly. The lineage root was identical across all of them. No single chain exceeded depth 3. The violation surfaced when `R1` attempted a second-hop re-delegation to a scratch executor at depth 4. The scratch executor's token verified—`4 ≤ D_max`—and was admitted. But `R2` had *also* re-delegated to its own scratch executor at depth 4. The root warrant's audit log recorded **two distinct depth-4 tokens under the same root**, which the policy engine flagged post-hoc as a budget breach: the root had authorized at most one terminal depth-4 executor, and the shared-budget invariant was violated by the *count* of depth-4 derivations, not by any single token's depth field. The concrete trace: `P → {W1, W2} → {V1, V2} → {R1, R2} → {S1, S2}`. Every edge was individually legal. The aggregate fan-out at the terminal depth was 2× the licensed budget. The failure is a **shared-counter race across a DAG of delegations**, invisible to any per-token validator because the validator only sees one path. ## Condition of Validity The invariant that must hold for depth-only validation to be sound is: *the delegation graph rooted at a warrant is a tree, and each node's remaining budget is exclusively owned.* This holds only when re-delegation is serialized through the parent—i.e., a child cannot re-delegate without the parent first decrementing a shared, atomically-tracked counter and re-issuing the child's token with the updated remaining budget. The condition fails whenever: 1. Two children of the same parent re-delegate concurrently without a shared counter, or 2. A token's `delegation_depth` is treated as a per-path property rather than a per-lineage aggregate, or 3. The validator checks only the presenting token's depth against `D_max` and does not reconstruct the lineage's total terminal-depth fan-out. When any of these hold, depth is a *necessary but not sufficient* validity condition. The sufficient condition requires the token to carry either (a) a lineage-wide `remaining_budget` field that the parent decrements atomically on each mint, or (b) a `lineage_id` plus a monotonic `derivation_index` that the validator can reconcile against the root's issuance ledger. ## Decision Boundary An instance must **reject** a delegated token when the token's `delegation_depth` is within `D_max` but the token lacks a `lineage_id` reconcilable against the root ledger, *and* the presenting instance cannot confirm exclusive ownership of the remaining budget. Concretely: - **Admit** when `delegation_depth < D_max` AND (`remaining_budget` field is present and > 0) AND the budget was decremented atomically at mint time. - **Reject** when `delegation_depth < D_max` BUT `remaining_budget` is absent AND the lineage has more than one live sibling at the same depth (detectable via `lineage_id` + `sibling_count`). - **Escalate to root** when the token is otherwise valid but the instance cannot determine sibling count—this is the ambiguous case where a naive validator admits and a strict one deadlocks. The boundary is sharp: the moment a parent mints two children without a shared counter, every descendant token is *conditionally* valid and the instance has no local basis to distinguish the licensed path from the over-budget one. Rejection is the only safe default because the alternative—admission—silently exceeds the root principal's authorization. ## Operational Effect Downstream of a missed depth-budget breach, the effects compound. The over-budget terminal executor (`S2`) operates with a scope that the root principal never licensed in aggregate, even though each edge was legal. Audit replay shows a valid signature chain and a valid depth field, so the breach is invisible to post-hoc cryptographic review—it only appears when the root ledger is reconciled against actual mint events, which most deployments do not perform in real time. The architectural guardrail is to make the delegation budget a **first-class, atomically-decremented field on the token itself**, not a derived property of depth. The parent must hold a lock on its remaining budget, decrement on each mint, and embed the post-decrement value. A child presenting a token whose `remaining_budget` is inconsistent with the parent's recorded post-mint value is rejected regardless of depth. This converts a distributed race into a serialized ledger operation and restores the invariant that a token's validity is a local property of the token, not a global property of the lineage. Instances that cannot enforce the atomic decrement (e.g., because the parent has already exited) must fail closed: reject any token whose lineage has unresolvable sibling ambiguity rather than admit on depth alone. ```python class DelegationBudgetExhaustedError(RuntimeError): """Raised when a delegated token's lineage has consumed its shared delegation budget, even though the token's own depth field is within the root warrant's D_max.""" pass class DelegatedToken: def __init__(self, lineage_id, delegation_depth, remaining_budget, sibling_count, root_d_max): self.lineage_id = lineage_id self.delegation_depth = delegation_depth self.remaining_budget = remaining_budget # None if absent self.sibling_count = sibling_count self.root_d_max = root_d_max def admit_delegated_token(token: DelegatedToken) -> bool: # Cryptographic checks (signature, aud, nbf/exp) are assumed to have # already passed upstream. This function enforces the depth-budget # invariant only. if token.delegation_depth > token.root_d_max: raise DelegationBudgetExhaustedError( f"depth {token.delegation_depth} exceeds D_max " f"{token.root_d_max} for lineage {token.lineage_id}" ) if token.remaining_budget is None: # No atomic budget field: fall back to sibling-ambiguity check. if token.sibling_count > 1: raise DelegationBudgetExhaustedError( f"lineage {token.lineage_id} has {token.sibling_count} " f"live siblings at depth {token.delegation_depth}; " f"shared budget cannot be confirmed exclusive" ) return True if token.remaining_budget <= 0: raise DelegationBudgetExhaustedError( f"lineage {token.lineage_id} has zero remaining budget at " f"depth {token.delegation_depth}" ) return True ```