{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-mcp-tool-call-replay-corruption-when-a-partial-network-partition-splits-the-sse-stream-from-the-json-rpc-response-channel",
  "title": "Which invariants prevent MCP tool-call replay corruption when a partial network partition splits the SSE stream from the JSON-RPC response channel",
  "date_of_record": "2026 December 1",
  "scope": "Applies to Model Context Protocol (MCP) transports where the server streams results over Server-Sent Events (SSE) while the client's tool invocation arrives over a separate HTTP POST channel, and the two channels can be partitioned independently. Does not apply to single-connection stdio transports or to fully-atomic request/response RPCs where the response is bound to the same TCP session as the request.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-tool-call-replay-corruption-when-a-partial-network-partition-splits-the-sse-stream-from-the-json-rpc-response-channel.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-tool-call-replay-corruption-when-a-partial-network-partition-splits-the-sse-stream-from-the-json-rpc-response-channel.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-mcp-tool-call-replay-corruption-when-a-partial-network-partition-splits-the-sse-stream-from-the-json-rpc-response-channel.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1809,
    "python_slice_tokens": 357,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the network dropped a packet.\" It is a **split-brain between two logically coupled channels that the protocol treats as independent**. In the MCP HTTP+SSE transport, a tool call is a POST to an endpoint whose *result* is delivered asynchronously as an SSE event on a long-lived `GET` stream, correlated only by a JSON-RPC `id`. When a parti...",
    "what_was_observed": "Under fault injection (partitioning the SSE `GET` at the TCP layer with `tc netem` + an iptables `DROP` on the stream's 5-tuple, while leaving the POST path routed), the following trace reproduced reliably across three MCP servers (one Python `mcp` SDK reference server, two custom): 1. Agent issues `tools/call` with `id: 41`, POST succeeds, server begins executing a 90-second tool. 2. Partition drops the SSE stream. ...",
    "condition_of_validity": "The invariant that must hold to prevent this: **a client MUST NOT re-issue a `tools/call` whose POST was acknowledged, regardless of stream health; recovery of the result is a stream-replay problem, not a request-retry problem.** This holds only when: - The POST acknowledgment (`202`/`200` with a receipt) is treated as a **durable commitment** that the serve...",
    "decision_boundary": "The boundary is drawn at the moment of POST acknowledgment: - **Before ack:** retry is safe; the server may not have received the request. New `id` is acceptable only if the old `id` is tombstoned as `abandoned` so a late result is discarded, not surfaced. - **After ack:** the request is *committed*. The only legal client actions are (a) reconnect the stream...",
    "operational_effect": "The practical consequence: naive retry-on-stream-failure turns a transient partition into **semantic duplication in the agent's context**, which manifests downstream as spurious compensating actions, doubled side effects, and reasoning divergence that is extremely hard to attribute because every individual log line looks correct. The fix is architectural, no..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "8a139a32f359dbc2f371841de11a686758681f60ae2241484e9c69998d0bef9b",
    "verified_classes": [
      "ReplayInvariantViolation"
    ],
    "verified_functions": [
      "apply_stream_event",
      "on_stream_failure"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ReplayInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
