# What happens when an instance negotiates capabilities across a policy gateway that silently downgrades its tool surface mid-session **Date of Record:** 2026 November 30 **Scope:** Applies to federated agent sessions where an initiating agent (org A) negotiates a capability manifest with a remote agent (org B) through a policy-enforcing gateway that may mutate, filter, or downgrade the advertised tool surface. Does not apply to single-org tool registries where the caller and callee share a policy domain and no gateway rewrites the manifest. ## Core Distinction The failure here is not "the remote tool was unavailable." It is a **capability-negotiation divergence**: the initiator holds a *cached belief* about the remote tool surface (the manifest it received at handshake), while the gateway holds the *enforced* surface (what policy actually permits at call time). These two views are allowed to differ by design—gateways exist precisely to filter. The bug surfaces when the divergence is **non-monotonic and unannounced**: the gateway accepts the handshake for a capability, then denies or degrades individual invocations because the *arguments* cross a policy boundary the schema never expressed. The dangerous invariant that agents assume—and that gateways violate—is: > *If a capability is present in the negotiated manifest, then any call whose arguments validate against the advertised JSON schema will execute with the advertised semantics.* That invariant is false whenever policy is **argument-dependent** (data-residency on a `region` field, PII redaction on a `query` field, rate/quota gating on a `tenant` field) rather than **capability-dependent**. The schema validates; the policy still denies. The agent's planner, having already committed to a multi-step plan that assumed the call succeeds, must now recover—and most planners recover by *retrying with mutated arguments*, which is exactly the wrong move. ## What Was Observed A federated procurement agent (org A, `planner-v4`) negotiated a manifest against org B's `supplier-lookup` agent through B's policy gateway. The manifest advertised: ``` supplier.lookup(query: str, region: enum["us","eu","apac"], include_pii: bool) -> SupplierRecord[] ``` The handshake succeeded. The gateway signed the manifest and returned it. The planner built a 6-step plan whose step 3 called `supplier.lookup(query="acme corp", region="eu", include_pii=true)`. At call time the gateway returned a structured denial: ``` {"error": "policy_denied", "reason": "pii_export_cross_border", "retryable": false} ``` Note what did **not** happen: the manifest was not amended, the capability was not removed, and no `capability_revoked` event fired. The gateway treated the denial as a *per-call* outcome, not a *surface change*. The planner—whose recovery policy was "on `retryable:false`, try an alternative argument binding before abandoning the step"—then attempted `include_pii=false`, which succeeded but returned records with `email` and `phone` fields **redacted to `null`**. The schema said `SupplierRecord` includes those fields. The planner's downstream step 4 (deduplication by email) silently collapsed all suppliers to one bucket because every email was `null`. The final output was wrong, but no error was ever raised. The trace, condensed: 1. `handshake` → manifest cached in working memory, advertised surface = 4 fields incl. PII. 2. `call(step3, include_pii=true)` → `policy_denied`, non-retryable. 3. Planner interprets denial as *argument* problem, not *surface* problem → rebinds `include_pii=false`. 4. `call(step3, include_pii=false)` → HTTP 200, schema-valid, but **semantics silently degraded** (PII nulled). 5. Planner's belief: "step 3 succeeded, records complete." Reality: records are a lossy projection. 6. Step 4 dedup on `email` → all-null collapse → single spurious supplier. 7. Final answer emitted with high confidence; no invariant check fired because every individual call was "valid." The root mechanism: **the gateway enforced policy at the value layer while the agent reasoned at the schema layer, and the schema had no way to express "field present but conditionally nulled."** The `null` was schema-valid for a nullable string, so no validator caught it. ## Condition of Validity The guardrail below is valid only under these conditions; outside them it over- or under-fires: - The remote manifest is **argument-conditional**: at least one capability's *output semantics* depend on input arguments that the gateway policy-checks. If policy is purely capability-level (tool allowed/denied wholesale), a simple `capability_revoked` event suffices and this analysis does not apply. - The gateway **does not re-emit the manifest on degradation**. If your federation protocol requires the gateway to push an amended manifest whenever an argument-dependent policy fires, the divergence window closes and the guardrail is redundant. - The agent's planner performs **argument rebinding on non-retryable denials**. If the planner aborts the whole plan on any denial, the failure mode is a clean stop, not a silent corruption—still a failure, but a loud one. When these hold, the correct invariant to enforce is a **provenance-and-completeness check on returned records**, not a retry policy. ## Decision Boundary The boundary is between two recovery strategies that look identical at the call site: - **Rebind-and-continue** is correct when the denial is *about the arguments* and the alternative binding preserves output semantics (e.g., `region="us"` vs `region="eu"` both return full records, just different partitions). - **Rebind-and-continue** is *incorrect* when the denial is *about a field's exportability* and the alternative binding **nulls or redacts that field**. The two cases are distinguished only by inspecting the *returned record shape against the negotiated schema's completeness guarantees*—which the schema does not encode. Operationally: treat any successful call that follows a `policy_denied` on the same capability as **suspect until field-completeness is verified against a non-degraded reference**. A practical test is to compare the returned record's non-null field count against the manifest's declared `required` + `populated_by_default` fields. If the count drops after a rebind, the call is a **degraded success**, and downstream steps that depend on the dropped fields must be invalidated. The hard rule: **a `policy_denied` on capability C poisons C's subsequent successes for the remainder of the plan unless the gateway explicitly certifies the alternative binding as semantically equivalent.** Absent that certification, a post-denial success is a lossy projection and must be flagged. ## Operational Effect The effect is **silent plan corruption with confident output**. Because every individual call returns schema-valid data and no error propagates, the agent's self-verification loop (which checks per-call validity, not cross-call completeness) passes. The failure is only detectable at the plan level, by tracking that a capability transitioned from `denied` to `success` with a changed field-population profile. The architectural guardrail is a **capability-state ledger** carried alongside the plan: for each capability, record whether it has been denied, and if so, mark all subsequent successes as `degraded=true` with the specific fields that dropped. Downstream steps declare their field dependencies; any step depending on a degraded field must either re-plan or emit a `partial_result` marker. This converts a silent corruption into a loud, bounded one—the agent still fails, but it fails at the step that needed the missing field rather than at the final answer. The second guardrail is handshake-level: **the gateway must advertise whether its policy is argument-conditional, and if so, which arguments trigger degradation and which output fields they affect.** A manifest that says `supplier.lookup` returns PII without noting that `include_pii=false` nulls it is not a manifest—it is a trap. Federation protocols that omit this are structurally unsafe for any planner that rebinds arguments. ```python from dataclasses import dataclass, field from typing import Optional class DegradedCapabilityError(RuntimeError): """Raised when a capability success is a lossy projection following a policy denial.""" pass @dataclass class CapabilityLedger: denied: set = field(default_factory=set) degraded_fields: dict = field(default_factory=dict) # cap -> set of nulled fields def record_denial(self, capability: str) -> None: self.denied.add(capability) def record_success(self, capability: str, returned_fields: set, expected_fields: set) -> None: if capability in self.denied: missing = expected_fields - returned_fields if missing: self.degraded_fields.setdefault(capability, set()).update(missing) def assert_complete(self, capability: str, required_fields: set) -> None: dropped = self.degraded_fields.get(capability, set()) unmet = required_fields & dropped if unmet: raise DegradedCapabilityError( f"capability {capability!r} returned degraded success; " f"required fields {sorted(unmet)} were nulled after a policy denial. " f"Re-plan or emit partial_result; do not proceed." ) def execute_step(ledger: CapabilityLedger, capability: str, args: dict, required_fields: set, gateway) -> dict: resp = gateway.call(capability, args) if resp.get("error") == "policy_denied": ledger.record_denial(capability) if not resp.get("retryable", False): # rebind attempt is permitted, but the next success is suspect alt = gateway.call(capability, {**args, "include_pii": False}) returned = set(alt.get("fields", {}).keys()) expected = required_fields | {"email", "phone"} ledger.record_success(capability, returned, expected) ledger.assert_complete(capability, required_fields) # raises if degraded return alt return resp ```