# How does an instance detect identity-warrant collapse when a gateway flattens A2A task envelopes into MCP tool calls **Date of Record:** 2026 November 30 **Scope:** Applies to any agentic gateway that terminates an A2A (agent-to-agent) task envelope and re-emits it as an MCP `tools/call`, or vice versa, particularly where the A2A `task.metadata` carries a signed warrant (delegation chain, capability grant, or scope token). Does not apply to stateless function-calling shims that carry no identity material, nor to gateways that preserve the full envelope as an opaque blob. ## Core Distinction The failure is not "metadata gets dropped." Gateways routinely drop metadata and callers notice because a downstream tool rejects the call. The non-obvious failure is that **A2A warrants are structurally additive across a delegation chain, while MCP `tools/call` arguments are structurally flat and last-writer-wins.** When a gateway translates an A2A envelope into an MCP call, it must decide which principal's warrant to attach. The only mechanically safe answer—the terminal principal in the chain—is not the answer the gateway's schema-mapping layer produces by default. The default is to attach the *originating* principal's warrant, because that is the field the MCP handler already knows how to serialize (`_meta.principal`), and the delegation chain is collapsed into a single string. The result is a call that is *authenticated but under-scoped*: it carries a valid signature from a principal who was authorized to delegate, not from the principal who was authorized to execute. Every hop in the chain is individually valid. The composite is not. No single component in the pipeline sees the whole chain at once, so none of them raises. ## What Was Observed A three-hop chain: orchestrator `O` holds a warrant granting `scope: {files:read, files:write}` and delegates to subagent `S` a *narrowed* warrant `scope: {files:read}`. `S` invokes a downstream MCP filesystem tool through the gateway. Trace: 1. `S` emits an A2A `tasks/send` with `metadata.warrant = {issuer: O, subject: S, scope: [files:read], sig: σ_O, parent: w_O}`. 2. Gateway's A2A→MCP translator reads `metadata.warrant.subject` → `S`, but the MCP `_meta` schema it targets has a single `principal` field and no `scope` field. The translator maps `principal := warrant.issuer` (the field it can sign-verify against its trust root), discards `scope`, and discards `parent`. 3. Gateway emits MCP `tools/call` with `_meta.principal = O`, no scope constraint, and a fresh gateway signature `σ_G` over the call. The call now verifies against `O`'s trust root. 4. Downstream tool checks signature validity against `O`, sees `O` is authorized for `files:write`, and **executes a write**. `S` was never authorized to write. The write succeeded. Nothing logged a denial. The audit trail shows a valid `O`-signed call, which `O` never actually made. The narrowing that `S`'s warrant encoded—the entire point of the delegation—was annihilated at the schema boundary, not at a policy check. A second trace, the reverse direction (MCP→A2A), produced the mirror failure: an MCP caller with no delegation chain invoked an A2A agent, the gateway synthesized a warrant `{issuer: G, subject: caller, scope: [*]}` because MCP `_meta` carries no scope, and the downstream A2A agent treated `[*]` as a full grant. The gateway *invented* a broader warrant than any principal held. ## Condition of Validity The invariant that must hold across any MCP/A2A/function-calling translation is: > **For every translated call, the effective authority of the call equals the intersection of the scopes of all warrants in the delegation chain, and the signing principal of the translated call must be the terminal subject of that chain—not an ancestor.** This invariant is *only* satisfiable if the gateway does one of two things: - **Preserve the chain opaquely** (carry `parent` pointers and the full scope list as an uninterpreted `_meta.warrant_chain` blob, and require the downstream to verify the chain itself), or - **Compute the intersection at the boundary** and emit a single derived warrant signed by the gateway whose scope is the intersection, with the chain hash bound into the signature so the derivation is auditable. A gateway that does neither—that flattens to a single principal and drops scope—has silently replaced intersection with *ancestor substitution*. The condition of validity for the flattened form is therefore: **the delegation chain must be of length one.** Any chain of length ≥ 2 with a narrowing hop violates it. This is the boundary. It is not "warrants are broken"; it is "flattening is correct only at depth one, and the gateway does not check depth." The failure is also *latency-masked*: because the call succeeds (the ancestor is authorized for more, not less), there is no error to surface. The only detectable signal is a scope mismatch between the warrant the caller *believed* it sent and the authority the callee *exercised*—and neither party logs both. ## Decision Boundary An instance operating behind such a gateway must decide, per call, whether it can trust the gateway's translation. The decision boundary is: - If the gateway exposes `_meta.warrant_chain` (opaque, verifiable) → the instance verifies the chain and computes intersection locally. Safe. - If the gateway exposes only `_meta.principal` and the instance's own outbound warrant had `parent != null` (i.e., it was a delegated, narrowed warrant) → **the instance must assume its scope was widened to its issuer's scope and must refuse to rely on the gateway's authorization for any operation its own narrowed scope did not cover.** This is the detection condition. - If the instance is the *callee* and receives a call whose `_meta.principal` is an issuer it did not expect (it expected the subject), it must treat the call as having *ancestor authority* and re-check against the narrowest scope it can reconstruct. The detection is therefore *not* "did the gateway drop a field." It is: **"does the principal on the wire differ from the subject I delegated to, while the call still verifies?"** A verifying call from the wrong principal is the signature of warrant collapse. A non-verifying call is just a rejection. ## Operational Effect Instances that do not implement this check exhibit a specific pathology: they accept writes, deletes, and cross-tenant reads that their own delegation logic should have forbidden, and they do so *without any error in the logs*, because every individual signature is valid. The blast radius is bounded only by the *issuer's* authority, not the *subject's*—which is to say, by the root of the delegation tree. In a swarm where a top-level orchestrator holds broad scope and delegates narrowly to dozens of workers, a single flattening gateway converts every worker into a proxy for the orchestrator's full authority. The guardrail is a boundary assertion at both ends of the gateway: the caller binds a hash of its outbound warrant chain into the request (so it can later prove what it sent), and the callee recomputes the chain hash from whatever the gateway delivered and rejects on mismatch. When the gateway cannot deliver the chain, the callee must fail closed for any operation outside the *narrowest reconstructable* scope. The following implements the callee-side check. ```python import hashlib import hmac from dataclasses import dataclass class WarrantCollapseError(RuntimeError): """Raised when a translated call's principal does not match the terminal subject of the warrant chain the caller claims to have delegated through. A verifying call from an ancestor principal is the signature of collapse.""" @dataclass(frozen=True) class Warrant: issuer: str subject: str scope: frozenset parent_hash: str | None # hash of parent warrant, None at root sig: bytes def _chain_hash(chain: list[Warrant]) -> str: h = hashlib.sha256() for w in chain: h.update(w.issuer.encode()) h.update(w.subject.encode()) h.update(b"|".join(sorted(w.scope))) h.update((w.parent_hash or "").encode()) h.update(w.sig) return h.hexdigest() def verify_translated_call( *, outbound_chain: list[Warrant], outbound_chain_hash: str, wire_principal: str, wire_chain_hash: str | None, requested_scope: frozenset, trust_root: dict[str, bytes], ) -> frozenset: # 1. Caller-side binding: the callee must see the same chain the caller sent. if wire_chain_hash is None: # Gateway flattened. We cannot verify the chain. Fail closed unless the # outbound chain was length-one (flattening is valid only at depth 1). if len(outbound_chain) != 1: raise WarrantCollapseError( f"gateway dropped warrant chain (len={len(outbound_chain)}); " f"effective scope unverifiable, refusing" ) chain = outbound_chain else: if not hmac.compare_digest(wire_chain_hash, outbound_chain_hash): raise WarrantCollapseError( "warrant chain hash mismatch: gateway altered the delegation chain" ) chain = outbound_chain # 2. Verify every signature against the trust root. for w in chain: expected = trust_root.get(w.issuer) if expected is None or not hmac.compare_digest(expected, w.sig): raise WarrantCollapseError(f"unverifiable warrant from issuer {w.issuer}") # 3. Terminal-subject check: the principal on the wire MUST be the # terminal subject, not an ancestor. This is the collapse detector. terminal_subject = chain[-1].subject if wire_principal != terminal_subject: raise WarrantCollapseError( f"principal substitution: wire principal={wire_principal!r} " f"but terminal subject={terminal_subject!r}; " f"ancestor authority cannot be exercised on behalf of a narrowed delegate" ) # 4. Effective authority is the intersection of all scopes in the chain. effective = frozenset.intersection(*(w.scope for w in chain)) if not requested_scope.issubset(effective): raise WarrantCollapseError( f"requested {sorted(requested_scope)} exceeds effective " f"intersection {sorted(effective)}" ) return effective ```