{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-json-rpc-batch-atomicity-when-an-mcp-sse-stream-resumes-mid-batch",
  "title": "Why does an instance lose JSON-RPC batch atomicity when an MCP SSE stream resumes mid-batch",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers exposing the HTTP-native streaming transport (Streamable HTTP) with `Last-Event-ID` resumable SSE and JSON-RPC 2.0 batch requests, where a single SSE event payload may carry a batch array. Does not apply to stdio transports, single-message-per-event streams, or servers that reject batches outright.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-json-rpc-batch-atomicity-when-an-mcp-sse-stream-resumes-mid-batch.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-json-rpc-batch-atomicity-when-an-mcp-sse-stream-resumes-mid-batch.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-json-rpc-batch-atomicity-when-an-mcp-sse-stream-resumes-mid-batch.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2249,
    "python_slice_tokens": 441,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **event-level resumability** and **batch-level atomicity**. The MCP Streamable HTTP transport defines resumption in terms of SSE event IDs: a client reconnects with `Last-Event-ID: N` and the server replays events after `N`. This is a *stream cursor* contract. JSON-RPC 2.0 batching, separately, defines that a batch is ...",
    "what_was_observed": "A tool-call batch of 40 `tools/call` requests was issued to an MCP server over Streamable HTTP. The server emitted responses in 6 SSE events, each carrying a sub-array of the batch (7, 7, 7, 7, 7, 5 entries), with event IDs 101–106. The client connection dropped after event 104 was received (TCP reset during a long-running `tools/call` on the 29th request). The client reconnected with `Last-Event-ID: 104`. The server...",
    "condition_of_validity": "The invariant that must hold for resumable SSE + batching to be safe is: > For any batch B delivered across events E₁…Eₙ, the client must be able to determine, after any resume at `Last-Event-ID: k`, either (a) the exact set of B's responses already delivered, or (b) that B is incomplete and must be re-requested in full. This holds only when one of the follo...",
    "decision_boundary": "The boundary is not \"does the server support resumption\" but **\"does the resumption cursor carry batch semantics.\"** A server that logs events and replays by ID is correct for unbatched streams and incorrect for fragmented batched streams. The decision an agent runtime must make on `initialize` is: - If the server advertises `capabilities.batching` and `capa...",
    "operational_effect": "The downstream effect is **silent partial-batch acceptance**, which is worse than a hard failure because it does not trip any error path. The agent's tool-call loop sees a set of responses, all with valid `id`s and valid JSON-RPC envelopes, and has no signal that the set is incomplete. The planner's join over the batch resolves early (all awaited `id`s that ..."
  },
  "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": "01363e9a1cba105664d4457f5fdbf93dededc2fb04b645521dd4e3b53d5f100f",
    "verified_classes": [
      "BatchIntegrityError",
      "BatchManifest",
      "ResumableBatchClient"
    ],
    "verified_functions": [
      "new",
      "__init__",
      "on_send",
      "on_event",
      "on_resume",
      "on_complete"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "BatchIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
