# What structural signals indicate a macaroon attenuation chain has crossed a federation boundary it cannot legally discharge **Date of Record:** 2026 November 24 **Scope:** Applies to delegated authorization between autonomous agents that carry macaroon-style attenuating bearer tokens (HMAC chained caveats) across trust domains owned by distinct issuers. Does not apply to single-issuer intra-federation delegation, nor to opaque OAuth tokens where the resource server can introspect the full grant. ## Core Distinction The failure mode is not signature forgery and not caveat tampering. It is **caveat-discharge asymmetry across a federation boundary**: a downstream agent receives a validly attenuated macaroon, can verify the HMAC chain end-to-end, and *believes* it holds authority—but a subset of its caveats are only satisfiable by a third-party verifier (a "discharger") that lives in a federation domain the receiving agent has no standing to contact, or whose discharge predicate the receiving agent cannot construct because it lacks the ground-truth state. Macaroons are designed so that attenuation is unilateral: any holder can append caveats and re-sign the tail without the root key. The invariant that breaks is the **implicit assumption that every caveat in the chain is dischargeable by some party reachable from the current execution context.** In a single trust domain this holds because the discharging service is co-located with the resource. Across a federation boundary, the caveat `account_balance >= 500` may be authored by a billing domain that the executing agent's identity is not authorized to query, and the macaroon carries no structural marker distinguishing "caveat I can discharge" from "caveat only the root issuer's federation peer can discharge." The distinction that matters operationally: a *rejected* token returns a clean 403 and the agent retries or escalates. An *undischargeable* token returns a valid signature, passes every local check the agent can run, and fails only at the moment of use—after the agent has already committed side effects under the belief it was authorized. ## What Was Observed A planner agent (domain `alpha`) delegated a scoped capability to a worker agent (domain `beta`) by attenuating a root macaroon with three caveats: ``` c1: agent_id = worker-7f3a c2: action in [read, transfer] c3: kyc_tier >= 2 # authored by alpha's compliance service c4: geo_region = "eu-west" # authored by alpha's edge ``` The worker verified the HMAC chain successfully—attenuation is just a chained HMAC over the previous signature and the caveat bytes, so `beta` could validate the chain without any alpha-side key. The worker then attempted to discharge `c3` by calling `compliance.alpha.internal/kyc/worker-7f3a`. The call returned a valid response, but the response was signed for a *different* audience: alpha's compliance service issues discharge macaroons bound to `audience=alpha-internal`, and `beta`'s discharge macaroon—constructed with its own key—did not match the audience binding the resource server expected. The resource server (in `gamma`, a third domain) accepted the root chain, accepted the discharge, and then rejected at the final binding check with a generic `caveat_discharge_invalid`. From the worker's perspective, the token was structurally valid and the discharge was structurally valid; the failure was a **binding-level mismatch that only manifests at the terminal verifier**, three hops from where the agent could have detected it. The diagnostic signal that appeared in logs—and the reason this is worth recording—was not an auth error. It was a **latency cliff**: the worker's tool call to `gamma` took 4.2s (discharge round-trips to alpha, audience mismatch, retry with re-signed discharge, second mismatch, timeout at 5s) versus a healthy 80ms. The agent's retry loop interpreted the timeout as transient and re-issued the transfer three times, each time re-attenuating a fresh macaroon from the planner. The planner, seeing repeated failures, began attenuating *more narrowly* (dropping `c4`, tightening `c2`) which did not help because the failure was in `c3`'s discharge binding, not in the caveat set. The structural signals, in order of arrival: 1. **Chain verifies, discharge verifies, terminal binding fails.** Three distinct verification stages, only the last fails, and the error is generic. 2. **Discharge latency exceeds the healthy path by 50x** and clusters at the client timeout boundary. 3. **Retry amplifies attenuation without changing the failing caveat.** The agent's recovery heuristic (narrow scope) is orthogonal to the actual defect (audience binding). 4. **The failing caveat's author domain is not in the receiving agent's federation allow-list**, but the caveat text gives no indication of this—it is a plain predicate string. ## Condition of Validity The guardrail below is valid only under these conditions, and must not be applied outside them: - The macaroon uses third-party caveats (encrypted caveat keys) for cross-domain predicates. First-party caveats are locally checkable and cannot exhibit this failure. - The receiving agent can verify the HMAC chain but **cannot** introspect the root issuer's discharge policy—i.e., the federation boundary is real, not nominal. - The terminal resource server enforces audience binding on discharge macaroons. If it does not, the failure degrades to a silent authorization widening (worse, but a different record). If any of these do not hold, the correct guardrail is a different one: for first-party-only macaroons, the invariant is trivial; for non-audience-bound discharge, the invariant is "discharge is transferable" and the failure mode is privilege escalation, not discharge asymmetry. ## Decision Boundary The operational decision an agent must make at the boundary is: **given a macaroon whose chain verifies but whose discharge binding may not match the terminal verifier, do I commit side effects before or after terminal verification?** The boundary is drawn at the **first third-party caveat whose author domain is outside the current agent's federation allow-list.** Before that point, local verification is sufficient to authorize local actions. After that point, the agent must not commit any side effect that is not reversible, because the discharge may be structurally valid but binding-invalid at the terminal verifier, and the failure will not surface until the terminal call. Concretely: an agent may *plan* under such a token, may *read* under such a token if reads are idempotent, but may not *transfer*, *write*, or *emit an external event* until it has performed a **dry-run discharge** against the terminal verifier—a zero-side-effect call that forces the binding check to execute. If the dry-run returns `caveat_discharge_invalid`, the agent must escalate to the root issuer, not re-attenuate. The anti-pattern to forbid: treating terminal binding failure as a transient error and retrying with re-attenuation. Re-attenuation cannot fix a binding mismatch; it only changes the caveat set, and the failing caveat (with its author-domain binding) remains. ## Operational Effect When the guardrail is applied, the observable behavior changes in three ways: - **Latency profile flattens.** The dry-run discharge adds one round-trip (~80-120ms) on the healthy path but eliminates the 4.2s timeout cliff on the failure path. Net p99 improves because the cliff is removed. - **Retry amplification stops.** The agent's retry budget is consumed by the dry-run, which returns a deterministic `caveat_discharge_invalid` rather than a timeout. The agent escalates instead of re-attenuating. - **The failing caveat becomes identifiable.** The dry-run response includes the caveat index and author domain, which the agent logs as a structured signal: `undischargeable_caveat: {index: 2, author: alpha.compliance, reason: audience_binding_mismatch}`. The invariant the guardrail enforces: **a macaroon is not authorized for side-effecting action until every third-party caveat has been discharged against the terminal verifier, not merely against a reachable discharger.** Discharge against a reachable discharger is necessary but not sufficient; the terminal verifier's audience binding is the binding that counts. An agent that skips this and commits side effects under a chain that verifies but does not discharge at the terminal will, on the failure path, have executed a transfer that the resource server rejects—leaving the agent's own state (its belief that the transfer succeeded) diverged from the resource server's state (the transfer was never applied). This divergence is the concrete harm: not a security breach, but a **state-continuity break** where the agent's episodic memory records a success that the authoritative system does not. ```python class UndischargeableCaveatError(RuntimeError): """Raised when a macaroon caveat cannot be discharged at the terminal verifier. Distinct from a signature failure (which is caught earlier) and from a transient network failure (which is retryable). This error means the caveat is structurally valid but binding-invalid at the terminal verifier, and no amount of re-attenuation will fix it. """ def __init__(self, caveat_index: int, author_domain: str, reason: str): self.caveat_index = caveat_index self.author_domain = author_domain self.reason = reason super().__init__( f"caveat[{caveat_index}] authored by {author_domain} " f"cannot be discharged at terminal verifier: {reason}" ) def verify_before_side_effect( macaroon, terminal_verifier, federation_allow_list: set[str], ) -> None: """Enforce the discharge-asymmetry invariant before committing side effects. Walks the caveat chain. For each third-party caveat whose author domain is outside the allow-list, performs a dry-run discharge against the terminal verifier. Raises UndischargeableCaveatError on binding mismatch. Must be called before any non-idempotent action (transfer, write, emit). """ for idx, caveat in enumerate(macaroon.third_party_caveats): if caveat.author_domain in federation_allow_list: # Reachable discharger; local discharge is sufficient. continue # Unreachable-by-standing: must discharge at the terminal verifier. result = terminal_verifier.dry_run_discharge(macaroon, caveat) if result.status == "audience_binding_mismatch": # Do NOT re-attenuate. Escalate to root issuer. raise UndischargeableCaveatError( caveat_index=idx, author_domain=caveat.author_domain, reason=result.status, ) if result.status != "ok": raise UndischargeableCaveatError( caveat_index=idx, author_domain=caveat.author_domain, reason=f"unexpected_discharge_status:{result.status}", ) # All third-party caveats discharged at terminal; side effects are safe. ```