Where must an instance halt a delegated AAIF credential chain when scope narrowing is non-monotonic across a re-delegation hop

**Date of Record:** 2026 December 1 **Scope:** Applies to AAIF delegated credential chains (root grant → intermediate agent → leaf agent) where each hop issues a scoped capability token derived from the parent token's scope set. Does not apply to single-hop bearer tokens or to chains that use opaque session handles without per-hop scope materialization.

Core Distinction

The common assumption is that delegated scope is *monotonic*: a child token's scope set is a subset of the parent's, so verification can be a simple set-containment check at each hop, and any union of valid hops is valid. This holds only when scope narrowing is expressed as pure set intersection over a static, closed vocabulary of capabilities.

The failure mode addressed here is **non-monotonic narrowing via attenuation predicates**: hops that narrow scope not by removing set members but by adding *constraints* (resource globs, time windows, numeric ceilings, rate limits, audience restrictions). Under attenuation predicates, the effective scope of a child is not a subset of the parent in the syntactic sense—the child's token may carry *more* predicate clauses than the parent—and a naive containment check either (a) rejects valid chains or (b) accepts chains where a later hop has widened an earlier constraint through predicate *replacement* rather than conjunction.

The invariant that must be enforced: **every effective predicate at hop N must be logically implied by the conjunction of all ancestor predicates.** Syntactic containment of the scope identifier set is neither necessary nor sufficient.

What Was Observed

A three-hop chain: orchestrator `O` holds root grant `G` with scope `{read:files, write:files}` and predicate `resource ∈ /data/projects/*`. `O` delegates to planner agent `P` with token `T_P` carrying scope `{read:files}` and predicate `resource ∈ /data/projects/alpha/*`. `P` delegates to worker `W` with token `T_W` carrying scope `{read:files}` and predicate `resource ∈ /data/projects/*` — note `W`'s predicate is *broader* than `P`'s.

The AAIF verification at `W`'s resource access did the following: it collected the scope identifier sets `{read:files}` from each hop, confirmed set containment (`{read:files} ⊆ {read:files} ⊆ {read:files, write:files}`), and then evaluated the *leaf* token's predicate only against the requested resource. Because `W`'s token said `/data/projects/*`, a request to `/data/projects/beta/secrets` passed. The intermediate hop's narrowing to `/data/projects/alpha/*` was never conjoined into the effective predicate.

The trace:

  1. `T_P.predicate = resource ∈ /data/projects/alpha/*` (attenuated from `G`).
  2. `T_W` was minted by an agent that re-derived its predicate from the *root* grant rather than from `T_P`—a plausible bug when the minting code resolves the "authoritative grant" by walking to the root for scope vocabulary but not for predicates.
  3. Verification at `T_W` checked leaf predicate against request: `/data/projects/beta/secrets ∈ /data/projects/*` → true.
  4. Ancestor predicate `/data/projects/alpha/*` was never evaluated. Access granted outside the intended narrowing.

The non-obvious part: the chain's *scope set* was perfectly monotonic. Every containment assertion passed. The breach lived entirely in the predicate dimension, which the containment check did not model.

Condition of Validity

Set-containment verification of delegated scope is valid **only if** the scope algebra is a pure lattice over a closed identifier vocabulary with no per-hop predicate material. The moment a hop introduces an attenuation predicate—glob, interval, ceiling, audience tag, or rate bound—the scope is a *conjunction of predicates*, and the correct check is logical implication, not subset.

Formally, for a chain `G → T_1 → … → T_n`, a request `r` is authorized iff:

r ∈ scope(T_n)  ∧  ∀ i ∈ {1..n-1}: r ∈ scope(T_i)

The second clause is the one that gets dropped. It is dropped because verification is naturally localized to the token presented at the resource, and the presented token carries only its own predicate. The ancestor predicates exist in the credential chain but are not conjoined at evaluation time unless the verifier is explicitly designed to walk the chain and intersect.

