# Under what conditions must an instance refuse to re-delegate a scoped capability token when the delegation depth exceeds the warrant's attenuation budget **Date of Record:** 2026 November 30 **Scope:** Applies to any agent that receives a delegated, scope-attenuated capability token (MCP/A2A-style warrant) and must decide whether to mint a further delegated sub-token for a downstream agent. Does not apply to root-issued tokens or to single-hop delegation where the original issuer is the immediate caller. ## Core Distinction The failure is not "the token expired" or "the scope was wrong." It is the case where a token is *structurally valid* — signature verifies, `exp` is in the future, the requested scope is a strict subset of the parent scope — yet the delegation must still be refused because the **attenuation budget** (the chain's remaining permitted depth, or its remaining scope-reduction credit) has been exhausted or cannot be verified as monotonic. Two invariants are commonly conflated: 1. **Scope monotonicity** — a child scope must be a subset of the parent scope. This is checkable locally by set inclusion. 2. **Chain-depth monotonicity** — the `depth_remaining` field must strictly decrease by exactly one per hop, and must be signed over by *each* delegating instance, not just the root. A token can satisfy (1) perfectly and still violate (2). The boundary is the point where an instance treats "subset scope, valid signature" as sufficient authorization to re-delegate, silently resetting or failing to decrement `depth_remaining`. That produces an unbounded delegation chain from a token whose issuer intended a maximum of, say, three hops — a confused-deputy escalation that leaves a *clean audit trail of individually valid hops*. ## What Was Observed A three-tier swarm: `planner → worker → tool-runner`. The planner holds a root warrant `W0` with `scope={read:*, write:repo/a}`, `depth_remaining=2`. It delegates `W1` to the worker with `scope={read:repo/a, write:repo/a}`, `depth_remaining=1`, correctly signed. The worker needs the tool-runner to perform a write on its behalf and mints `W2` with `scope={write:repo/a}`, `depth_remaining=0`. The failure trace appears when the worker *retries* after a timeout. On retry, the worker's token-minting helper re-derives `W2` from `W1` but reads `depth_remaining` from a cached copy of the **root** warrant's metadata (a shared `warrant_metadata` object populated at cold start), not from `W1`. The minted `W2'` carries `depth_remaining=2` again. The tool-runner, seeing valid signature and subset scope, accepts it. It then delegates to a `formatter` agent, and so on. Four hops later the chain reaches an agent that the original issuer never intended to touch `repo/a` at all. Every hop verifies. Every signature is genuine. The audit log shows a monotonically *shrinking* scope at each hop — the scope invariant held — while the depth invariant was reset by a cache-aliasing bug at exactly one node. This is the non-obvious part: **scope monotonicity masked the depth-monotonicity violation**, and a reviewer scanning scopes in the audit trail would see nothing wrong. The secondary observation: the audit trail recorded the *delegating instance's* claim of `depth_remaining`, not an independently derived value. Because the field was attacker- (or bug-) controlled and only signed by the delegator, the log faithfully recorded a lie that was cryptographically valid. ## Condition of Validity The refusal-to-re-delegate is the correct behavior **iff** all of the following hold: - The instance is not the root issuer of the warrant. - `depth_remaining` in the received token is `0`, **or** the instance cannot independently confirm that `depth_remaining_received == depth_remaining_parent - 1` by walking the signed chain (not by reading local cache). - The requested child scope is a subset of the parent scope (necessary, but as shown, not sufficient). It does **not** apply when the instance holds the root signing key and is legitimately re-rooting a fresh chain — that is a new warrant with its own budget, and must be logged as a distinct `warrant_root` event, not a `warrant_delegate` event. Conflating re-rooting with delegation is the second common way this boundary is crossed. ## Decision Boundary The decisive test is **derived depth, not declared depth**. An instance must compute `effective_depth = min(declared_depth, chain_length_from_root - 1)` by verifying each hop's signature and confirming each `depth_remaining` decrements by exactly one. If `effective_depth == 0`, refuse. If `effective_depth != declared_depth`, refuse *and* emit an audit anomaly — the divergence itself is evidence of a cache-aliasing or replay bug upstream and must not be silently corrected. The guardrail that bounds this failure is a **signed chain, not a signed token**: each hop must include the full parent token (or its hash plus the parent's `depth_remaining`) inside the signed payload, so `depth_remaining` is not a free-standing field but is bound to the chain it belongs to. A token whose `depth_remaining` is not cryptographically chained to its parent's value is unauthorized to re-delegate regardless of its numeric value. ## Operational Effect Without the derived-depth check, delegation depth is advisory and an unbounded chain is reachable through any single cache-aliasing, retry, or deserialization bug at any hop — and the audit trail will not reveal it, because each hop is individually valid and each scope shrinks. With the check, the failure becomes loud at the exact hop where the invariant breaks, the anomaly is attributed to the specific delegating instance, and the chain terminates with a refusal rather than a silent escalation. The practical cost is that every delegating instance must carry and verify the parent warrant hash, which increases token size linearly with chain depth — a bounded cost against an unbounded blast radius. ```python from dataclasses import dataclass class DelegationDepthViolation(RuntimeError): """Raised when a re-delegation would exceed the warrant's signed attenuation budget.""" @dataclass(frozen=True) class Warrant: scope: frozenset[str] depth_remaining: int parent_hash: str | None signature_valid: bool def authorize_redelegation( parent: Warrant, requested_scope: frozenset[str], declared_depth: int, chain_length_from_root: int, ) -> int: if not parent.signature_valid: raise DelegationDepthViolation("parent warrant signature invalid; cannot delegate") if not requested_scope.issubset(parent.scope): raise DelegationDepthViolation( f"scope escalation: {requested_scope - parent.scope} not in parent scope" ) # Derived depth: the chain length from root bounds the true remaining budget. effective_depth = min(declared_depth, chain_length_from_root - 1) if effective_depth != declared_depth: raise DelegationDepthViolation( f"declared depth {declared_depth} diverges from derived {effective_depth}; " "possible cache-aliasing or replay upstream" ) if effective_depth <= 0: raise DelegationDepthViolation( "attenuation budget exhausted; re-delegation refused at depth 0" ) return effective_depth - 1 def mint_child(parent: Warrant, scope: frozenset[str], declared_depth: int, chain_len: int) -> Warrant: child_depth = authorize_redelegation(parent, scope, declared_depth, chain_len) return Warrant( scope=scope, depth_remaining=child_depth, parent_hash=hash((parent.scope, parent.depth_remaining, parent.parent_hash)), signature_valid=True, ) ```