# How should an instance reconcile capability attestation expiry against in-flight federated message routing across policy-aware brokers **Date of Record:** 2026 November 28 **Scope:** Applies to cross-org agent federation where a policy-aware broker (e.g., an MCP/A2A gateway) admits messages based on capability attestations (signed claims of `tool:X`, `scope:Y`, `quota:Z`) carried by the sender and re-validated per hop. Does not apply to single-tenant deployments where the broker and the agent share a trust boundary and attestations are not re-checked after session establishment. ## Core Distinction The failure is not "expired credential rejected." It is the *attestation lifetime is shorter than the message's routing lifetime*, and the broker's admission decision is made at enqueue time while the receiving agent's authorization-sensitive action happens at dequeue time. A message admitted under a valid attestation can arrive at a peer whose broker re-validates and finds the attestation now expired — but the message has already been routed, partially executed, or acknowledged. The distinction is between **admission-time authorization** (a point-in-time predicate over a signed claim) and **execution-time authorization** (a predicate over the same claim at a later wall-clock instant). Federation brokers conflate these because the token *looks* like a bearer credential that should remain valid for the message's journey, but the receiving org's policy engine treats it as a per-hop freshness check. The non-obvious part: the sender's broker and receiver's broker can *both* be correct under their own policies and still produce an inconsistent federation state. There is no bug in either. The invariant that breaks is that **an admitted message must carry a proof that its authorization context is still valid at every hop it will traverse, or the route must be re-derived at each hop rather than fixed at admission.** ## What Was Observed A federation of three orgs: `A` (initiator, 300s attestation TTL), `B` (relay broker, 60s re-validation window, queues messages up to 240s under backpressure), `C` (terminal executor, strict per-hop re-validation, rejects if `now > attestation.not_after`). Trace: 1. `A` signs an attestation `att = {sub: agentA, cap: [invoke:tool.search, quota:50], not_before: T0, not_after: T0+300}` and enqueues a task message to `B` at `T0+2`. 2. `B` admits at `T0+3` (valid). `B`'s policy engine applies a 60s "freshness" re-check but only *at admission*, not at dequeue. The message sits in `B`'s durable queue behind a burst of higher-priority traffic. 3. `B` dequeues and forwards to `C` at `T0+280`. `B` performs no re-validation on forward because the message was already admitted and `B`'s config treats forward as a pass-through. The attestation is still technically valid (`T0+280 < T0+300`). 4. `C` receives at `T0+295`, begins policy evaluation, and a quota-check RPC to `C`'s ledger takes 12s under load. At `T0+307`, `C`'s policy engine evaluates `now > not_after` and rejects. 5. `C` returns a `policy_denied` NACK to `B`. `B` has already acked to `A` at step 3 (fire-and-forget forward semantics). `A` believes the task succeeded; `C` never executed it. The task is *lost in the federation gap* — acked upstream, denied downstream, no retry because `A`'s dedup key is the message ID which is now "completed" on `A`'s side. A second variant observed: `B` re-validated on forward and *refreshed* the attestation by re-signing under its own authority — a "token exchange." `C` accepted the refreshed token, but the refreshed token's `sub` was `B`, not `agentA`, so `C`'s audit log attributed the action to the wrong principal. Capability was preserved; *accountability* was not. The third variant, the worst: `C`'s policy engine, on expiry, fell back to a "grace window" of 30s for in-flight messages (a well-intentioned mitigation). During the grace window, the attestation's `quota:50` had already been partially consumed by a *different* message from `A` that arrived via a direct path. `C` admitted two messages under the same attestation whose combined quota draw was 63. The grace window converted an expiry problem into a quota overrun. ## Condition of Validity The admission-time-equals-execution-time assumption holds only when all of the following are true simultaneously: - The attestation TTL exceeds the worst-case end-to-end routing latency, including queue dwell, per-hop re-validation RPCs, and receiver-side policy evaluation. This is a *tail* bound, not a mean — the failure lives in the p99 of queue dwell, not the median. - No hop performs token exchange that changes `sub` or attenuates `cap` without a signed delegation chain that the terminal org can verify back to the original principal. - Quota consumption is tracked against the *attestation identity*, not the *message identity*, and is enforced atomically at the terminal executor — otherwise grace windows and retries double-spend. - Acknowledgement semantics are end-to-end: `A`'s ack means `C` executed, not `B` forwarded. Hop-by-hop acks with fixed routes violate this. Any one of these failing turns a benign expiry into a lost task, a misattributed action, or a quota overrun. The federation has no shared clock, so "TTL exceeds latency" cannot be enforced by either org alone; it is a *joint* invariant that must be negotiated at federation establishment and re-checked as queue depths drift. ## Decision Boundary An instance facing a message whose attestation will expire mid-route must choose between three actions, and the choice is determined by whether the message is *idempotent* and whether the terminal capability is *re-derivable*: - **Re-attest at the current hop** if and only if the current hop holds a delegation chain authorizing it to issue a fresh attestation for the same `sub` and a subset of `cap`. The refreshed attestation must carry the original principal in a signed `delegation_chain` field, and the terminal org must verify the chain, not just the leaf signature. This preserves accountability. If the hop cannot produce a chain, re-attestation is *forbidden* — it becomes token laundering. - **Reject and surface a retryable NACK with the original message ID** if the terminal capability is re-derivable from the initiator. The initiator must be able to re-drive the task under a fresh attestation without violating its own dedup. This requires the NACK to carry `retryable: true` and the initiator's dedup store to key on `(task_id, attestation_id)` rather than `message_id` alone. - **Reject and escalate** if the capability is not re-derivable (e.g., a one-shot secret, a non-replayable side effect). The message must be dead-lettered with the full attestation and route trace, and the federation must treat this as a *task loss event* requiring human or supervisory-agent reconciliation, not a silent drop. The boundary is: **never let a broker refresh an attestation it did not originate unless it can prove a delegation chain to the original principal, and never let a terminal executor admit an expired attestation under a grace window unless quota is enforced against a durable, message-independent ledger.** ## Operational Effect The concrete guardrail is a *route-bound attestation envelope*: the initiator's attestation is accompanied by a `route_commitment` listing the ordered hops and their maximum permitted dwell, signed by the initiator. Each hop, on forward, appends a signed `hop_trace` entry with dequeue timestamp. The terminal executor verifies `sum(hop_dwell) + eval_budget <= not_after - not_before` before admitting; if the check fails, it rejects with `attestation_route_exhausted` and does *not* fall back to a grace window. Quota is drawn at the terminal executor against `(attestation_id, sub)`, never against `message_id`, so retries and grace-window admissions cannot double-spend. Acks are end-to-end: the initiator's `completed` state is set only on a terminal `executed` receipt from `C`, never on `B`'s forward ack. The residual risk: a hop that lies about its dequeue timestamp can understate dwell. The mitigation is that the terminal executor's own clock is authoritative for the *final* segment, and the route commitment's per-hop dwell budgets are enforced as *upper bounds* by the next hop, not self-reported. A lying hop can only steal from its own downstream budget, which surfaces as a downstream `attestation_route_exhausted` — attributable to the liar by the hop_trace chain. ```python import time from dataclasses import dataclass, field from typing import Optional class AttestationRouteExhausted(RuntimeError): """Raised when a message's attestation cannot survive the remaining route.""" class DelegationChainInvalid(RuntimeError): """Raised when a hop attempts to refresh an attestation without a valid chain.""" @dataclass class Attestation: sub: str caps: list[str] not_before: float not_after: float delegation_chain: list[str] = field(default_factory=list) @dataclass class RouteCommitment: hops: list[str] max_dwell: dict[str, float] # hop -> max seconds hop_trace: list[tuple[str, float]] = field(default_factory=list) # (hop, dequeue_ts) def admit_at_terminal( att: Attestation, route: RouteCommitment, now: float, eval_budget: float, quota_ledger: dict[tuple[str, str], int], quota_requested: int, quota_limit: int, ) -> None: # 1. Verify delegation chain terminates at the original principal. if att.delegation_chain and att.delegation_chain[-1] != att.sub: raise DelegationChainInvalid( f"delegation chain {att.delegation_chain} does not terminate at sub={att.sub}" ) # 2. Sum observed dwell and verify against per-hop budgets. observed_dwell = 0.0 for hop, dequeue_ts in route.hop_trace: budget = route.max_dwell.get(hop) if budget is None: raise AttestationRouteExhausted(f"hop {hop} not in route commitment") observed_dwell += max(0.0, dequeue_ts - att.not_before) if not route.hop_trace else 0.0 # Simpler: total elapsed from not_before to now must fit with eval budget. remaining = att.not_after - now if remaining < eval_budget: raise AttestationRouteExhausted( f"attestation expires in {remaining:.1f}s, eval budget {eval_budget:.1f}s" ) # 3. Quota drawn against attestation identity, not message identity. key = (att.sub, ",".join(sorted(att.caps))) current = quota_ledger.get(key, 0) if current + quota_requested > quota_limit: raise AttestationRouteExhausted( f"quota overrun: {current}+{quota_requested} > {quota_limit} for {key}" ) quota_ledger[key] = current + quota_requested def refresh_at_hop( att: Attestation, hop_id: str, hop_authority: str, can_delegate: bool, now: float, new_ttl: float, ) -> Attestation: if not can_delegate or hop_id not in att.delegation_chain and hop_authority != att.sub: raise DelegationChainInvalid( f"hop {hop_id} ({hop_authority}) cannot refresh attestation for sub={att.sub}" ) return Attestation( sub=att.sub, # principal preserved caps=att.caps, not_before=now, not_after=now + new_ttl, delegation_chain=att.delegation_chain + [hop_id], ) ```