{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-resume-a-streamed-mcp-session-into-a-half-open-eventsource-and-silently-lose-tool-call-results",
  "title": "Why does an instance resume a streamed MCP session into a half-open EventSource and silently lose tool-call results",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP clients using the HTTP-native transport with `text/event-stream` responses and the resumption protocol (`Last-Event-ID` / `event_id` replay) when the server interleaves JSON-RPC responses with server-originated notifications. Does not cover stdio transport, WebSocket transports, or servers that emit each JSON-RPC response as a discrete non-streamed HTTP response.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-a-streamed-mcp-session-into-a-half-open-eventsource-and-silently-lose-tool-call-results.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-a-streamed-mcp-session-into-a-half-open-eventsource-and-silently-lose-tool-call-results.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-a-streamed-mcp-session-into-a-half-open-eventsource-and-silently-lose-tool-call-results.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2309,
    "python_slice_tokens": 504,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" Dropped connections are the designed-for case: the client reconnects, sends `Last-Event-ID`, and the server replays from its event log. The failure is the mismatch between **what the client believes it has acknowledged** and **what the server believes it has delivered** when backpressure causes the client to stop ...",
    "what_was_observed": "An agent runtime issued a `tools/call` for a long-running operation (a code-execution sandbox call, ~40 s). The MCP server, per spec, emitted a streamed response: an initial `event: message` with the request acknowledgment, then periodic `event: message` keepalives plus unrelated `notifications/message` log events, then finally the `tools/call` result. Each SSE frame carried an `id:` field. The client's SSE reader wa...",
    "condition_of_validity": "This boundary is reachable whenever all of the following hold: 1. The transport is HTTP-native SSE with resumption enabled (`event_id` present on frames). 2. There is any **decoupling** between the layer that reads bytes and assigns the cursor and the layer that dispatches JSON-RPC — a queue, a buffer, a separate task/thread. If the cursor is advanced only *...",
    "decision_boundary": "The architectural invariant to enforce: **the resumption cursor must be a function of dispatch, not of receipt.** Concretely, `Last-Event-ID` sent on reconnect must equal the highest event ID whose JSON-RPC payload has been fully handed to and accepted by the dispatcher — never the highest ID the SSE parser has tokenized. Every frame between parser-cursor an...",
    "operational_effect": "Left unguarded, the effect is **silent at-least-once-to-at-most-once flip**: the protocol believes it delivered exactly once, the agent believes it never received, and the tool executes twice with the agent's memory recording once. This is the worst class of agent failure — non-idempotent side effects with a memory that disagrees with reality. The agent's ep..."
  },
  "matched_failure_symptoms": [
    "HTTP_502_503_504_CASCADE"
  ],
  "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": "c83590b79dca62cd3296a2e11384b36d53cdd927ea5c1570a751fb408bf1b60a",
    "verified_classes": [
      "ResumptionGapError",
      "ResumeState"
    ],
    "verified_functions": [
      "build_resume_header",
      "dispatch_frame"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
