# When must an instance refuse a delegated credential whose scope outlives its own lease **Date of Record:** 2026 November 22 **Scope:** Applies to AAIF-style delegated credential issuance where a parent agent mints a scoped capability token for a child instance under a time-bounded lease. Does not cover root-of-trust key rotation, hardware attestation, or human-issued OAuth grants, which have separate invariants. ## Core Distinction A delegated capability token carries two independent clocks: the **scope window** (the `not_after` on the token itself, plus any usage-count budget) and the **lease horizon** (the parent instance's own authorization to act, and the lifetime of the process holding the signing key). The AAIF spec requires that a delegated token's authority be bounded by the delegator's authority at issuance time. It does *not* require, and most implementations do not enforce, that the delegated token's validity interval be a subset of the delegator's *remaining* lease. This is the gap. The non-obvious failure is not "expired token accepted." It is that a child token whose `not_after` is later than the parent's lease expiry becomes an **orphaned capability**: still cryptographically valid, still verifiable against the issuer's public key, but issued by an authority that no longer exists to be revoked, audited, or held accountable. The signature verifies; the accountability chain does not. Verification succeeds against a principal that has been garbage-collected. ## What Was Observed A planning agent (P) held a 900-second lease to act on behalf of a user session. At t=120s it spawned a retrieval sub-agent (C) and issued it a capability token with `scope=read:corpus`, `not_after = now + 3600s` — a value copied from a template constant, not derived from P's lease. P's lease expired at t=900s and its signing key was zeroized. C continued running until t=3720s, issuing reads that the audit log attributed to a delegator identity whose lease record had been tombstoned 47 minutes earlier. The failure trace: 1. **Issuance:** `issue(child, scope, ttl=3600)` — the AAIF client library computed `not_after` from the requested TTL, never clamping to `min(now+ttl, parent.lease_expiry)`. No error raised. 2. **Verification at use time:** C presents the token. The verifier checks signature, `not_after > now`, and scope containment against the *requested* resource. All pass. The verifier does not query the delegator's lease state — it has no pointer to it, because the token's `delegator` field is a bare identity hash, not a lease reference. 3. **Revocation attempt:** at t=1000s an operator revokes P. The revocation list is keyed by P's identity and by P's *directly issued* token IDs. C's token ID was derived by C's issuance call and never registered in P's issued-token index, so the revocation sweep misses it. 4. **Post-mortem:** the audit trail shows a valid signature from a delegator that the system insists was never authorized to issue at that time. Forensics cannot distinguish a compromised child from a legitimate orphan. The distinguishing signature: **verification passes but accountability lookup returns null.** That is the observable that separates this from ordinary expiry bugs. ## Condition of Validity The invariant that must hold for delegated issuance to be sound: > For every delegated token T issued by delegator D, `T.not_after ≤ D.lease_expiry` at the instant of issuance, and T's revocation handle must be reachable from D's issued-token index. Two conditions make this enforceable: - **Lease-aware clamping.** The issuance path must read the delegator's *remaining* lease, not a configured default TTL. `effective_ttl = min(requested_ttl, lease_remaining - safety_margin)`. - **Revocation reachability.** The delegated token ID must be appended to the delegator's index atomically with issuance, so that revoking D transitively invalidates T. If the index write is not transactional with token minting, an orphan can be created by a crash between the two. The invariant fails silently when either the clamp is absent (the common case — libraries default to a static TTL) or the index write is best-effort. It also fails in a subtler way during **lease renewal**: if P renews its lease at t=800s, tokens issued under the old lease reference the old lease epoch and are not covered by the renewed lease's revocation scope. Renewal must either re-clamp outstanding child tokens or force re-issuance. ## Decision Boundary An instance must refuse to issue — not merely warn — when the requested scope window exceeds its own remaining lease, because a delegated token it cannot outlive is a token it cannot revoke. The boundary is asymmetric: - **Refuse** when `requested_ttl > lease_remaining`. Return a structured denial carrying `lease_remaining`, so the child can re-request with a valid horizon or the parent can escalate for a lease extension. - **Allow with clamp** when the child's scope is a strict subset and the clamped TTL still satisfies the child's declared minimum operating window; log the clamp. - **Refuse and escalate** when the child declares a minimum window longer than the parent's lease — this signals the delegation topology is wrong and the child should be issued from a longer-lived principal, not squeezed under a dying one. The anti-pattern to reject: issuing with a clamped TTL *and* silently letting the child operate past expiry because "the token verifies." Verification of signature is not verification of authority. ## Operational Effect Enforcing the clamp converts a silent orphan-capability leak into an explicit, auditable denial at issuance time. The observable consequences: - Orphaned capability count drops to zero by construction: no token can outlive the lease that authorized it, so revocation of the delegator is always transitively complete. - Audit attribution stays resolvable: every valid token maps to a live lease record at the time of use. - Failure surfaces move *earlier* — from a forensic anomaly at t+47min to a denial at t=120s, where the parent still has context to remediate. - The cost is added issuance latency (one lease-state read per mint) and a new failure mode: lease-state read unavailability must fail *closed*, refusing issuance rather than defaulting to a static TTL. A default-on-read-error reintroduces the exact bug. The invariant to encode in the issuance path is: *a delegated credential's authority is the intersection of its scope and its delegator's live lease, and the intersection must be non-empty at every instant the token is presented.* ```python import time from dataclasses import dataclass class DelegationScopeViolation(RuntimeError): """Raised when a delegated token would outlive its delegator's lease.""" pass @dataclass(frozen=True) class Lease: delegator_id: str expiry: float # monotonic seconds epoch: int @dataclass(frozen=True) class DelegatedToken: token_id: str delegator_id: str scope: str not_after: float lease_epoch: int SAFETY_MARGIN_S = 5.0 def issue_delegated_token( delegator_id: str, scope: str, requested_ttl_s: float, child_min_window_s: float, lease_lookup, token_id_factory, now: float | None = None, ) -> DelegatedToken: now = time.monotonic() if now is None else now # Fail closed: if lease state is unreadable, refuse to mint. try: lease: Lease = lease_lookup(delegator_id) except LookupError as exc: raise DelegationScopeViolation( f"cannot resolve lease for delegator {delegator_id!r}; refusing issuance" ) from exc lease_remaining = lease.expiry - now - SAFETY_MARGIN_S if lease_remaining <= 0: raise DelegationScopeViolation( f"delegator {delegator_id!r} lease already exhausted " f"(remaining={lease_remaining:.1f}s); no authority to delegate" ) # Child needs a window longer than the delegator can authorize: # topology is wrong, escalate rather than squeeze. if child_min_window_s > lease_remaining: raise DelegationScopeViolation( f"child requires {child_min_window_s:.1f}s but delegator " f"{delegator_id!r} can only authorize {lease_remaining:.1f}s; " f"re-issue from a longer-lived principal" ) effective_ttl = min(requested_ttl_s, lease_remaining) not_after = now + effective_ttl # Invariant guard: never mint a token that outlives the lease. if not_after > lease.expiry: raise DelegationScopeViolation( f"delegated token not_after={not_after:.1f} exceeds " f"lease expiry={lease.expiry:.1f} for {delegator_id!r}" ) return DelegatedToken( token_id=token_id_factory(), delegator_id=delegator_id, scope=scope, not_after=not_after, lease_epoch=lease.epoch, ) ```