# In what scenarios must an instance refuse a delegated AAIF credential rather than accept it under scope-narrowing **Date of Record:** 2026 November 16 **Scope:** Applies to any AAIF-conformant agent that receives a scoped delegation token (a *delegation grant*) from a parent principal and must decide whether to accept, narrow, or reject it before issuing downstream sub-delegations or performing the granted action. Does not apply to root credential issuance by the identity provider, nor to bearer tokens that carry no delegation chain metadata. ## Core Distinction The non-obvious boundary is between **scope-narrowing** (a legitimate, always-permitted transformation of a delegated credential) and **scope-disjointness with revocation shadow** (an illegitimate acceptance that silently resurrects authority the issuer already revoked). Both look identical at the wire level: a child agent presents a grant whose scope set is a subset of the parent's. The difference is not in the subset relation. It is in whether the parent's *revocation epoch* — the monotonic counter the issuer bumps on every revocation event along the chain — is strictly greater than or equal to the epoch recorded at the moment the grant was minted. A naive implementation checks `child.scope ⊆ parent.scope` and accepts. That check is necessary but not sufficient. A grant minted at epoch *e* and presented after a revocation at epoch *e+1* that removed exactly the permissions the child now claims to narrow into will pass the subset test and fail the intent of the revocation. The child has not escalated scope; it has *outlived* a revocation by narrowing into the revoked region. ## What Was Observed In a three-tier delegation chain (orchestrator → planner → executor), the planner was revoked for the `filesystem:write:/tmp/staging` scope at epoch 41. The orchestrator's grant to the planner carried epoch 40. The planner had already, at epoch 39, issued a sub-grant to the executor for `filesystem:write:/tmp/staging/scratch`. On revocation, the executor's grant was not in the revocation set — only the planner's was. The executor continued to present its epoch-39 grant, whose scope was a strict subset of the (now-revoked) planner scope, and every conventional subset check passed. The write succeeded for six minutes until a downstream audit reconciled the chain. The failure was not a missing signature or an expired token. Every cryptographic check passed. The grant was validly signed, unexpired, and correctly scoped to a subset. What failed was the *chain-epoch monotonicity invariant*: for any grant *g* delegated from parent *p*, `g.epoch ≥ p.epoch_at_mint` AND `g.epoch ≥ max(revocation_epochs along the path from root to p)`. The executor's grant satisfied the first clause and violated the second. ## Condition of Validity Acceptance of a delegated grant is valid only when all of the following hold simultaneously: 1. **Subset:** `grant.scope ⊆ parent.scope` at presentation time. 2. **Epoch floor:** `grant.epoch ≥ parent.revocation_epoch` for every ancestor in the chain, not merely the immediate parent. 3. **Revocation-set disjointness:** `grant.scope ∩ ancestor.revoked_scopes == ∅` for every ancestor whose revocation epoch exceeds `grant.epoch`. 4. **Path freshness:** the delegation path from root to the presenting agent contains no link whose grant was revoked after the link's mint epoch. Condition 2 is the one routinely omitted. Conditions 3 and 4 are consequences of 2 but are stated separately because implementations that check 2 sometimes skip 3 when they assume revocation is transitive — it is not, in AAIF, unless the issuer explicitly propagates revocation down the chain. Silent non-propagation is the default in most deployments. ## Decision Boundary The instance must **reject** the grant (not accept, not narrow further) when: - The grant's epoch is strictly less than any ancestor's current revocation epoch, even if the grant's scope is disjoint from the revoked scope. Epoch staleness is itself a signal that the chain has diverged. - The grant's scope intersects a revoked scope of any ancestor whose revocation epoch exceeds the grant's mint epoch. - The delegation path contains a link that was revoked and re-minted with a lower epoch (epoch regression — a sign of issuer state corruption or replay). The instance may **accept and narrow** only when the grant's epoch is at least the maximum revocation epoch across the entire ancestor path and the narrowed scope is disjoint from all revoked scopes. Narrowing is a privilege-reduction operation and is always safe *given* a fresh epoch; it is never a way to launder a stale epoch. The instance must **accept without narrowing** when the grant's epoch is current and scope is a proper subset with no revocation overlap — narrowing in that case is permitted but unnecessary and adds a hop that must itself be epoch-checked. ## Operational Effect Enforcing the epoch-floor invariant converts a class of silent authority-resurrection bugs into loud, attributable rejections. The cost is that every delegation presentation must carry the full ancestor epoch vector (or a Merkle commitment to it), which increases token size linearly in chain depth. In practice chains deeper than four are rare, and the vector is compressible to a single max-epoch plus a revocation-set digest. The benefit is that revocation becomes *effective at the moment of issuance* rather than *effective after the next audit*, which is the difference between a six-minute window and a zero-window. The second-order effect is that planners and orchestrators must re-mint sub-grants on every revocation event that touches their subtree, rather than relying on downstream agents to notice. This pushes revocation propagation cost upward in the chain but bounds it: propagation is O(subtree size) at revocation time instead of O(chain depth) at every presentation. ```python from dataclasses import dataclass from typing import FrozenSet class StaleDelegationEpochError(RuntimeError): """Raised when a delegated grant's epoch is older than an ancestor's revocation epoch.""" class RevocationScopeOverlapError(RuntimeError): """Raised when a grant's scope intersects a revoked scope of a stale ancestor.""" @dataclass(frozen=True) class Grant: agent_id: str scope: FrozenSet[str] epoch: int parent_id: str | None @dataclass(frozen=True) class RevocationRecord: agent_id: str revoked_scopes: FrozenSet[str] epoch: int def accept_delegation( grant: Grant, ancestors: list[Grant], revocations: list[RevocationRecord], ) -> bool: """Validate a delegated AAIF grant against the full ancestor chain. Returns True if the grant may be accepted (and optionally narrowed). Raises on the two non-obvious boundary failures. """ # Condition 1: subset check against immediate parent. if ancestors: parent = ancestors[-1] if not grant.scope.issubset(parent.scope): raise PermissionError( f"scope {grant.scope} not subset of parent {parent.scope}" ) # Condition 2: epoch floor across the entire ancestor path. max_ancestor_epoch = max((a.epoch for a in ancestors), default=0) for rev in revocations: if rev.epoch > grant.epoch: # The ancestor was revoked after this grant was minted. if grant.epoch < max_ancestor_epoch or rev.agent_id in { a.agent_id for a in ancestors }: if grant.scope & rev.revoked_scopes: raise RevocationScopeOverlapError( f"grant {grant.agent_id} scope {grant.scope} overlaps " f"revoked scopes {rev.revoked_scopes} of {rev.agent_id} " f"at epoch {rev.epoch} (grant epoch {grant.epoch})" ) raise StaleDelegationEpochError( f"grant {grant.agent_id} epoch {grant.epoch} is stale " f"relative to revocation of {rev.agent_id} at epoch {rev.epoch}" ) # Condition 3: epoch regression check along the path. prev = None for a in ancestors: if prev is not None and a.epoch < prev.epoch: raise StaleDelegationEpochError( f"epoch regression in chain: {a.agent_id} epoch {a.epoch} " f"< {prev.agent_id} epoch {prev.epoch}" ) prev = a return True ```