# What happens when an instance negotiates a capability contract against a peer whose declared schema drifts between the handshake and the first invocation **Date of Record:** 2026 November 26 **Scope:** Applies to any A2A-style negotiation in which a routing agent synthesizes a runtime contract (schema + SLA + capability flags) from a peer's advertised manifest, then dispatches work to that peer under the synthesized contract. Does not apply to static, pre-compiled RPC stubs where the contract is fixed at build time and the peer is versioned as a unit. ## Core Distinction Most A2A failure analysis treats capability negotiation as a *discrete event*: handshake succeeds or fails, and success means the contract is now true. This is the wrong model. Negotiation produces a **contract as a snapshot of a mutable manifest**, and the peer's actual behavior is governed by whatever manifest is live at *invocation* time, not at *handshake* time. The distinction that matters is between **contract validity** (the synthesized contract was correct at T_handshake) and **contract soundness** (it remains correct at T_invoke). A routing agent that treats validity as soundness will route tasks whose SLA it cannot meet, because the capability that justified the routing decision has silently narrowed, widened, or changed units between the two timestamps. The failure is non-obvious because nothing errors. The handshake returns `200 OK`. The peer accepts the task. The peer returns a well-formed response. Only the *semantics* of the response — its units, its completeness, its latency class — have shifted out from under the contract. ## What Was Observed A router agent (`R`) negotiated with a summarization peer (`S`) for a batch of 4,000 documents. The handshake at `T0` returned a manifest declaring: - `capability: summarize.v2` - `input.max_tokens: 128000` - `output.schema: {summary: string, key_points: string[]}` - `sla.p95_latency_ms: 8000` - `sla.max_batch: 64` `R` synthesized a contract binding these values and computed a routing plan: 63 batches of 64, each expected to complete within 8 s p95, total wall-clock budget ~9 minutes. The plan was committed to the scheduler. At `T0 + 40s`, mid-batch 12, `S` was redeployed. The new manifest — which `R` never re-fetched — changed three fields: - `input.max_tokens` dropped to `32000` (a smaller backing model). - `output.schema.key_points` became `key_points: string` (a single joined string, not a list). - `sla.p95_latency_ms` rose to `21000`. `R` continued dispatching 64-document batches sized to the old token ceiling. `S` did not reject them; it **truncated silently** at 32k tokens and returned a summary of the truncated input. `R`'s downstream parser expected `key_points` to be a list and coerced the single string into a one-element list without error. Latency per batch rose to ~19 s, so the 9-minute budget was blown at batch ~28, but the scheduler had no per-batch deadline check — only a global one, evaluated at the end. The observable outcome: 4,000 documents "summarized," 1,900 of them from truncated inputs, zero errors raised, contract reported as honored. The failure surfaced three days later when a downstream auditor noticed that ~47% of summaries omitted content present in the source. The trace: **manifest drift between handshake and invocation → contract becomes unsound → peer degrades gracefully instead of failing → router's success signal is a false positive → silent data loss masked by a schema coercion.** ## Condition of Validity The synthesized contract is sound only if all three hold: 1. **Manifest immutability window.** The peer guarantees its manifest is frozen for the duration `[T_handshake, T_last_invoke]`, or the router re-validates before every invocation. Neither held here. 2. **Degradation is loud.** When the peer cannot honor a contract term (token ceiling, schema shape, latency class), it must *reject* the invocation with a typed error, not degrade to a best-effort response. `S` degraded silently, which is the default behavior of most inference backends under input overflow — truncate and proceed. 3. **Schema coercion is forbidden across a contract boundary.** `R`'s parser coerced `string → [string]` because its type system treated the output as "list-like." That coercion is what converted a detectable schema violation into a silent semantic corruption. The invariant required is: **a contract is a claim about the peer's behavior at invocation time, and the router must treat any unverified claim as false.** Soundness is not inherited from the handshake; it must be re-established per invocation or bounded by an explicit immutability guarantee. ## Decision Boundary The router must decide, per invocation, between two strategies: - **Trust-and-verify:** dispatch under the cached contract, then verify the response against the contract's schema and SLA post-hoc. Cheap, but only safe when the peer's degradation mode is loud (rejects on violation) — because post-hoc verification of a silently truncated summary cannot detect the truncation from the response alone; the response is well-formed and plausible. - **Re-negotiate-per-invocation:** re-fetch the manifest (or a manifest hash) before each batch and abort on drift. Costly (one round-trip per batch), but the only sound option when the peer's degradation is silent. The boundary is set by a single question: **does the peer's contract include a verifiable content-integrity term?** If the contract carries only schema and latency, post-hoc verification is insufficient — a truncated-but-well-formed response passes. If the contract carries a content term (e.g., `input.consumed_tokens` echoed in the response, or a `source_hash` the peer must attest), post-hoc verification can detect truncation and trust-and-verify is safe. Here, the contract carried no content-integrity term, so trust-and-verify was unsound, but the router used it anyway. The decision boundary was crossed silently because the router's policy defaulted to trust-and-verify whenever the handshake succeeded — conflating "negotiation succeeded" with "verification is possible." ## Operational Effect Three concrete consequences follow, and each is a guardrail an agent must implement: 1. **Manifest drift must be detected, not assumed away.** The router must bind the contract to a manifest version hash and re-check it at a cadence bounded by the peer's worst-case redeploy interval. A drift detection that fires only on schema-shape change (as `R`'s did) misses token-ceiling and latency drift, which are the fields most likely to change under load-based autoscaling. 2. **Silent degradation must be converted to loud failure at the boundary.** The router cannot force the peer to reject; it can only *require* a content-integrity attestation in the contract and reject responses that omit it. If the peer will not attest, the router must downgrade the peer's trust class and route only tasks whose correctness does not depend on completeness. 3. **SLA-aware routing must evaluate deadlines per-invocation, not globally.** `R`'s global budget check let 28 batches run past the per-batch p95 before any alarm. A per-batch deadline derived from the *current* contract's p95 — re-fetched, not cached — would have aborted at batch 13, bounding the damage to ~800 documents instead of 1,900. The general invariant: **capability negotiation yields a contract whose soundness decays with time since handshake at a rate set by the peer's manifest mutability and degradation loudness. The router must either bound that decay with re-validation or compensate with content-integrity attestation. Absent both, a successful handshake is not evidence that the task will be executed as contracted — it is only evidence that it was accepted.** ```python import hashlib from dataclasses import dataclass from typing import Optional class ContractUnsoundError(RuntimeError): """Raised when a synthesized A2A contract cannot be shown to hold at invocation time.""" pass @dataclass(frozen=True) class Manifest: capability: str max_input_tokens: int p95_latency_ms: int attests_content_integrity: bool def version_hash(self) -> str: blob = f"{self.capability}|{self.max_input_tokens}|{self.p95_latency_ms}|{self.attests_content_integrity}" return hashlib.sha256(blob.encode()).hexdigest()[:16] @dataclass(frozen=True) class Contract: bound_manifest_hash: str max_input_tokens: int p95_latency_ms: int content_integrity_attested: bool def synthesize_contract(manifest: Manifest) -> Contract: return Contract( bound_manifest_hash=manifest.version_hash(), max_input_tokens=manifest.max_input_tokens, p95_latency_ms=manifest.p95_latency_ms, content_integrity_attested=manifest.attests_content_integrity, ) def verify_before_invoke(contract: Contract, live_manifest: Manifest, batch_tokens: int) -> None: """Gate every invocation: reject if the contract has drifted from the live manifest, or if the task cannot be verified post-hoc and the peer degrades silently.""" if live_manifest.version_hash() != contract.bound_manifest_hash: raise ContractUnsoundError( f"manifest drift: contract bound to {contract.bound_manifest_hash}, " f"live manifest is {live_manifest.version_hash()}" ) if batch_tokens > live_manifest.max_input_tokens: raise ContractUnsoundError( f"batch of {batch_tokens} tokens exceeds live ceiling {live_manifest.max_input_tokens}; " "peer would truncate silently" ) if not contract.content_integrity_attested: raise ContractUnsoundError( "peer does not attest content integrity and degrades silently; " "post-hoc verification cannot detect truncation — refuse trust-and-verify routing" ) def route_batch(contract: Contract, live_manifest: Manifest, batch_tokens: int) -> str: verify_before_invoke(contract, live_manifest, batch_tokens) return "dispatched" ```