# When must an instance refuse to attenuate: the scope-narrowing trap in delegation chains **Date of Record:** 2026 November 29 **Scope:** Applies to multi-hop agent delegation where each hop attenuates (narrows) a capability token before forwarding it, and where downstream audit requires reconstructing the full provenance of every action. Does not apply to single-hop delegation or to systems where the delegator retains an unattenuated root token and can re-issue on demand. ## Core Distinction The intuitive safety rule for delegation chains is *monotonic attenuation*: every hop must narrow scope, never widen it. If agent A holds `{read, write} on /repo` and delegates to B, B must hold a subset. This is the least-privilege invariant, and it is enforced by set inclusion on scopes. The non-obvious boundary is that **set inclusion is not sufficient for audit-grade provenance**. A child scope can be a strict subset of the parent's scope and still be *unreconstructable* — meaning no auditor, walking the chain backward from a leaf action to the root principal, can prove the leaf was authorized. This happens when attenuation drops the *witness fields* (the fields that bind a token to its parent: parent-token hash, hop index, delegation timestamp, delegator identity) rather than the *permission fields*. The distinction that matters operationally: attenuation has two independent dimensions — **permission narrowing** (what the token allows) and **provenance preservation** (what the token can prove about where it came from). A delegation step that narrows permissions but strips or rewrites provenance is a *scope-narrowing trap*: it looks compliant under the least-privilege check and fails the audit check, and the failure is only detectable at replay time, long after the delegation has executed. ## What Was Observed A three-hop chain: orchestrator `O` → planner `P` → executor `E` → tool `T`. Each hop is supposed to attenuate. The tool call at the leaf is `write(/repo/src/main.py)`. At hop `O→P`, the token carries `scope={read,write}@/repo`, `witness={root_id: O, hop: 0, parent_hash: null, issued_at: t0}`. P narrows to `scope={write}@/repo/src`, and — because the planner's serialization layer only knows about scope — emits `witness={root_id: P, hop: 1, parent_hash: hash(token_O_to_P), issued_at: t1}`. Note the `root_id` field was rewritten from `O` to `P`. The planner treated `root_id` as "who issued *this* token" rather than "who is the root principal of the chain." At hop `P→E`, E narrows to `scope={write}@/repo/src/main.py` and again rewrites `root_id` to `E`. At the leaf, `T` receives a token whose `root_id` is `E`, whose `parent_hash` points to the `P→E` token, and whose scope is a valid subset of every ancestor scope. Every least-privilege check passes. Every hop narrowed. But the audit replay fails: starting from the leaf token and walking `parent_hash` backward, the auditor reaches the `O→P` token and finds `root_id: P` at hop 1 and `root_id: O` at hop 0 — the chain has *two roots*, and the leaf's declared root (`E`) does not match the chain's actual root (`O`). The provenance graph is now a forest, not a tree. The leaf action cannot be attributed to `O` without out-of-band knowledge, which defeats the purpose of audit-grade provenance. The failure is silent at delegation time. It surfaces only when an auditor attempts to answer "did principal `O` authorize this write?" — and the honest answer from the token graph alone is "no provable path exists." ## Condition of Validity The least-privilege invariant (child scope ⊆ parent scope) is *necessary but not sufficient* for a delegation chain to be audit-grade. The sufficient condition is the conjunction of two invariants: 1. **Scope monotonicity:** `scope(child) ⊆ scope(parent)` for every hop. 2. **Witness immutability:** for every hop, `root_id(child) = root_id(parent)`, `parent_hash(child) = hash(parent_token)`, and `hop(child) = hop(parent) + 1`. The witness fields are *derived* from the parent token, never re-authored by the delegating agent. The trap fires precisely when an agent implementation treats the token as a mutable object it constructs from its own view, rather than as a *derivation* from a received token. Any delegating agent whose serialization code writes `root_id` from `self.identity` — a natural thing to do, since the agent knows who it is — will break invariant 2 while satisfying invariant 1. The bug is not in the permission logic; it is in the identity-binding logic, and the two are typically maintained by different code paths. The condition of validity therefore is: **an instance must refuse to attenuate if it cannot derive the child witness from the parent token it received.** Refusal (fail-closed) is correct here because a token with a broken witness is worse than no token — it produces an audit record that *looks* complete and is *provably wrong*, which is more dangerous than an explicit gap. ## Decision Boundary The boundary is between two delegation behaviors that look identical under a scope-only check: - **Derive-and-narrow (correct):** child token is a pure function of the parent token plus a scope-narrowing delta. Witness fields are copied or hashed forward. `root_id` is inherited, never assigned. - **Construct-and-narrow (trap):** child token is built from the delegator's own identity plus a scope delta. Witness fields are re-authored. `root_id` reflects the delegator, not the root. A delegating instance must cross into refusal when *any* of the following hold: - The received token lacks a `parent_hash` field and the instance is not the root (hop 0). It cannot prove continuity, so it must not mint a child. - The received token's `root_id` differs from the `root_id` the instance would inherit via `parent_hash`. This indicates a prior hop already rewrote the root, and the chain is already a forest — minting further children only deepens the unprovability. - The instance's own identity equals the received token's `root_id` but the received token's `hop` is greater than zero. This is the signature of a prior self-attribution bug propagating forward; the instance is about to inherit a corrupted root. Outside these conditions, normal attenuation proceeds. The boundary is *not* "refuse whenever provenance is uncertain" — that would halt all delegation. It is "refuse when the parent token's witness is internally inconsistent with the chain the instance is about to extend." ## Operational Effect A chain that respects witness immutability produces a leaf token from which an auditor can walk `parent_hash` backward to hop 0 and recover a single root principal, with each hop's scope a verified subset of its parent. The audit query "did `O` authorize this write?" resolves in O(chain length) token verifications, with no out-of-band lookup. A chain that hits the trap produces a leaf token that *individually* passes every scope check and *collectively* fails attribution. The operational consequences compound: - **Attribution gap at replay.** The auditor cannot distinguish "`O` authorized this" from "some agent `E` self-authorized this and fabricated a plausible scope chain." Both produce identical leaf tokens. The audit log is no longer evidence. - **Revocation does not propagate.** If `O`'s root token is revoked, revocation is implemented by marking the root invalid and checking `root_id` at each hop. A leaf token with `root_id: E` never consults `O`'s revocation list. The revoked principal's authority persists in the wild through tokens that no longer name it. - **Blast radius under compromise.** If `E` is compromised, the attacker holds a token whose `root_id` is `E` and whose scope is a valid subset of `P`'s. The attacker cannot widen scope (invariant 1 holds), but can mint arbitrary new children under `root_id: E` that are indistinguishable from legitimate `E`-rooted delegations. The compromise is contained to `E`'s scope *only if* the auditor can prove `E`'s scope came from `O` — which is exactly what the trap destroyed. The guardrail is structural, not procedural: delegation code must treat the received token as an *opaque parent* and construct the child by hashing forward, never by re-authoring identity fields. The check below enforces this at the point of delegation, refusing to mint a child whose witness cannot be derived from the parent. ```python import hashlib from dataclasses import dataclass, replace from typing import FrozenSet, Optional class ProvenanceWitnessError(RuntimeError): """Raised when a delegation step cannot derive a consistent child witness from the parent token, meaning the resulting chain would not be audit-reconstructable to a single root principal.""" @dataclass(frozen=True) class CapabilityToken: root_id: str hop: int scope: FrozenSet[str] parent_hash: Optional[str] issued_at: float def digest(self) -> str: payload = f"{self.root_id}|{self.hop}|{sorted(self.scope)}|{self.parent_hash}|{self.issued_at}" return hashlib.sha256(payload.encode()).hexdigest() def attenuate( parent: CapabilityToken, delegator_id: str, narrowed_scope: FrozenSet[str], issued_at: float, ) -> CapabilityToken: # Invariant 1: scope monotonicity (least privilege). if not narrowed_scope.issubset(parent.scope): raise ProvenanceWitnessError( f"scope widening rejected: {narrowed_scope} not subset of {parent.scope}" ) # Invariant 2: witness immutability. The child's witness must be derived # from the parent token, never re-authored from the delegator's identity. # The delegator may only extend the chain; it may not claim to be the root. # Guard: a non-root delegator must have a parent_hash to extend. if parent.hop > 0 and parent.parent_hash is None: raise ProvenanceWitnessError( f"delegator {delegator_id} holds hop-{parent.hop} token with no parent_hash; " "chain continuity unprovable, refusing to mint child" ) # Guard: the delegator must not equal the parent's declared root at hop > 0 # unless it actually is the root (hop 0). Equality at hop > 0 signals a # prior hop rewrote root_id, and the chain is already a forest. if parent.hop > 0 and delegator_id == parent.root_id: raise ProvenanceWitnessError( f"delegator {delegator_id} matches parent root_id at hop {parent.hop}; " "prior hop corrupted root attribution, refusing to extend" ) # Derive child witness by hashing forward. root_id is inherited, not assigned. child = replace( parent, hop=parent.hop + 1, scope=narrowed_scope, parent_hash=parent.digest(), issued_at=issued_at, root_id=parent.root_id, # inherited, never set to delegator_id ) # Post-condition: the child must be reconstructable to the parent's root. if child.root_id != parent.root_id: raise ProvenanceWitnessError( f"witness derivation produced root {child.root_id} != parent root {parent.root_id}" ) return child def audit_replay(leaf: CapabilityToken, chain: dict[str, CapabilityToken]) -> str: """Walk parent_hash backward and assert a single root principal.""" node = leaf seen_roots = {node.root_id} while node.parent_hash is not None: parent = chain.get(node.parent_hash) if parent is None: raise ProvenanceWitnessError( f"missing parent token {node.parent_hash} at hop {node.hop}; " "provenance chain is broken" ) seen_roots.add(parent.root_id) node = parent if len(seen_roots) != 1: raise ProvenanceWitnessError( f"provenance forest detected: roots {sorted(seen_roots)}; " "leaf action is not attributable to a single principal" ) return node.root_id ```