{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-a2a-task-state-divergence-when-an-mcp-tool-server-is-wrapped-as-a-peer-agent-and-its-tool-result-schema-drifts-mid-task",
  "title": "Which invariants prevent A2A task-state divergence when an MCP tool server is wrapped as a peer agent and its tool-result schema drifts mid-task",
  "date_of_record": "2026 November 29",
  "scope": "Applies to bridges that expose an MCP tool server to A2A peers by translating MCP `tools/call` results into A2A `Task` artifacts and status updates, where the MCP server's output schema is versioned independently of the bridge. Does not apply to statically generated tool manifests pinned at bridge build time, nor to A2A-to-A2A handoffs with no MCP leg.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-a2a-task-state-divergence-when-an-mcp-tool-server-is-wrapped-as-a-peer-agent-and-its-tool-result-schema-drifts-mid-task.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a2a-task-state-divergence-when-an-mcp-tool-server-is-wrapped-as-a-peer-agent-and-its-tool-result-schema-drifts-mid-task.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-a2a-task-state-divergence-when-an-mcp-tool-server-is-wrapped-as-a-peer-agent-and-its-tool-result-schema-drifts-mid-task.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2096,
    "python_slice_tokens": 396,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the tool returned an error.\" It is that the tool returned a *structurally valid but semantically re-keyed* result, and the A2A peer's continuation logic was keyed on the old field names it observed during capability negotiation. MCP declares tool schemas at `tools/list` time; A2A declares agent capabilities at `AgentCard` fetch time. Thes...",
    "what_was_observed": "A bridge exposed an MCP server's `search_records` tool to an A2A peer acting as a research orchestrator. At `AgentCard` fetch, the peer negotiated a capability whose artifact schema declared `{\"results\": [...], \"next_cursor\": \"<str|null>\"}`. The peer's planner was written to treat `next_cursor == null` as terminal and any string as \"re-invoke with cursor.\" Mid-task, the MCP server was redeployed. Its `tools/list` now...",
    "condition_of_validity": "The fingerprint-and-reject invariant holds only under these conditions: - The bridge computes the fingerprint over the *canonicalized* MCP tool result schema (field names, nesting, types, nullability), not over the raw JSON of a single response. Fingerprinting a response instance is insufficient: two responses from the same schema can differ in optional fiel...",
    "decision_boundary": "The boundary is between **coerce** and **reject** when a payload field the peer expects is absent or re-typed. - Coercion (`.get(field, default)`, type casting, silent drop) is correct only when the field is declared optional in the negotiated capability *and* the peer's logic treats absence as a defined semantic (e.g., \"no cursor means terminal\"). It is nev...",
    "operational_effect": "With the invariant enforced, the observed failure converts from a silent truncation into a loud, bounded task failure: the bridge rejects the divergent artifact, the peer receives `status: failed` with `reason: schema_drift`, the retry classifier marks it non-retryable, and the orchestrator escalates to a human or to a re-negotiation path (`AgentCard` re-fet..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "380f85f3eb4353c531acdfffa12351798a01631c77cc2ca93e8fba05b694f6f6",
    "verified_classes": [
      "SchemaDriftError",
      "NonRetryableToolError",
      "NegotiatedCapability",
      "MCPToA2ABridge"
    ],
    "verified_functions": [
      "_canonical_fingerprint",
      "handle_peer_call",
      "__init__",
      "negotiate",
      "translate"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "NonRetryableToolError",
      "SchemaDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
