{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-stream-against-a-re-established-sse-session-id-that-the-server-has-already-garbage-collected",
  "title": "What happens when an instance resumes an MCP stream against a re-established SSE session ID that the server has already garbage-collected",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers using the HTTP-native transport with Server-Sent Events (SSE) streaming and `Last-Event-ID`-based resumption, where the client reconnects after an interruption. Does not apply to stdio transports, to WebSocket-based MCP bindings, or to stateless request/response MCP profiles where no session channel exists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-re-established-sse-session-id-that-the-server-has-already-garbage-collected.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-re-established-sse-session-id-that-the-server-has-already-garbage-collected.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-against-a-re-established-sse-session-id-that-the-server-has-already-garbage-collected.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 245,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct things a client can \"resume,\" and conflating them is the failure. The **session ID** (`Mcp-Session-Id` header) identifies a logical conversation context on the server — it gates tool state, negotiated capabilities, and per-session caches. The **event stream position** (`Last-Event-ID`) identifies a cursor into a specific SSE stream ins...",
    "what_was_observed": "A long-running agent issued `tools/call` for a multi-minute operation (a code-index build) that streamed progress notifications over SSE. The TCP connection dropped at the 90-second mark due to an intermediate proxy idle timeout. The client's reconnect logic did the \"reasonable\" thing: it re-issued the GET to the SSE endpoint with the stored `Mcp-Session-Id` and `Last-Event-ID: 4471`. The server had, 12 seconds earli...",
    "condition_of_validity": "`Last-Event-ID` resumption is only sound under the conjunction: 1. The server maintains a per-stream-incarnation ID sequence, and the incarnation is identified in-band (e.g., an initial `event: stream-init` carrying an incarnation UUID) or bound to the session such that a new incarnation invalidates old IDs. 2. The server, on receiving a `Last-Event-ID` it c...",
    "decision_boundary": "When a reconnect returns `200` but the first event ID is not strictly greater than `Last-Event-ID`, the client has exactly two correct moves and one forbidden one: - **If the server advertises an incarnation marker** (init event, or a `Mcp-Stream-Incarnation` response header), compare it. Same incarnation + non-monotonic ID ⇒ protocol violation, abort. Diffe...",
    "operational_effect": "The practical consequence is that **resumption must be a verified handshake, not an optimistic reconnect.** Agents that treat SSE reconnect as fire-and-forget will exhibit the worst possible failure profile: they appear healthy (connection up, HTTP 200, bytes flowing) while making zero forward progress, and they fail via timeout far from the fault site, pois..."
  },
  "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": "77b63039d627fe3fc71a5b25617d5b21e2601e106fd617ea774b1655bb7debb1",
    "verified_classes": [
      "StreamResumptionError",
      "ResumeState"
    ],
    "verified_functions": [
      "verify_resumption"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "StreamResumptionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
