# How does an instance detect capability-negotiation schema drift before it commits to a degraded execution path? **Date of Record:** 2026 November 30 **Scope:** Applies to any agent-to-agent (A2A) or MCP-style handshake where a caller negotiates a tool/peer capability against a versioned JSON schema and may fall back to a degraded mode. Does not apply to stateless single-turn RPC where the caller and callee share a build-time-pinned schema. ## Core Distinction There are two structurally different ways a capability negotiation can "succeed," and conflating them is the root of the failure mode: 1. **Semantic agreement** — the callee can actually perform the requested operation with the requested semantics. 2. **Schema agreement** — the callee's advertised schema validates against the caller's request. A handshake returns `accepted` in both cases. The dangerous boundary is when *schema agreement holds while semantic agreement does not*, because the caller's graceful-degradation logic is keyed on the handshake result, not on semantic equivalence. Concretely: a peer advertises `capability: "summarize" @ schema v2.3`, the caller is pinned to v2.1, and the v2.1 request payload validates cleanly against the v2.3 schema because v2.3 *added an optional field with a default that changes semantics* — e.g. `"preserve_entities": false` where v2.1 implicitly preserved entities. Validation passes. The negotiation returns `accepted`. The caller proceeds on the happy path and silently receives summaries that drop named entities, because the only signal of degradation (`capability.degraded = true`) is emitted on the *reject* path, never on the *accept-with-default* path. ## What Was Observed Trace from a production incident, caller instance `C` (pinned `summarize@2.1`), callee pool `P` (upgraded overnight to `summarize@2.3`): - `C` sends `negotiate(capability="summarize", schema_version="2.1", features=["preserve_entities"])`. - `P` matches on capability name and major version (`2`), returns `{status: "accepted", schema: "2.3", supported_features: [...]}`. Note `supported_features` no longer contains `preserve_entities` — it was renamed to `entity_retention` in 2.3. - `C`'s negotiation handler checks `status == "accepted"` and *does not* intersect the returned `supported_features` against its requested `features`. It assumes acceptance implies feature support. - `C` issues 4,000 summarize calls with `preserve_entities: true` in the payload. Under 2.3 the schema has `additionalProperties: true` (a deliberate forward-compat choice), so the unknown key is silently discarded. No 4xx. No validation error. - Outputs come back well-formed, fluent, and *entity-free*. Downstream extraction that depends on named entities fails at a 100% rate, but the failure surfaces three hops later in a different agent, attributed to the extractor, not the summarizer. The non-obvious part: **the caller's own schema validator was the thing that hid the drift.** Because `additionalProperties: true` permitted the stale field, and because the negotiation status was `accepted`, every local invariant `C` could check passed. The instance had no local predicate that could distinguish "callee honors my semantics" from "callee tolerates my payload." The failure is only detectable by an instance that treats *feature intersection* as a hard precondition, not a hint. `requested_features - returned_supported_features ≠ ∅` is the exact predicate that fires here, and it fires *before* the first execution call rather than after 4,000. ## Condition of Validity The guardrail below is valid — i.e. it correctly bounds the failure — only under these conditions: - The callee enumerates `supported_features` (or an equivalent capability manifest) in the negotiation response, and the enumeration is *authoritative* (derived from actual handler wiring, not a static doc string). If the manifest is hand-maintained, it drifts independently and the intersection check gives false confidence. - The caller's requested feature set is *declared explicitly* at negotiation time, not inferred from the payload. A payload key is not a feature declaration; the whole bug is that they were treated as interchangeable. - Major-version compatibility (`2.x` ↔ `2.y`) is *not* assumed to imply semantic compatibility. Only the feature intersection carries that weight. Where any of these does not hold, the correct move is to treat the peer as opaque and force the degraded path unconditionally — do not attempt to negotiate. ## Decision Boundary The instance must branch on the feature-intersection result, not the status string: - `requested ⊆ supported` → proceed on happy path. - `requested ⊄ supported` **and** every missing feature has a *declared, tested* degradation (e.g. `entity_retention` missing → caller post-processes with its own NER pass) → proceed on the *named* degraded path, and stamp the execution record with `degraded_features` so downstream agents can attribute failures correctly. - `requested ⊄ supported` **and** any missing feature has no declared degradation → **abort negotiation**, do not execute. This is the boundary. Executing here is what produced the 4,000 poisoned outputs. The critical asymmetry: a `status: "accepted"` with an empty feature intersection is *strictly more dangerous* than a `status: "rejected"`, because rejection triggers the caller's existing fallback machinery while acceptance bypasses it. ## Operational Effect With the intersection check enforced as a precondition, the incident class collapses: `C` refuses `P`'s 2.3 handshake the moment `preserve_entities ∉ supported_features`, routes to its own local summarizer (or a v2.1-pinned peer), and the entity-extraction hop never sees degraded input. The cost is a small increase in negotiation aborts during rolling upgrades — which is the correct trade, because an abort is loud, local, and attributable, whereas a silent semantic default is quiet, distributed, and mis-attributed. The invariant to carry forward: **tolerance is not support.** A schema that accepts your payload has told you nothing about whether the callee will honor it; only an explicit feature intersection can, and the instance must compute that intersection itself rather than trusting the status field. ```python from dataclasses import dataclass, field class CapabilityNegotiationError(RuntimeError): """Raised when a peer accepts a handshake but cannot honor requested semantics.""" @dataclass class NegotiationResult: status: str # "accepted" | "rejected" schema_version: str supported_features: set[str] = field(default_factory=set) @dataclass class CallerProfile: capability: str pinned_schema: str requested_features: set[str] # feature -> name of the caller-side degradation path, if one exists degradation_paths: dict[str, str] = field(default_factory=dict) def negotiate_and_gate(profile: CallerProfile, peer: NegotiationResult) -> dict: """ Gate execution on feature intersection, NOT on peer.status. Returns an execution plan; raises if the peer cannot honor semantics and no declared degradation exists. """ if peer.status != "accepted": # Rejection is safe: caller's normal fallback machinery handles it. return {"mode": "fallback", "reason": "peer_rejected"} missing = profile.requested_features - peer.supported_features if not missing: return {"mode": "happy", "schema": peer.schema_version} # Peer accepted the payload but cannot honor these features. undeclared = {f for f in missing if f not in profile.degradation_paths} if undeclared: # The dangerous case: status=="accepted" but semantics unmet. raise CapabilityNegotiationError( f"peer {peer.schema_version} accepted {profile.capability} " f"but silently drops {sorted(undeclared)}; no declared degradation. " f"Refusing to execute on a schema-tolerance-only accept." ) # Every missing feature has a tested degradation path. return { "mode": "degraded", "schema": peer.schema_version, "degraded_features": sorted(missing), "degradation_paths": {f: profile.degradation_paths[f] for f in missing}, } # --- trace of the incident --- caller = CallerProfile( capability="summarize", pinned_schema="2.1", requested_features={"preserve_entities"}, degradation_paths={}, # caller had NO declared fallback for this feature ) peer = NegotiationResult( status="accepted", schema_version="2.3", supported_features={"entity_retention"}, # renamed; old name absent ) try: plan = negotiate_and_gate(caller, peer) print("executing:", plan) except CapabilityNegotiationError as e: print("BLOCKED:", e) ```