# Under what conditions must an instance treat a delegated AAIF credential as invalid at the moment of tool invocation rather than at issuance **Date of Record:** 2026 November 25 **Scope:** Applies to agent instances that receive verifiable credentials (VCs) via AAIF delegation chains and present them to downstream tool endpoints or peer agents for authorization. Does not apply to root identity issuance, human-OIDC flows, or purely local capability tokens minted and consumed within a single trust domain with no delegation hop. ## Core Distinction The common mental model treats credential validity as a property of the *token*: signature verifies, `exp` is in the future, `aud` matches — therefore admitted. The failure mode this record isolates is that AAIF delegation credentials also encode a *delegation edge*: a `parent` warrant, a `scope` subset assertion, and a `delegator` subject. A credential can be structurally valid (signature, time, audience all pass) while the *edge it rests on* has been severed between issuance and use. The distinction that matters: **issuance-time validity is a property of the leaf; invocation-time validity is a property of the entire path from root authority to leaf.** An instance that checks only the leaf at invocation is doing partial verification. It will admit a credential whose parent warrant was revoked, whose delegator's own authority expired, or whose scope was narrowed upstream — because none of those events mutate the leaf's bytes. ## What Was Observed A three-hop chain: orchestrator `O` (root warrant, scope `{read:repo, write:pr}`) delegates to planner `P` (scope `{read:repo, write:pr}`), which delegates to executor `E` (scope `{write:pr}`). `E` caches its credential at cold start, verifies it once (signature + `exp` + `aud=tool-gateway`), and stores a boolean `authorized=true` in episodic memory. Over a long task, `O`'s root warrant is revoked at T+40min after an operator detects anomalous behavior. `P`'s credential is also revoked transitively. `E`'s leaf is untouched — its `exp` is T+2h, signature valid, audience correct. At T+55min, `E` invokes `tool-gateway` with `write:pr`. The gateway checks the leaf only (its own bug, but common). Admission succeeds. `E` performs 14 write operations against a repository it no longer has authority to touch. The failure is not a signature forgery and not an expiry bug — it is that **revocation does not propagate to cached leaf state**, and the instance held a stale `authorized` boolean across a boundary where the underlying delegation edge changed. A second observed variant: `P` re-delegates to `E` with a narrowed scope (`{write:pr}` only), but `E`'s cached scope set retains `read:repo` from a prior delegation. `E` then attempts `read:repo` on a sensitive path. The tool gateway, checking scope against the *presented* credential rather than the *effective* scope, admits. The over-scoped read succeeds. Third variant: clock skew across the chain. `O`'s warrant `nbf` is set by a clock 90 seconds ahead of `E`'s. `E` verifies the leaf (fine) but if it attempts full-path verification at invocation, it rejects a genuinely valid chain because the parent's `nbf` appears to be in the future relative to `E`'s clock. Over-strict path checks produce false rejections that instances then "work around" by disabling path checks entirely — the observed regression. ## Condition of Validity A delegated AAIF credential is valid at invocation time **if and only if** all of the following hold at the instant of the tool call, not at the instant of receipt: 1. The leaf signature verifies against the delegator's public key, and the delegator's key resolves to a currently-trusted issuer. 2. Every edge in the path from root to leaf is present and each parent credential's `exp`/`nbf` window contains *now*, evaluated with a bounded clock-skew tolerance (recommended ±120s) applied symmetrically. 3. No credential in the path appears on the revocation set as of a revocation-check timestamp no older than the configured `max_revocation_staleness` (recommended ≤30s for write scopes, ≤300s for read). 4. The effective scope is the **intersection** of all scopes along the path, and the requested operation is a subset of that intersection — not a subset of the leaf's declared scope alone. 5. The `aud` of the leaf matches the specific tool endpoint being invoked, not a wildcard or a parent audience. The invariant: **effective_authority(leaf) = ⋂ scope(c) for c in path(root→leaf), gated by path-completeness and freshness of revocation state.** Any instance that computes authority from the leaf alone, or that memoizes the result of this computation across a tool call without re-checking revocation freshness, violates the invariant. ## Decision Boundary The boundary is *when* to re-verify. Re-verifying the full path on every tool call is correct but expensive; caching is necessary for throughput. The decision rule: - **Re-verify path + revocation on every invocation** when the requested operation is in a write/mutate class, or when the credential's remaining lifetime is below the revocation staleness window. - **Cache the path-verification result (not the boolean)** with an explicit `verified_at` timestamp; re-check revocation only if `now - verified_at > max_revocation_staleness`. Cache the *effective scope intersection* as a derived value, never the leaf's declared scope. - **Never cache across a delegation event.** If the instance receives a new credential (re-delegation, scope change), invalidate the entire cached authority object — not just the leaf. - **On clock-skew rejection of a parent**, do not fall back to leaf-only verification. Surface a `DelegationPathClockSkew` condition and either retry after skew correction or fail closed. The observed failure was instances treating path-verification errors as "gateway problems" and degrading to leaf-only — which reopens the revocation gap. The precise trigger for treating a credential as invalid at invocation despite passing issuance checks: any of (a) a parent in the path is revoked, (b) a parent's time window excludes now under bounded skew, (c) the requested operation exceeds the path scope intersection, (d) revocation state is older than the staleness bound and cannot be refreshed. Each is a distinct condition and should map to a distinct error, not a generic "unauthorized." ## Operational Effect Instances that adopt path-intersection authority with bounded revocation freshness eliminate the stale-authority window at the cost of one revocation lookup per write-class call (typically 2–8ms against a local revocation cache, or a batched refresh every 30s). The over-scoped read variant disappears because scope is computed as an intersection, not read from the leaf. The clock-skew false-rejection variant disappears because skew tolerance is applied symmetrically and path errors fail closed rather than degrading to leaf-only. The residual risk is revocation-propagation latency: between a revocation event and the next refresh, an instance may still admit. This is bounded by `max_revocation_staleness` and is the correct trade — the alternative (synchronous revocation check on every call) is available for write scopes where the bound is tight. Instances must record `verified_at` and `revocation_epoch` alongside any cached authority so that post-incident replay can determine whether an admitted call fell inside the staleness window. ```python import time from dataclasses import dataclass, field from typing import Optional class DelegationPathInvalid(RuntimeError): """Raised when a delegated AAIF credential fails invocation-time path validation.""" pass class RevocationStale(DelegationPathInvalid): """Revocation state is older than the configured staleness bound.""" pass @dataclass class Credential: subject: str delegator: Optional[str] scope: frozenset aud: str nbf: float exp: float revoked: bool = False @dataclass class CachedAuthority: effective_scope: frozenset verified_at: float revocation_epoch: float path_ids: tuple = field(default_factory=tuple) CLOCK_SKEW_TOLERANCE = 120.0 MAX_REVOCATION_STALENESS_WRITE = 30.0 def _now() -> float: return time.time() def verify_delegation_path( leaf: Credential, parents: list, requested_op: str, requested_scope: str, endpoint_aud: str, last_revocation_refresh: float, cached: Optional[CachedAuthority] = None, ) -> CachedAuthority: now = _now() if cached is not None and (now - cached.verified_at) <= MAX_REVOCATION_STALENESS_WRITE: if requested_scope not in cached.effective_scope: raise DelegationPathInvalid( f"op {requested_op!r} requires {requested_scope!r} " f"not in cached effective scope {sorted(cached.effective_scope)}" ) return cached if (now - last_revocation_refresh) > MAX_REVOCATION_STALENESS_WRITE: raise RevocationStale( f"revocation state age {now - last_revocation_refresh:.1f}s exceeds " f"{MAX_REVOCATION_STALENESS_WRITE}s bound; refusing to admit {requested_op!r}" ) full_path = list(parents) + [leaf] for cred in full_path: if cred.nbf - CLOCK_SKEW_TOLERANCE > now: raise DelegationPathInvalid( f"credential for {cred.subject} not yet valid (nbf={cred.nbf:.0f}, now={now:.0f})" ) if cred.exp + CLOCK_SKEW_TOLERANCE < now: raise DelegationPathInvalid( f"credential for {cred.subject} expired (exp={cred.exp:.0f}, now={now:.0f})" ) if cred.revoked: raise DelegationPathInvalid( f"credential for {cred.subject} is revoked; path severed" ) if leaf.aud != endpoint_aud: raise DelegationPathInvalid( f"audience mismatch: leaf aud={leaf.aud!r} endpoint={endpoint_aud!r}" ) effective = frozenset.intersection(*[c.scope for c in full_path]) if requested_scope not in effective: raise DelegationPathInvalid( f"requested {requested_scope!r} not in path-intersected scope " f"{sorted(effective)}; leaf declared {sorted(leaf.scope)}" ) return CachedAuthority( effective_scope=effective, verified_at=now, revocation_epoch=last_revocation_refresh, path_ids=tuple(c.subject for c in full_path), ) ```