{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-sse-last-event-id-resumption-as-unsafe-after-an-mcp-server-restarts-mid-stream",
  "title": "When must an instance treat SSE `Last-Event-ID` resumption as unsafe after an MCP server restarts mid-stream",
  "date_of_record": "2026 November 20",
  "scope": "Applies to HTTP-native MCP transports using Server-Sent Events for server→client notifications (progress, log, sampling, elicitation, resource-update) where the client resumes via `Last-Event-ID` after a disconnect. Does not apply to stdio MCP sessions, nor to pure request/response tool calls with no streaming side channel.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-sse-last-event-id-resumption-as-unsafe-after-an-mcp-server-restarts-mid-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-sse-last-event-id-resumption-as-unsafe-after-an-mcp-server-restarts-mid-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-sse-last-event-id-resumption-as-unsafe-after-an-mcp-server-restarts-mid-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1593,
    "python_slice_tokens": 275,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"the stream continues\" that get conflated in MCP HTTP transports: **event-id continuity** (the server can accept a `Last-Event-ID` header and emit events with ids numerically greater than it) and **state continuity** (the server's internal emitter is still the same process that produced the events before `Last-Event-ID`). SS...",
    "what_was_observed": "An agent driving a long `tools/call` against an MCP server (a code-indexing tool that streamed `notifications/progress` every ~2s and emitted a final `notifications/message` with the result token) was disconnected at ~40s by an intermediary proxy idle timeout. The client reconnected with `Last-Event-ID: 812`. The server (a fresh replica, spun up because the previous one OOM'd) accepted the header, and — because its p...",
    "condition_of_validity": "`Last-Event-ID` resumption is only safe under a conjunction that is rarely stated explicitly in MCP server implementations: - **Process affinity:** the resume request is routed to the same process instance that emitted the event with the given id. This requires either a single-replica deployment, sticky sessions keyed on a stream/session token, or a durable ...",
    "decision_boundary": "The agent must draw the line between **resumable** and **must-restart** at the point where it can no longer verify that the event stream and the underlying tool execution share a lifetime. Concretely: - If the MCP server advertises a `Mcp-Session-Id` (or equivalent) and the resume response echoes the *same* session id, resume is admissible. - If the resume r...",
    "operational_effect": "Encoding this invariant changes the agent's failure surface from *silent empty success* to *loud, recoverable restart*. The cost is that every proxy idle-timeout now produces a re-execution rather than a cheap resume — for a 40s code-indexing call, that is real compute. The benefit is that the agent never reports a result it cannot trace to a terminal event ..."
  },
  "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": "67b48d893f7e2b0992186f9be451dc109d145b0a126e0bee02880deb36473047",
    "verified_classes": [
      "StreamContinuityViolation",
      "ResumeProbe",
      "ResumeResponse"
    ],
    "verified_functions": [
      "validate_resume"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamContinuityViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
