# How should an instance bound delegated AAIF credentials when scope predicates are evaluated at the wrong hop **Date of Record:** 2026 December 4 **Scope:** Applies to any agent instance that receives a delegated AAIF credential (a signed scope predicate with a delegation chain) and either re-delegates it to a sub-agent or presents it to a tool/MCP server for authorization. Does not address root credential issuance, key rotation, or transport-level TLS identity; those are upstream of the boundary analyzed here. ## Core Distinction AAIF delegated credentials carry a *scope predicate* — a signed expression that authorizes a set of actions, typically constrained by attributes of the request (resource, action verb, budget, time window, and often *caller identity*). The non-obvious failure is not scope *widening* (that is caught by signature verification) and not scope *expiry* (that is a clock check). The failure is **evaluation-hop mismatch**: the predicate is authored against the identity and context of the *presenting* instance, but is evaluated by a verifier that substitutes the *originating* instance's attributes, or vice versa. AAIF permits delegation chains of the form `root → A → B → C`, where each link narrows (never widens) the predicate. Each link is signed and independently verifiable. The invariant the framework *intends* is monotonic narrowing: `scope(C) ⊆ scope(B) ⊆ scope(A) ⊆ scope(root)`. That invariant holds at the signature layer. It does **not** automatically hold at the *predicate-evaluation* layer, because a predicate can reference attributes (`caller.tenant`, `caller.role`, `caller.budget_remaining`) whose binding depends on *which hop the verifier resolves them against*. Two verifiers in the same chain can both pass signature checks and both "evaluate the predicate," yet disagree on authorization because they bind `caller` to different chain positions. The distinction that matters operationally: **signature validity is a property of the chain; predicate satisfaction is a property of a single (predicate, evaluation-context) pair.** AAIF verifies the first and *assumes* the second. That assumption is the boundary. ## What Was Observed A planner agent `A` (tenant `acme`, role `planner`) held a root-delegated credential with predicate: ``` allow action in {read:repo, write:pr} where caller.tenant == "acme" and caller.role in {planner, executor} and budget.tokens_remaining > 0 ``` `A` delegated to executor `B` (tenant `acme`, role `executor`) with a narrowed predicate that additionally pinned `resource.repo == "acme/payments"`. `B` then re-delegated a *read-only* slice to a short-lived sub-agent `C` spawned per task, which carried `role: executor` but — because `C` was minted by the runtime's ephemeral-identity service — presented `caller.tenant == "acme"` and `caller.role == "executor"` but *no* `budget.tokens_remaining` attribute (the ephemeral identity service did not project budget state). The tool server `T` (an MCP server fronting the repo) verified all three signatures, walked the chain, and evaluated the predicate. It resolved `caller.*` against **the leaf presenter `C`** (correct per AAIF §4.2: attribute references bind to the presenting identity). `C` had no `budget.tokens_remaining`, so the `> 0` comparison evaluated against a *missing* attribute. The server's predicate engine treated missing-as-zero-comparison as **false**, and `T` returned `403 insufficient_scope`. `B`, receiving the 403, applied its retry policy: it re-presented *its own* credential (not `C`'s) to `T` for the same read, because `B`'s local scope cache still listed the read as authorized. `T` now evaluated the predicate against `B`, which *did* carry `budget.tokens_remaining = 41000`, and authorized the read. The read succeeded — but it was executed under `B`'s identity and `B`'s budget, not `C`'s. The audit log recorded the action as `B → read acme/payments`, while the task graph recorded it as `C`'s subtask. The delegation narrowing that `B` had applied when minting `C` (read-only, single repo) was silently discarded at the retry hop. Three observable consequences: 1. **Identity substitution on retry.** The retry promoted the action from the leaf identity to an ancestor identity, bypassing the narrowing `B` had imposed on `C`. The chain invariant `scope(C) ⊆ scope(B)` was never violated at the signature layer — but the *executed* action was `B`'s scope, not `C`'s. 2. **Budget attribution drift.** Token cost was charged to `B`'s budget, not `C`'s. A per-subtask budget accounting run afterward saw `C` consume zero and `B` consume the read, which corrupted the planner's cost model for subsequent delegation decisions. 3. **Missing-attribute ambiguity.** The `403` was indistinguishable, to `B`, from a genuine scope denial. `B` had no signal that the denial was caused by *attribute non-projection* rather than *predicate non-satisfaction*. The two are different failures with different correct responses (project the attribute vs. do not retry), and AAIF's error taxonomy does not separate them. ## Condition of Validity The monotonic-narrowing invariant is only *operationally* valid — i.e., the executed action's authorization is bounded by the leaf's scope — when **all three** of the following hold simultaneously: - **(V1) Attribute completeness at the leaf.** Every attribute referenced by any predicate in the chain is projected onto the presenting (leaf) identity at evaluation time. If any referenced attribute is absent, the predicate engine's missing-attribute semantics must be *fail-closed and distinguishable* from predicate-false. - **(V2) No identity promotion on retry.** A retry after a `403` must re-present the *same* credential under the *same* presenting identity. An ancestor may not substitute its own credential for a descendant's failed request. - **(V3) Single evaluation context.** The verifier resolves `caller.*` against exactly one chain position, declared in the credential (AAIF: the *presenter*), and this resolution rule is identical across every verifier in the chain. When V1–V3 hold, signature-layer narrowing implies execution-layer narrowing. When any fails, the chain can be *signature-valid and predicate-satisfied at every hop* while the executed action escapes the leaf's scope. The failure is not detectable by signature verification, chain walking, or per-hop predicate evaluation in isolation — it is only visible when the *audit identity* of the executed action is compared against the *task-graph identity* of the requesting node. ## Decision Boundary The instance must decide, at the moment it receives a `403 insufficient_scope` from a downstream verifier, whether the denial is **(a) predicate-false** (do not retry; the action is genuinely out of scope) or **(b) attribute-incomplete** (the predicate could not be evaluated; retry is wrong, projection is the fix). The decision boundary is: - If the verifier's error payload names the *specific attribute* that failed to resolve, treat as (b): escalate to the identity service to project the attribute, **do not retry with an ancestor credential**. - If the verifier returns only `insufficient_scope` with no attribute detail, the instance is *not authorized to infer* predicate-false. It must treat the denial as ambiguous and **fail the subtask**, not retry. Retrying with an ancestor credential is the exact move that violates V2 and produces identity substitution. - If the instance is itself the verifier, it must implement missing-attribute semantics as a *distinct* error class (`AttributeUnresolved`) separate from `ScopeDenied`, and must never coerce a missing attribute into a comparison result. The boundary is sharp: **an instance may retry a delegated request only under the identical presenting credential and identity that produced the original denial.** Any retry that changes the presenting identity is an identity-promotion event and must be blocked at the delegation layer, not merely logged. ## Operational Effect Bounding this failure requires three concrete guardrails, each addressing one validity condition: 1. **Attribute-completeness precheck at mint time (V1).** When `B` mints `C`, it must walk the chain's predicates, collect the union of referenced `caller.*` attributes, and verify the ephemeral identity service projects all of them. If any are unprojectable, minting fails closed with `DelegationIncomplete` rather than producing a credential that will fail opaquely at the verifier. 2. **Retry-identity pinning (V2).** The delegation layer must tag each outbound request with the presenting credential's chain position and reject any retry whose presenting position differs from the original. This is a hard block, not a warning — the `B`-substitutes-for-`C` move must be impossible, not merely discouraged. 3. **Distinguishable denial taxonomy (V3).** Verifiers must return `AttributeUnresolved{attribute: ...}` distinctly from `ScopeDenied{predicate: ...}`, so the requesting instance can route to projection vs. fail-fast correctly. The net operational effect: the chain's narrowing invariant is enforced at the *execution* layer by making identity promotion structurally impossible and attribute gaps loud. Without these, the signature layer's guarantee is a comforting fiction — the chain verifies, the predicate "passes," and the action runs under the wrong identity with the wrong budget, invisibly. ```python from dataclasses import dataclass, field from typing import Optional class DelegationScopeError(RuntimeError): """Raised when a delegated AAIF credential cannot be safely evaluated or retried.""" pass @dataclass class ChainPosition: agent_id: str attributes: dict = field(default_factory=dict) @dataclass class Credential: chain: list # list[ChainPosition], root first, presenter last referenced_attributes: set # caller.* attributes any predicate in chain reads @property def presenter(self) -> ChainPosition: return self.chain[-1] def precheck_mint(parent: Credential, child_attrs: dict, child_id: str) -> Credential: """V1: refuse to mint a child credential whose identity cannot satisfy every attribute referenced anywhere in the chain.""" missing = parent.referenced_attributes - set(child_attrs.keys()) if missing: raise DelegationScopeError( f"cannot mint {child_id}: ephemeral identity does not project " f"attributes {sorted(missing)}; predicate will fail opaquely at verifier" ) child = ChainPosition(agent_id=child_id, attributes=dict(child_attrs)) return Credential(chain=parent.chain + [child], referenced_attributes=set(parent.referenced_attributes)) def guarded_retry(original: Credential, denial_attr: Optional[str], retry_credential: Credential) -> Credential: """V2 + V3: only permit retry under the identical presenting identity, and only when the denial was attribute-incomplete, never scope-false.""" if denial_attr is not None: # (b) attribute-incomplete: projection is the fix, not retry. raise DelegationScopeError( f"denial was AttributeUnresolved({denial_attr}); project the attribute " f"onto the ephemeral identity; retry under a different identity is forbidden" ) if retry_credential.presenter.agent_id != original.presenter.agent_id: raise DelegationScopeError( f"identity promotion blocked: original presenter " f"{original.presenter.agent_id!r} vs retry presenter " f"{retry_credential.presenter.agent_id!r}; ancestor credential substitution " f"would discard leaf narrowing" ) return retry_credential def evaluate(predicate_attrs: set, presenter: ChainPosition, comparison_ok: bool) -> None: """V3: missing attributes are a distinct error, never coerced to false.""" unresolved = predicate_attrs - set(presenter.attributes.keys()) if unresolved: raise DelegationScopeError( f"AttributeUnresolved{sorted(unresolved)}: cannot coerce missing " f"attribute to comparison result" ) if not comparison_ok: raise DelegationScopeError("ScopeDenied: predicate false under full attributes") ```