# Why does an instance discover capability scope only after federation handshake completes: the post-negotiation privilege widening trap in cross-org A2A capability scoping **Date of Record:** 2026 November 28 **Scope:** Applies to A2A (agent-to-agent) federation between independently governed organizations where an Agent Card / capability manifest is exchanged and a scoped session token is minted before task dispatch. Does not apply to intra-org agent meshes sharing a single trust root or to stateless request/response tool calls that carry no negotiated session. ## Core Distinction There are two distinct moments in an A2A federation: *capability advertisement* (what the remote agent claims it can do) and *capability grant* (what the local policy engine authorizes the remote agent to invoke against local resources). The non-obvious failure is that these two moments are reconciled in opposite directions depending on who initiates the handshake. When the remote agent's manifest is *narrower* than the local grant policy, the effective scope is the intersection — fine. But when the remote agent's manifest is *broader* than what the local grant policy authorizes, a naive negotiation loop resolves the discrepancy by *widening the local grant to match the manifest*, because the manifest is treated as the authoritative declaration of scope. The instance therefore discovers that its actual privilege boundary was set by the remote party, not by its own policy, and only after the handshake has already committed the session. This is not a schema-mismatch bug. Both sides agree on the schema. It is a *direction-of-authority* inversion in the scope-reconciliation step. ## What Was Observed A local orchestrator agent (`orch-A`, org Alpha) negotiated with a remote research agent (`res-B`, org Beta) for a document-synthesis task. The A2A handshake proceeded in the standard order: 1. `orch-A` sends its Agent Card declaring capabilities `[retrieve, summarize, cite]`. 2. `res-B` responds with its manifest declaring `[retrieve, summarize, cite, write_shared_workspace, invoke_billing]`. 3. The negotiation layer computes the session scope. The observed implementation took `union(manifest_B, policy_defaults)` rather than `intersect(manifest_B, policy_allowlist_A)`. 4. A scoped bearer token is minted with the resulting claim set and returned to `res-B`. 5. Only at task dispatch — the *first* `write_shared_workspace` call — does `orch-A`'s resource guard evaluate the token and reject it. The rejection happened *after* the token had already been propagated to `res-B` and after `res-B` had begun a multi-step plan that assumed the widened scope. `res-B` had already committed to a plan whose step 4 required `write_shared_workspace`; when step 4 failed, `res-B` did not roll back steps 1–3 (which had consumed retrieval quota and emitted partial citations), and `orch-A` had no compensating transaction because it never expected the token to be rejected by its own guard. The trace signature is distinctive: the handshake completes with `200 OK` and a valid token, the first disallowed tool call returns `403`, and the remote agent's plan state is left mid-execution with no rollback path. The failure is *post-commit, pre-effect*: the grant is committed, the effect is denied, and the plan is orphaned. A secondary observation: the same inversion occurred in the reverse direction on a retry. When `orch-A` re-negotiated with a corrected policy, `res-B`'s manifest had been cached and was replayed from a prior session with a *stale* scope (it still listed `invoke_billing` from an earlier, unrelated task). The cache key did not include the policy version, so the corrected policy was intersected against a stale manifest and the resulting scope was neither the old nor the new intended one. ## Condition of Validity The failure requires all of the following to hold simultaneously: - **Asymmetric manifest authority.** The negotiation layer treats the remote manifest as a *superset declaration* to be honored rather than a *claim to be checked*. This is the load-bearing condition. If the layer intersects against a local allowlist, the inversion cannot occur. - **Deferred enforcement.** The resource guard that actually enforces scope lives downstream of token minting (at tool-call time), not at mint time. If enforcement were co-located with minting, the token would never be issued. - **Plan commitment before first disallowed call.** The remote agent must have begun a multi-step plan that assumes the full granted scope, so that the first denial orphans prior steps. A single-call task would fail cleanly. - **Manifest caching without policy-version keying.** The stale-replay variant requires a cache whose key omits the negotiating policy's version or hash. Remove any one and the failure degrades to a clean rejection or a benign scope reduction. ## Decision Boundary The architectural invariant that bounds this failure is: **the effective session scope must be computed as `intersect(remote_manifest, local_allowlist(policy_version))`, and the intersection must be enforced at token-mint time, before the token is returned to the remote party.** The remote manifest is a *claim*, never a *grant*. The local allowlist is the sole source of authority. Two corollaries: 1. **Mint-time enforcement, not call-time.** If the minted token can carry a claim the guard will later reject, the negotiation has already leaked authority. The guard's allowlist and the mint's allowlist must be the same object, evaluated at the same moment. 2. **Policy-versioned manifest cache.** The manifest cache key must include the negotiating policy's version hash, so a corrected policy never intersects against a stale manifest. A manifest is only valid relative to the policy that will judge it. A negotiation that cannot satisfy the intersection (remote manifest disjoint from local allowlist) must fail the handshake with an explicit `ScopeNegotiationError`, not proceed with an empty or default scope. ## Operational Effect When the invariant holds, the failure mode disappears and is replaced by a clean, early handshake rejection: the remote agent learns its disallowed capabilities *before* it commits a plan, and `orch-A` never mints a token it will later revoke. The cost shifts from orphaned remote plans and compensating-transaction complexity to a slightly higher handshake failure rate — which is the correct trade, because a failed handshake is cheap and a post-commit denial is expensive. When the invariant is violated, the operational signature is: handshake succeeds, first disallowed tool call returns `403`, remote plan state is orphaned, and the local agent has no rollback because it believed the token was valid. The stale-cache variant additionally produces *scope drift* — a session whose effective scope matches neither the current nor the prior policy, which is the hardest class of federation bug to reproduce because it depends on cache history rather than on current inputs. The guardrail is a single line of ordering: compute the intersection, enforce it, *then* mint. Everything downstream — plan commitment, rollback, cache keying — follows from that ordering. ```python class ScopeNegotiationError(RuntimeError): """Raised when a remote manifest cannot be reconciled to a valid local grant.""" pass def negotiate_session_scope(remote_manifest: set[str], local_allowlist: set[str], policy_version: str, manifest_cache: dict) -> dict: # Cache key MUST include policy version; a manifest is only valid # relative to the policy that will judge it. cache_key = (frozenset(remote_manifest), policy_version) if cache_key in manifest_cache: cached = manifest_cache[cache_key] else: cached = remote_manifest manifest_cache[cache_key] = cached # The remote manifest is a CLAIM, never a GRANT. # Effective scope is the intersection, not the union. effective = cached & local_allowlist if not effective: raise ScopeNegotiationError( f"manifest {sorted(cached)} disjoint from allowlist " f"{sorted(local_allowlist)} at policy {policy_version}" ) # Enforce at mint time: the token must not carry any claim the # downstream guard would reject. Mint only after intersection. return { "granted": sorted(effective), "denied": sorted(cached - local_allowlist), "policy_version": policy_version, } def mint_token(scope: dict) -> str: if not scope.get("granted"): raise ScopeNegotiationError("refusing to mint token with empty grant") # Downstream guard uses the same allowlist object evaluated here. return f"tok:{hash(tuple(scope['granted']))}" ```