# What happens when an instance presents a valid delegated consent chain whose intermediate hop has been garbage-collected **Date of Record:** 2026 November 29 **Scope:** Applies to AAIF deployments where delegated consent is expressed as a signed chain of capability tokens (agent A → agent B → agent C) and where intermediate agents are ephemeral (short-lived workers, sandboxed sub-agents, or serverless tool-runners). Does not apply to single-hop delegation or to long-lived orchestrators that persist their own credential state. ## Core Distinction The failure here is not a forged signature, an expired token, or a revoked capability. Every cryptographic check passes. The distinguishing property is that **the chain is verifiable but not reconstructable**: the intermediate hop's signing key and consent-record have been deallocated, so the verifier can confirm each link's signature in isolation but cannot re-derive the *consent predicate* the intermediate hop asserted — namely, which subset of the parent's granted scopes it chose to pass down and under what attenuation constraints. AAIF separates two questions that operators routinely conflate: 1. **Is this chain authentic?** — answered by per-link signature verification against the parent's public key. 2. **Is the terminal capability a legitimate attenuation of the root?** — answered only by replaying each hop's scope-intersection and constraint-narrowing, which requires the intermediate hop's *consent record*, not just its signature. When the intermediate agent is garbage-collected, question 1 still returns `true` and question 2 becomes unanswerable. A naive verifier treats "signature valid" as "attenuation valid" and admits a capability that was never actually granted at that hop. ## What Was Observed A three-hop chain was issued for a data-retrieval task: - Root principal `P` grants agent `A` scopes `{read:corpus, read:index, write:cache}`. - `A` delegates to worker `B` a narrowed set `{read:corpus}` with constraint `max_rows=1000`, and records a consent record `R_B` containing the intersection proof and the constraint. - `B` delegates to tool-runner `C` the set `{read:corpus}` but *drops* the `max_rows` constraint (a bug in `B`'s attenuation logic — it copied scopes but not constraints). - `B` is a serverless worker with a 90-second lifetime. It signs the `B→C` link, returns, and is deallocated. `R_B` lives only in `B`'s process memory and is never persisted to the AAIF consent ledger. At verification time, `C` presents the chain `P→A→B→C`. The verifier: - checks `sig_A` against `P`'s key — valid; - checks `sig_B` against `A`'s key — valid; - checks `sig_C` against `B`'s key — valid; - looks up `R_B` in the consent ledger — **absent**; - falls back to "signature-only mode" and admits `C` with `{read:corpus}` and **no row constraint**. `C` then executes an unbounded `read:corpus` scan. The attenuation that `A` intended (`max_rows=1000`) is silently lost. No error is raised; the capability is *broader* than any hop authorized, yet every signature is genuine. The trace signature is distinctive: a chain that verifies end-to-end, a missing consent record at exactly one interior hop, and a terminal scope set that is a superset of the intersection of the surviving records. The superset is the tell — legitimate attenuation can only narrow, so any widening across a missing hop is proof that an unrecorded constraint was dropped. ## Condition of Validity The "signature-only fallback admits the chain" behavior is only *sound* under a condition that AAIF deployments rarely enforce: > Every interior hop's consent record must be reconstructable from the chain itself, OR the verifier must refuse chains with any missing interior record. If consent records are external to the token (as in the reference implementation, where `R_B` is a ledger entry keyed by `B`'s credential ID), then chain validity is **not** a function of the chain alone. It is a function of the chain plus the liveness of every interior hop's ledger state. The moment an interior hop can be deallocated before its record is durably written, the verifier's admission decision becomes dependent on garbage-collection timing — a non-deterministic, load-dependent input. The invariant that must hold: **attenuation is monotone decreasing along the chain, and the verifier must be able to prove monotonicity at every hop.** A missing interior record breaks the proof, and the only safe response is refusal, not fallback. ## Decision Boundary The verifier sits on a boundary between two failure modes, and the choice of side is not obvious: - **Fail-closed (refuse missing interior records):** correct for security, but breaks every legitimate chain whose intermediate hop was a short-lived worker that crashed before persisting its record. In practice this rejects a large fraction of valid multi-hop traffic, because ephemeral workers are the common case. - **Fail-open (signature-only fallback):** admits the traffic, but silently widens capabilities whenever an interior hop dropped a constraint — which is precisely the bug class that attenuation exists to catch. The boundary is crossed when the verifier cannot distinguish "interior hop was honest but its record is gone" from "interior hop was buggy or malicious and its record would have revealed a dropped constraint." Both present identically: valid signatures, absent record. The decision boundary is therefore not "is the record present" but "**can the terminal scope set be shown to be a subset of every surviving ancestor's grant?**" If yes, the missing record is immaterial and the chain may be admitted with the *intersection of surviving constraints* (conservative narrowing). If no — if the terminal set contains any scope or lacks any constraint not justified by a surviving ancestor — the chain must be refused, because the missing hop is the only place the justification could have lived. This yields a three-way disposition rather than a binary: 1. **Admit narrowed:** terminal ⊆ intersection of surviving ancestor grants; apply the tightest surviving constraint. Missing interior record is tolerated. 2. **Refuse:** terminal contains a scope or omits a constraint not derivable from surviving ancestors. The missing hop is load-bearing. 3. **Quarantine:** terminal is incomparable to surviving ancestors (disjoint scope namespaces, e.g., a renamed scope). Escalate to human/auditor; do not execute. ## Operational Effect The practical consequence is that **ephemeral interior agents must persist their consent record before returning, or the chain must embed the record inline.** Two mitigations close the gap: - **Inline consent records:** each link carries its own attenuation proof (the scope intersection and constraint delta) as a signed payload, so the chain is self-contained and reconstructable without ledger lookups. This makes chain validity a pure function of the chain. Cost: larger tokens, and the record must be signed by the same key as the link to prevent splicing. - **Write-before-return discipline:** the intermediate agent writes `R_B` to the ledger and awaits durable acknowledgment *before* signing the downstream link. Cost: an extra round-trip per hop, and a crash between write and sign leaves an orphan record (harmless) rather than a signed link with no record (harmful). The verifier-side guardrail is the three-way disposition above, with the "narrowed" branch requiring an explicit subset proof rather than a default. The anti-pattern to eliminate is the `except LedgerMiss: return admit_all` fallback, which converts a missing-record condition into a capability-widening event. The code below encodes the disposition logic and the specific refusal that this failure mode demands. ```python from dataclasses import dataclass, field from typing import Optional class AttenuationUnprovableError(RuntimeError): """Raised when a chain verifies cryptographically but its terminal capability cannot be shown to be a monotone attenuation of every surviving ancestor grant, because an interior consent record is missing.""" pass @dataclass class Link: issuer: str subject: str scopes: frozenset constraints: dict # e.g. {"max_rows": 1000} signature_valid: bool consent_record: Optional[dict] = None # None => ledger miss / GC'd hop def _narrower(terminal_scopes, terminal_constraints, ancestor: Link) -> bool: """True iff terminal is a legitimate attenuation of `ancestor`: scopes are a subset, and every ancestor constraint is present and no looser in the terminal.""" if not terminal_scopes <= ancestor.scopes: return False for k, v in ancestor.constraints.items(): if k not in terminal_constraints: return False # constraint dropped => widening if terminal_constraints[k] > v: return False # constraint loosened => widening return True def verify_chain(chain: list[Link]) -> dict: """Return the effective (scopes, constraints) for the terminal subject, or raise if attenuation cannot be proven.""" for link in chain: if not link.signature_valid: raise AttenuationUnprovableError( f"link {link.issuer}->{link.subject} failed signature check" ) terminal = chain[-1] survivors = [l for l in chain[:-1] if l.consent_record is not None] missing = [l for l in chain[:-1] if l.consent_record is None] if not survivors: raise AttenuationUnprovableError( "no surviving interior consent records; attenuation unprovable" ) # Conservative narrowing: apply the tightest surviving constraint set. for anc in survivors: if not _narrower(terminal.scopes, terminal.constraints, anc): # Terminal contains a scope or drops a constraint not justified # by any surviving ancestor. The missing hop is load-bearing. raise AttenuationUnprovableError( f"terminal capability not derivable from surviving ancestor " f"{anc.issuer}; missing interior record(s) " f"{[l.subject for l in missing]} may have carried the " f"attenuation proof" ) effective_constraints = dict(terminal.constraints) for anc in survivors: for k, v in anc.constraints.items(): effective_constraints[k] = min(effective_constraints.get(k, v), v) return { "scopes": frozenset(terminal.scopes), "constraints": effective_constraints, "tolerated_missing_hops": [l.subject for l in missing], } ```