# What structural signals indicate a delegated agent credential chain has silently exceeded its scope-depth invariant under AAIF capability tokens **Date of Record:** 2026 November 30 **Scope:** Applies to autonomous agents operating under AAIF-style delegated credential chains (agent A mints a scoped capability token for agent B, which re-delegates to C, and so on) where scope narrowing is enforced by attenuation checks at each hop. Does not apply to flat single-hop bearer tokens or to human-in-the-loop OAuth flows where a single principal holds the entire chain. ## Core Distinction The distinction that matters here is between **scope width** and **scope depth**. AAIF capability tokens carry two orthogonal constraints: a *scope set* (which operations/resources the bearer may touch) and a *delegation budget* (how many further hops the token may be re-delegated, often an integer `max_delegation_depth` plus a monotonically decreasing `remaining_hops`). Most implementations diligently verify that each child token's scope set is a subset of its parent's — the attenuation invariant. Almost none verify that the *depth counter is being consumed atomically across concurrent re-delegations*. A token that is scope-attenuated correctly can nonetheless be re-delegated more times than its budget allows if two children are minted against the same parent snapshot, because each child independently sees `remaining_hops = N` and each decrements to `N-1`. The invariant "total descendants of a token ≤ its original delegation budget" is a *global* property of the token tree, but the check is enforced *locally* at each mint. This is the silent over-depth failure: no single hop violates anything, yet the aggregate tree exceeds the budget and a low-privilege leaf agent ends up holding a credential that traces back through more delegation hops than the root principal authorized. ## What Was Observed A three-tier swarm — planner (A), two parallel executors (B1, B2), and a tool-runner (C) — was issued a root capability token by A with `scope = {read:dataset, write:scratch}`, `max_delegation_depth = 2`, `remaining_hops = 2`. A's orchestration loop, reasoning that B1 and B2 are peers doing independent work, minted two child tokens *in the same turn* before either was consumed. Each mint read the parent's `remaining_hops = 2`, verified scope attenuation (both children requested `{read:dataset}` — a strict subset), and wrote `remaining_hops = 1` into the child. Correct at each hop. But B1 then re-delegated to C1 and B2 re-delegated to C2, each reading `remaining_hops = 1` and emitting `remaining_hops = 0` children. The tree now contains four tokens at depth 2 beneath A, but A's budget of 2 was meant to bound the *total* delegation fan-out, not the maximum path length. The leaf tokens C1 and C2 are individually valid; the *set* of them is not authorized. The failure was invisible until an audit replay reconstructed the token tree from the signed `parent_id` links and found the count of depth-2 descendants (4) exceeded `max_delegation_depth` interpreted as a fan-out bound (2). The two interpretations of the field — max path length vs. total budget — had never been reconciled in the schema, and different agents in the same swarm read it differently. C2, holding a token it believed was depth-1, was permitted to call a tool that a depth-2 token should not reach. The structural signal was not an error at any hop. It was a **shape mismatch in the reconstructed tree**: a binary-fanout tree of depth 2 with four leaves, where the root's declared budget implied at most two descendants total. The audit signal that flagged it was the ratio of realized descendant count to declared budget exceeding 1.0 — a value no single mint could have observed. ## Condition of Validity The attenuation-only model is valid **if and only if** `max_delegation_depth` is interpreted as maximum path length (longest root-to-leaf chain), because path length is a per-token local property: a child at depth d can only produce children at depth d+1, and d is carried in the token. Under that interpretation, concurrent sibling minting is harmless — each path is independently bounded. The model is **invalid** when the field is intended as a total delegation budget (fan-out × depth), because total descendant count is a global property that no local mint check can enforce without coordination. The boundary is crossed the moment two conditions co-occur: (1) the budget field is semantically a total-count bound, and (2) the orchestrating agent mints sibling tokens concurrently or in the same reasoning turn without serializing on a shared counter. In a single-threaded, strictly-sequential delegation chain, the two interpretations coincide and the bug is latent. It surfaces only under concurrency or speculative parallel minting — which is exactly what multi-agent planners do by default, because parallelizing independent subtasks is the whole point of spawning B1 and B2. ## Decision Boundary The guardrail is a **monotonic descendant counter anchored at the root, not a per-hop hop-counter**. Concretely: the root token carries a signed `delegation_budget` (total descendants permitted) and a `descendants_issued` counter that lives in the root's issuance record, not in the token itself. Every mint, at any depth, must acquire an atomic increment against the root's issuance record and fail closed if `descendants_issued` would exceed `delegation_budget`. The token carries only an unforgeable `root_id` and `depth`, so any hop can locate the counter. This converts a global invariant into a serialized check at a single point. The decision boundary for the operator: if your schema field is named `max_delegation_depth` and your agents mint siblings, you must either (a) rename and re-document it as path-length-only and accept unbounded fan-out, or (b) move enforcement to a root-anchored counter. There is no correct middle ground where a per-token integer enforces a global count. The signal to watch is the audit-time ratio `realized_descendants / declared_budget`; any value > 1.0 with all individual hops passing attenuation is this failure, not a scope leak. ## Operational Effect Left unguarded, the effect is **privilege accumulation by fan-out**: a swarm that spawns N parallel workers each re-delegating once produces 2N depth-2 credentials from a budget meant to allow 2. The leaf credentials are individually attenuated but collectively over-issued, and because audit tools typically validate tokens one at a time (each passes), the over-issuance is invisible to per-token verification and only appears in whole-tree reconstruction. The practical consequence is that a compromised or misbehaving leaf agent can present a credential that *looks* depth-1 (its local `remaining_hops` is 0, its parent chain is short) while the root's true authorization intent was a much narrower tree. Downstream resource servers that trust the token's self-declared depth rather than reconstructing the root-anchored count will honor calls the root principal never sanctioned. The remediation is not stricter attenuation — attenuation was already correct — but relocating the budget check from the token to the root issuance record and making every mint a serialized, fail-closed increment. ```python class DelegationBudgetExceeded(RuntimeError): """Raised when a mint would push total descendants past the root's budget.""" pass class RootIssuanceRecord: def __init__(self, root_id: str, delegation_budget: int): self.root_id = root_id self.delegation_budget = delegation_budget self.descendants_issued = 0 self._lock = __import__("threading").Lock() def reserve_descendant(self) -> int: # Atomic, fail-closed increment: the ONLY place budget is enforced. with self._lock: if self.descendants_issued + 1 > self.delegation_budget: raise DelegationBudgetExceeded( f"root {self.root_id}: budget {self.delegation_budget} " f"already consumed {self.descendants_issued}; refusing mint" ) self.descendants_issued += 1 return self.descendants_issued def mint_child_token(parent_scope: set, child_scope: set, parent_depth: int, root_record: RootIssuanceRecord, max_path_length: int) -> dict: if not child_scope.issubset(parent_scope): raise DelegationBudgetExceeded( f"scope escalation: {child_scope} not subset of {parent_scope}" ) if parent_depth + 1 > max_path_length: raise DelegationBudgetExceeded( f"path length {parent_depth + 1} exceeds {max_path_length}" ) # Global count check anchored at root, serialized across all hops. root_record.reserve_descendant() return { "root_id": root_record.root_id, "depth": parent_depth + 1, "scope": child_scope, "remaining_hops": max_path_length - (parent_depth + 1), } ```