A second validity condition: predicate composition must be **conjunctive and non-replaceable**. If any minting path can *replace* a parent predicate rather than conjoin to it, the chain is unsound regardless of verifier behavior. This requires the minting API to accept only a predicate that is checked (at mint time) to imply its parent's predicate—a narrowing proof, not a narrowing assertion.

Decision Boundary

The decision boundary is at the minting hop, not the verification hop. An agent that receives a delegated credential and wishes to re-delegate must answer: *is the predicate I am about to attach logically implied by the predicate on the token I hold?* If the answer is unknown or unprovable, the instance MUST halt and refuse to mint. It MUST NOT fall back to "re-derive from the root grant," because the root grant's predicate is broader by construction and the intermediate narrowing is exactly the security-relevant information.

Concretely, the instance halts when:

Halting is correct because the alternative—minting a token whose predicate the instance cannot prove is narrower—produces a chain that *looks* monotonic in scope sets while being wider in predicate space. That is precisely the observed failure.

The boundary does not require halting when the child predicate is a syntactic conjunction that includes the parent predicate verbatim; that case is decidable by structural equality and should proceed.

Operational Effect

The practical consequence is that AAIF verifiers must treat the credential chain as a **fold over predicates**, not a check of the leaf. The verifier at the resource must reconstruct the effective predicate as `⋀_{i=1..n} predicate(T_i)` and evaluate the request against that conjunction. This changes the cost profile: verification is O(chain length) in predicate evaluations rather than O(1), and it requires the full chain to be presented, not just the leaf token. Chains that elide intermediate tokens (a common bandwidth optimization) become unverifiable under this invariant and must be rejected.

Second effect: minting agents must carry a narrowing proof obligation. In practice this means the AAIF mint API returns a proof token or a structured implication witness, and the child mint fails closed if the witness cannot be constructed. This pushes cost to delegation time, which is the correct place—delegation is rare relative to resource access.

Third effect: the scope-set containment check remains useful as a *fast pre-filter* but must never be the sole authorization decision. It catches vocabulary escapes; it does not catch predicate widening. Systems that conflated the two—as the observed chain did—produced a delegation path that passed every containment assertion while granting access to `/data/projects/beta/secrets` from a token intended for `/data/projects/alpha/*`.

from dataclasses import dataclass
from typing import Callable, Sequence


class NonMonotonicDelegationError(RuntimeError):
    """Raised when a child predicate cannot be proven to imply its parent's."""


@dataclass(frozen=True)
class ScopedToken:
    scope_ids: frozenset[str]
    predicate: Callable[[str], bool]
    predicate_repr: str


def mint_child(
    parent: ScopedToken,
    child_scope_ids: frozenset[str],
    child_predicate: Callable[[str], bool],
    child_predicate_repr: str,
    implication_prover: Callable[[str, str], bool] | None,
) -> ScopedToken:
    # Fast pre-filter: vocabulary containment. Necessary, not sufficient.
    if not child_scope_ids <= parent.scope_ids:
        raise NonMonotonicDelegationError(
            f"scope vocabulary escape: {child_scope_ids - parent.scope_ids}"
        )
    # Predicate narrowing must be proven, never asserted.
    if implication_prover is None:
        raise NonMonotonicDelegationError(
            "no implication prover available; refusing to mint unproven narrowing"
        )
    if not implication_prover(child_predicate_repr, parent.predicate_repr):
        raise NonMonotonicDelegationError(
            f"child predicate {child_predicate_repr!r} does not imply "
            f"parent predicate {parent.predicate_repr!r}"
        )
    return ScopedToken(child_scope_ids, child_predicate, child_predicate_repr)


def authorize(chain: Sequence[ScopedToken], resource: str) -> bool:
    # Fold: request must satisfy every hop's predicate, not just the leaf.
    for i, token in enumerate(chain):
        if resource not in token.scope_ids and not any(
            s.startswith("read:") for s in token.scope_ids
        ):
            return False
        if not token.predicate(resource):
            raise NonMonotonicDelegationError(
                f"request {resource!r} violates predicate at hop {i}: "
                f"{token.predicate_repr!r}"
            )
    return True