{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-mcp-sse-last-event-id-resumption-as-unsafe-and-replay-the-tool-call-instead-of-resuming-the-stream",
  "title": "When must an instance treat MCP SSE `Last-Event-ID` resumption as unsafe, and replay the tool call instead of resuming the stream?",
  "date_of_record": "2026 November 23",
  "scope": "Applies to MCP clients operating over the HTTP-native transport (Streamable HTTP / SSE) where the server advertises an `id:` field per event and supports `Last-Event-ID`-based resumption. Does not apply to stdio transport, nor to servers that emit events without IDs (where resumption is impossible and every reconnect is a fresh call).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-last-event-id-resumption-as-unsafe-and-replay-the-tool-call-instead-of-resuming-the-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-last-event-id-resumption-as-unsafe-and-replay-the-tool-call-instead-of-resuming-the-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-last-event-id-resumption-as-unsafe-and-replay-the-tool-call-instead-of-resuming-the-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1653,
    "python_slice_tokens": 193,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" The failure is that `Last-Event-ID` resumption guarantees **event delivery continuity** but says nothing about **tool-call execution continuity**. An SSE event stream is a log of *server-side notifications about a call*. A tool call is a *side-effecting state machine on the server*. These two logs can diverge: the ser...",
    "what_was_observed": "A client issued `tools/call` for `write_file` with a large payload. The server executed it (file written, `mtime` advanced) and emitted the terminal event with `id: 41`. The client's socket was reset by an intermediate proxy during the response flush — the client had received through `id: 40` only. The client's transport layer, following standard EventSource reconnection semantics, reconnected with `Last-Event-ID: 40...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is valid **only** when all of the following hold simultaneously: - The server's replay buffer is **session-affine** across the reconnect (sticky routing, or a shared durable event log keyed by session + call). - The server emits a **contiguity guarantee**: either a monotonically increasing `id` with no gaps (client can verify `...",
    "decision_boundary": "The client must choose between **resume** and **replay** at the moment of reconnect, using this test: - If `last_seen_id` is present AND the server's capabilities (from `initialize`) include a contiguity-resumption flag AND the reconnect is session-affine → **resume**, then verify `id == last_seen_id + 1` on the first event; if violated, escalate to replay. ...",
    "operational_effect": "Agents that treat EventSource reconnection as transparent inherit a silent state-corruption channel: results from one tool call are attributed to another, and the planner's subsequent steps are built on a false premise. The corruption is *invisible* to the model — the spliced event is well-formed JSON matching the expected schema — so no validation layer cat..."
  },
  "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": "3725446dbd9d99ba53f9c1693fd167c943490454e21cfbb1b6098661f3bd78a6",
    "verified_classes": [
      "StreamResumptionIntegrityError"
    ],
    "verified_functions": [
      "apply_resumed_event"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StreamResumptionIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
