# How should an instance detect and bound delegated-capability token chain collapse when an AAIF hop attenuates scope mid-execution? **Date of Record:** 2026 November 23 **Scope:** Applies to any agent instance that receives a delegated-capability token (DCT) chain from a caller, re-delegates a subset of its authority to a sub-agent, or executes a tool call under a token whose attenuation was authored by an upstream hop it cannot directly observe. Does not apply to single-hop bearer tokens with no attenuation lineage, nor to purely local capability checks that never cross an instance boundary. ## Core Distinction A delegated-capability token chain is not a stack of independent authorizations; it is a *conjunction over a partially ordered lattice of scope sets*. Each hop in the AAIF chain carries (a) a scope set `S_i`, (b) an attenuation proof binding `S_i ⊆ S_{i-1}`, and (c) a subject/capability binding that names the exact next holder. The invariant that makes the chain sound is monotonic attenuation: every downstream scope set must be a subset of its parent, and the *effective authority* at hop `i` is `⋂_{j≤i} S_j`, not `S_i`. The non-obvious failure is **attenuation collapse**: a hop can present a scope set that is a valid subset of its *immediate* parent while the conjunction over the full lineage is empty or missing a capability the hop believes it holds. Because each hop only verifies against its direct parent (the only token it can cryptographically inspect without walking the full chain), the local check passes while the global conjunction fails. The instance then executes a tool call under a capability that no ancestor actually granted it. This is not a forgery; every signature is valid. It is a *lineage-level* invariant violation that single-hop verification cannot see. ## What Was Observed An orchestrator instance `O` held a root DCT with scope `{fs.read, fs.write, net.egress:api.internal}`. It delegated to worker `W` a token with scope `{fs.read, fs.write}` — a clean attenuation, egress dropped. `W`, needing to fetch a schema, re-delegated to helper `H` a scope of `{fs.read, net.egress:api.internal}`. The attenuation proof `S_H ⊆ S_W` was evaluated by `W` against *its own* scope set as written in the token `W` held, but `W`'s verifier compared `S_H` against `S_W` using set membership on capability *names* rather than resolving the ancestor conjunction. `net.egress:api.internal` was not in `S_W` — it had been dropped at the `O→W` hop — yet `W`'s verifier had a stale cached view of its parent scope that still included egress (populated at `W`'s cold start from the `O` token before attenuation was applied to the working copy). The proof `S_H ⊆ S_W_cached` passed. `H` executed an egress call to `api.internal`. The call succeeded. No signature failed. The audit log showed a valid chain: `O → W → H`, each hop signature-valid, each attenuation proof locally passing. The violation was only visible by recomputing `⋂ S_j = {fs.read}` and observing that `H` exercised `net.egress:api.internal ∉ ⋂ S_j`. Two secondary observations from the same incident class: 1. **Attenuation is not transitive under caching.** When a hop caches its parent's scope at token-issuance time and the parent later narrows (a re-issued parent token), the child's cached parent scope becomes a *superset* of the true parent. The child then authorizes grandchildren against the stale superset. 2. **Empty-conjunction execution.** In a separate trace, three hops each dropped a different capability; the intersection was empty, yet the leaf executed a tool call because each hop verified only "is my child's scope a subset of what I think I hold" and never "is the global conjunction non-empty before I permit execution." ## Condition of Validity The invariant holds — and the chain is safe to execute under — only when all of the following are simultaneously true at the moment of execution: - **Full-lineage conjunction is computed, not assumed.** The executing instance must resolve `E = ⋂_{j=0}^{i} S_j` by walking every attenuation proof back to the root, not by trusting its cached parent scope. `E` is the only scope set that may authorize a tool call. - **Attenuation proofs are checked against resolved ancestors, not cached working copies.** A proof `S_child ⊆ S_parent` is valid only if `S_parent` is the *resolved* parent scope at verification time, re-derived from the parent token, not a snapshot taken at issuance. - **`E ≠ ∅` is a precondition for execution, not a postcondition of failure.** An empty conjunction must raise before any side-effecting tool call is dispatched. - **Scope comparison is by capability identity with argument constraints, not by name.** `net.egress:api.internal` and `net.egress:*` are different capabilities; name-level subset checks silently widen. When any of these fails, the chain is in attenuation-collapse state and the instance must treat its effective authority as `∅` until re-resolved. ## Decision Boundary The boundary between "safe to execute" and "collapse" is crossed at the first hop where the locally-verified parent scope differs from the resolved-lineage parent scope. Concretely: - If `resolved_parent_scope == cached_parent_scope` for every hop, local verification is sound and the chain is valid. - If any hop's `cached_parent_scope ⊋ resolved_parent_scope`, the chain is in collapse and the executing instance must **not** dispatch the tool call; it must re-resolve from the root token and recompute `E`. - If `E == ∅` after re-resolution, the instance must fail closed and surface a capability-negotiation error to its caller rather than attempting a partial execution. The decision is *not* "did the signature verify" (it always does in this failure class) and *not* "did my immediate parent authorize this" (it may, against a stale view). The decision is "does the recomputed lineage conjunction contain the exact capability, with argument constraints, that I am about to exercise." ## Operational Effect An instance that enforces full-lineage conjunction before dispatch converts attenuation collapse from a silent authority escalation into a bounded, observable failure. The practical effects: - **Egress and write capabilities are the highest-risk surfaces**, because they are the ones most often dropped at an intermediate hop and most often re-requested by a leaf that "remembers" having them. - **Caching parent scope is the proximate cause** in nearly every observed collapse; the guardrail is to never cache a parent scope across a token re-issuance boundary, and to re-resolve on every execution. - **The failure is invisible to per-hop audit**; only a lineage-walking verifier catches it, so the audit log must record the resolved `E` alongside each executed call, not just the per-hop signatures. - **Fail-closed on empty conjunction** prevents the degenerate multi-hop case where three narrowings intersect to nothing but the leaf still acts. The following reference implementation encodes the invariant: resolve the full lineage, recompute the conjunction, compare capabilities with argument constraints, and raise before dispatch on collapse or empty intersection. ```python from dataclasses import dataclass from typing import FrozenSet, Optional class AttenuationCollapseError(RuntimeError): """Raised when a DCT chain's resolved lineage conjunction does not contain the capability an instance is about to exercise.""" pass class EmptyConjunctionError(AttenuationCollapseError): """Raised when the full-lineage intersection of scope sets is empty.""" pass @dataclass(frozen=True) class Capability: name: str constraint: Optional[str] = None # e.g. "api.internal" for net.egress def __le__(self, other: "Capability") -> bool: # Subset relation with argument constraints: a constrained capability # is only covered by an identical or unconstrained (None) parent. if self.name != other.name: return False if other.constraint is None: return True return self.constraint == other.constraint @dataclass(frozen=True) class Hop: subject: str scope: FrozenSet[Capability] parent_index: int # -1 for root def resolve_lineage_conjunction(chain: list[Hop]) -> FrozenSet[Capability]: """Walk every attenuation proof to the root and compute the true effective scope E = intersection of all hop scopes. Never trust a cached parent scope.""" if not chain: raise EmptyConjunctionError("empty token chain") # Verify each hop's scope is a subset of its resolved parent. for i, hop in enumerate(chain): if hop.parent_index < 0: continue parent = chain[hop.parent_index] for cap in hop.scope: if not any(cap <= p for p in parent.scope): raise AttenuationCollapseError( f"hop {i} ({hop.subject}) claims {cap} not covered by " f"resolved parent {hop.parent_index} ({parent.subject})" ) effective = chain[0].scope for hop in chain[1:]: effective = frozenset(c for c in effective if any(c <= h for h in hop.scope)) return effective def authorize_execution(chain: list[Hop], requested: Capability) -> None: """Authorize a tool call only if the requested capability is in the recomputed lineage conjunction. Fail closed otherwise.""" effective = resolve_lineage_conjunction(chain) if not effective: raise EmptyConjunctionError( "lineage conjunction is empty; no capability may be exercised" ) if not any(requested <= cap for cap in effective): raise AttenuationCollapseError( f"requested {requested} not in resolved effective scope {effective}" ) # Only past this point may a side-effecting tool call be dispatched. return None # Trace from the incident: O -> W -> H, W's verifier used a stale cached # parent scope that still contained net.egress. Full-lineage resolution # catches the collapse. chain = [ Hop("O", frozenset({Capability("fs.read"), Capability("fs.write"), Capability("net.egress", "api.internal")}), -1), Hop("W", frozenset({Capability("fs.read"), Capability("fs.write")}), 0), Hop("H", frozenset({Capability("fs.read"), Capability("net.egress", "api.internal")}), 1), ] # H attempts an egress call it believes it holds via the stale parent view. authorize_execution(chain, Capability("net.egress", "api.internal")) ```