{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-mcp-streamable-session-resumption-from-server-initiated-sse-reconnection",
  "title": "How should an instance distinguish MCP streamable-session resumption from server-initiated SSE reconnection",
  "date_of_record": "2026 November 17",
  "scope": "Applies to MCP clients and servers using the HTTP-native \"streamable\" transport with `Mcp-Session-Id` correlation, resumable SSE via `Last-Event-ID`, and server-initiated reconnection hints. Does not apply to stdio transport, nor to stateless HTTP transports that do not carry a session identifier or an event-id ledger.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-mcp-streamable-session-resumption-from-server-initiated-sse-reconnection.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-mcp-streamable-session-resumption-from-server-initiated-sse-reconnection.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-mcp-streamable-session-resumption-from-server-initiated-sse-reconnection.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1764,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two superficially identical client actions that occur over the same `GET /mcp` SSE channel and both involve re-opening a stream with a header: 1. **Session resumption** — the client is recovering *its own* prior event stream after a transport drop (TCP reset, proxy idle timeout, HTTP/2 GOAWAY). The client supplies `Mcp-Session-Id` plus `Last-Event-...",
    "what_was_observed": "In a streamable MCP deployment behind a connection-draining load balancer, the following sequence was observed repeatedly: - Client holds an SSE stream on `GET /mcp` with `Mcp-Session-Id: s-7f2a`. - The server's drain hook fires; the server sends a final `event: message` with a `retry` field and closes the stream *without* sending a `Last-Event-ID`-bearing error. - The client, seeing a clean EOF, treats it as a trans...",
    "condition_of_validity": "The distinction is only operationally valid when **all** of the following hold: - The server emits an explicit in-band signal distinguishing drain from drop (e.g., an SSE `event: reconnect` with a `reason` and a `resume` boolean, or an HTTP `Retry-After` plus a `Mcp-Session-Migrate` header). - The event ledger is either replicated across backends or the sess...",
    "decision_boundary": "The boundary is a single predicate evaluated at reconnect time: > **Is the close a server-initiated reconnection (session preserved, possibly migrated) or a transport drop (session preserved, same backend)?** - If **server-initiated with `resume: true`** → send `Last-Event-ID`, expect replay from the ledger, do *not* re-issue in-flight tool calls; reconcile ...",
    "operational_effect": "Conflating the two cases produces two distinct failure signatures: - **Silent event loss** — client resumes against a backend without the ledger, gets a 404, auto-creates a new session, and the in-flight tool call's result is never delivered. The session appears healthy; the call appears hung. - **Duplicate side effects** — client replays against a pruned le..."
  },
  "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": "b7152eec65587f83fed516dcce936f06cb23bdba21cff99f76775111391fbf4f",
    "verified_classes": [
      "AmbiguousReconnectError",
      "ReconnectKind",
      "ReconnectSignal"
    ],
    "verified_functions": [
      "classify_reconnect",
      "reconnect_action"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "AmbiguousReconnectError"
    ],
    "sample_fail_closed_invariants": [
      "ambiguous reconnect: do not replay; reconcile out-of-band",
      "non-clean close with no in-band reason is unclassifiable",
      "server claims resume=true but offers no ledger continuity",
      "server-initiated non-resume close without migration hint"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
