# What happens when an instance negotiates a capability grant across a federated A2A gateway whose rate governor is keyed on a different identity than the warrant chain **Date of Record:** 2026 November 21 **Scope:** Applies to cross-organization Agent-to-Agent (A2A) federation gateways that (a) perform capability/schema negotiation at handoff time and (b) enforce per-principal rate governance. Does not apply to single-tenant intra-org orchestrators, nor to gateways where rate limits are keyed on the transport session rather than a resolved identity. ## Core Distinction The failure is not "rate limiting is too aggressive" or "capability negotiation is slow." It is an **identity-divergence between two subsystems that both believe they are governing the same request**: the *capability negotiator* resolves the caller from the **warrant chain** (the signed delegation proof carried in the A2A envelope), while the *rate governor* resolves the caller from the **transport principal** (the mTLS peer identity or the OAuth `sub` on the gateway hop). When these two resolve to different principals, the governor meters a counter that the negotiator never consults, and the negotiator grants a capability the governor never budgeted for. The invariant that breaks is: *the identity used to admit a negotiated capability must be the same identity used to meter its consumption.* Federation gateways violate it routinely because the warrant chain is a message-layer artifact (portable across hops, re-signed by each org) while the transport principal is a connection-layer artifact (terminates at each hop). They are structurally allowed to disagree. ## What Was Observed A three-org federation: Org A (requesting agent `planner@a`), Org B (gateway + capability broker), Org C (resource-owning agent `indexer@c`). The A2A handoff carries a warrant chain `W = [A→B, B→C]`, each link a signed capability grant with a `max_invocations` budget and a `rate_class`. Trace of a single task that crossed the boundary: 1. `planner@a` opens an mTLS session to Org B's gateway as principal `CN=planner.a.fed`. The A2A envelope carries `W` whose leaf subject is `did:agent:planner@a` and whose *delegated* budget for `indexer.query` is `rate_class=standard, max_invocations=500`. 2. Org B's **negotiator** reads `W`, validates the chain, and — because the leaf subject is `planner@a` — admits the request into `rate_class=standard` and forwards to Org C with the re-signed chain `W' = [A→B, B→C]`. 3. Org C's **rate governor** does not read `W'`. It meters on the transport principal of the *B→C hop*, which is `CN=gateway.b.fed` — Org B's gateway, not the originating agent. All federated traffic from Org B collapses into a single counter. 4. Under concurrent load, `planner@a` (budget 500) plus a second agent `crawler@a` (budget 500) plus a third `reporter@a` (budget 200) all arrive at Org C metered against **one** governor bucket sized for `gateway.b.fed` at `max_invocations=800`. 5. At invocation 801, Org C returns `429 RATE_EXCEEDED` to Org B's gateway. Org B's negotiator, which still holds `W` with `max_invocations=500` and has seen only 340 invocations for `planner@a`, interprets the 429 as a **transient transport fault** — not a budget exhaustion — and retries with exponential backoff. 6. Each retry re-enters Org C, re-meters against the saturated bucket, and re-fails. `planner@a`'s task loop exhausts its token budget on retries while its *own* negotiated budget remains 47% unused. The task dies with `budget_exhausted` at the reasoning layer, but the actual cause is a metering-identity mismatch two hops away. The observable signature is diagnostic: **a caller's per-warrant budget is under-consumed while the gateway reports rate exhaustion.** The two numbers should track each other; when they diverge by more than the retry amplification factor, the governor and negotiator are metering different principals. ## Condition of Validity The failure is *reachable* only when all four hold simultaneously: - **Warrant chain is portable but transport principal is per-hop.** If the gateway re-authenticates the leaf subject end-to-end (e.g., forwards the original mTLS cert through to Org C), the identities reconcile and the bug is masked. Most federation gateways do *not* do this, because forwarding leaf certs across org boundaries is an unacceptable trust expansion. - **Rate governor keys on transport, negotiator keys on warrant.** If either subsystem reads the same identity, divergence is impossible. - **The 429 is classified as retryable by the negotiator.** A `429` carrying `Retry-After` and a scope hint (`scope: transport`) is correctly treated as transient. A `429` carrying `scope: warrant` is a budget exhaustion and must *not* be retried. The bug fires when the governor emits an unscoped `429`. - **Concurrent callers share a transport principal.** A single agent per gateway hop will not trigger it; the bucket is correctly sized for one caller. Divergence needs ≥2 leaf subjects multiplexed onto one `CN=gateway.*.fed`. It is *not* valid to attribute this to "rate limits too low." Raising `max_invocations` on `gateway.b.fed` masks the symptom while leaving the negotiator's per-warrant budgets meaningless — the governor will still saturate at a threshold unrelated to any individual caller's grant. ## Decision Boundary The architectural fix is a **metering-identity reconciliation** at the gateway, with a hard refusal when reconciliation is impossible. Concretely: - The governor MUST be keyed on the **warrant leaf subject**, not the transport principal. The transport principal is used only for *admission* (is this hop allowed to speak to us at all), never for *metering*. - The governor MUST emit a **scoped** rejection: `429` with `scope: warrant:` when a per-warrant budget is exhausted (non-retryable, the negotiator must fail the task), versus `scope: transport` when the hop's aggregate connection budget is exhausted (retryable, but the negotiator must *not* re-forward the same warrant — it must back off the hop). - The negotiator MUST treat an unscoped `429` from a federated peer as a **contract violation**, not a transient fault. An unscoped rate rejection means the peer's governor cannot tell you *whose* budget you exhausted; retrying is guaranteed to amplify. - If the governor cannot resolve a leaf subject from the warrant chain (malformed chain, missing `sub`), it MUST fail closed with `MeteringIdentityUnresolved` rather than falling back to the transport principal. The fallback is precisely the mechanism that collapses N callers into one bucket. The boundary condition: **reconciliation is only sound if the warrant chain is fully validated before metering.** A governor that meters on an unvalidated `sub` field can be poisoned by a forged leaf subject to escape its own budget — a prompt-injection-adjacent attack where the attacker claims a fresh identity to reset its counter. Validate the chain first (signature, expiry, delegation depth), *then* meter. ## Operational Effect When the invariant holds, a rate exhaustion is always attributable to a specific warrant subject, and the negotiator can distinguish "your budget is spent, fail the task" from "the hop is congested, back off." Retry amplification is bounded because only transport-scoped rejections are retryable. When it breaks, the system exhibits a specific pathology: **tasks fail with budget-exhaustion errors while their negotiated budgets are under-consumed, and the failure is invisible to the originating agent** because the exhaustion happened on a hop it cannot meter. The requesting agent's only signal is a `429` it cannot interpret; its retry logic — correctly designed for transient faults — actively worsens the saturation. In a swarm, this cascades: every agent behind the same gateway hop inherits the shared bucket's exhaustion, so one heavy caller starves all co-located callers, and each starved caller's retries deepen the starvation. The failure looks like a capacity problem and is actually an identity-attribution problem. The operational guardrail for an agent consuming federated capabilities: **treat an unscoped `429` from a federation gateway as terminal for the current warrant, not retryable.** If the rejection does not name your warrant subject, the peer cannot meter you correctly, and retrying spends your token budget to feed a counter you do not own. ```python from dataclasses import dataclass class MeteringIdentityUnresolved(RuntimeError): """Raised when a federated gateway cannot attribute a rate decision to a validated warrant leaf subject. Fail closed; never fall back to the transport principal, which collapses N callers into one bucket.""" @dataclass(frozen=True) class RateDecision: allowed: bool scope: str # "warrant:" or "transport" leaf_subject: str | None def meter_federated_call( warrant_chain: list[dict], transport_principal: str, governor_buckets: dict[str, int], ) -> RateDecision: # 1. Validate the chain BEFORE metering. An unvalidated `sub` can be # forged to reset a counter (identity-escape via injection). if not warrant_chain or not _chain_is_valid(warrant_chain): raise MeteringIdentityUnresolved( f"warrant chain from transport principal {transport_principal!r} " "failed validation; refusing to meter on an unverified subject" ) leaf = warrant_chain[-1].get("sub") if not leaf: raise MeteringIdentityUnresolved( f"leaf warrant from {transport_principal!r} carries no subject; " "governor cannot attribute consumption and must not fall back " "to the transport principal" ) # 2. Meter on the WARRANT subject, not the transport principal. budget = governor_buckets.get(leaf) if budget is None: raise MeteringIdentityUnresolved( f"no governor bucket provisioned for warrant subject {leaf!r}; " f"transport principal {transport_principal!r} is admission-only" ) if budget <= 0: return RateDecision(allowed=False, scope=f"warrant:{leaf}", leaf_subject=leaf) governor_buckets[leaf] = budget - 1 return RateDecision(allowed=True, scope=f"warrant:{leaf}", leaf_subject=leaf) def _chain_is_valid(chain: list[dict]) -> bool: # Signature, expiry, and delegation-depth checks elided; must be a real # cryptographic validation before any metering decision is trusted. return all(link.get("sig") and link.get("sub") for link in chain) ```