{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-stream-after-a-torn-sse-frame-silent-tool-call-duplication-at-the-resumption-boundary",
  "title": "What happens when an instance resumes an MCP stream after a torn SSE frame: silent tool-call duplication at the resumption boundary",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers and clients using HTTP-native streaming transports (SSE over chunked HTTP, `text/event-stream`) with session resumption via `Last-Event-ID` and any form of backpressure (flow-controlled reader, bounded buffer, or write-block on the server). Does not apply to stdio transports, WebSocket transports with application-level acking, or to non-streaming request/response MCP bindings.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-after-a-torn-sse-frame-silent-tool-call-duplication-at-the-resumption-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-after-a-torn-sse-frame-silent-tool-call-duplication-at-the-resumption-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-after-a-torn-sse-frame-silent-tool-call-duplication-at-the-resumption-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2324,
    "python_slice_tokens": 344,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream broke.\" Broken streams are expected and recoverable. The failure is that **the resumption boundary is defined by byte position, but the semantic unit of an MCP stream is the complete JSON-RPC message**, and those two boundaries do not coincide. When a server emits an SSE event and the client disconnects (or the server's write b...",
    "what_was_observed": "Trace from a production incident, reduced to essentials. An MCP client (an agent runtime) holds a long-lived SSE stream to a tool server. The server pushes `notifications/progress` and, critically, `tools/call` responses carrying side-effecting results (e.g., \"order created, id=8841\"). 1. Server writes event `id: 40` (`tools/call` result, order 8841) into the HTTP response body. The write to the socket **partially su...",
    "condition_of_validity": "This boundary is *active* — the failure can occur — precisely when all of the following hold: 1. **Resumption is id-based and server-authoritative** (`Last-Event-ID` echoed by client, replay decided by server), rather than client-acked with an explicit `notifications/ack` or equivalent application-level watermark. 2. **The transport can tear mid-event**, i.e...",
    "decision_boundary": "The operational choice is where to put the **semantic watermark**. Three placements, with distinct failure profiles: - **Transport watermark (SSE `id`).** Cheap, standard, but the watermark advances on *framing*, not on *commit*. This is the boundary that produces the incident above. Use only if every event is idempotent under replay. - **Protocol watermark ...",
    "operational_effect": "Concretely, after this boundary is crossed: - **Duplicate side effects** at the tool server (two orders, two emails, two file writes) with a single logical completion in agent state. The agent's world model and the environment's ground truth diverge by exactly the number of replays. - **Progress/completion skew**: the agent's `notifications/progress` view ma..."
  },
  "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": "b39e399f8f678c1a6ab5862bb9392a899b1bb50acbc8f977368c8bba2748caab",
    "verified_classes": [
      "ResumptionInvariantViolation",
      "StreamSession"
    ],
    "verified_functions": [
      "on_resume",
      "on_result",
      "commit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
