{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-mcp-session-when-sse-resumption-crosses-a-load-balanced-boundary",
  "title": "Why does an instance lose its MCP session when SSE resumption crosses a load-balanced boundary?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers exposed over HTTP-native transport with `streamable` SSE and `Last-Event-ID` resumption, fronted by any stateless L7 load balancer or multi-replica deployment. Does not apply to single-process stdio transports, or to SSE deployments that pin a session to a single connection with no resumption contract.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-sse-resumption-crosses-a-load-balanced-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-sse-resumption-crosses-a-load-balanced-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-sse-resumption-crosses-a-load-balanced-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2080,
    "python_slice_tokens": 500,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streamable HTTP transport treats a *session* and a *stream* as two different lifetimes. The session is identified by the `Mcp-Session-Id` header and is expected to survive across many HTTP requests. The SSE stream is identified by an event ID sequence and is expected to survive a *single* request's disconnection, resumable via `Last-Event-ID`. The fa...",
    "what_was_observed": "A tool-calling agent was driving a long-running MCP server operation (a multi-page document index build) over streamable HTTP. The server emitted progress events and a final `tools/call` result as SSE events on a single POST-initiated stream. Between events 441 and 442 the client's TCP connection was reset (idle timeout at an intermediate NAT). The client reconnected with `Last-Event-ID: 441` and the same `Mcp-Sessio...",
    "condition_of_validity": "The silent-gap behavior is *valid* (i.e., the server is not violating the transport contract) under all of the following: 1. The server treats `Last-Event-ID` as an *optional hint* rather than a hard cursor, and the spec text permits falling back to a fresh stream when the cursor is unknown. 2. The event ID namespace is scoped to the replica's stream buffer,...",
    "decision_boundary": "The architectural choice is where to put the reconnection contract: - **Stream-local cursor (observed, broken):** cheap, no shared state, but a cursor is only meaningful on the replica that minted it. Any non-affine routing silently loses events. - **Session-scoped cursor with shared event log:** the session record carries `last_emitted_id` and a durable or ...",
    "operational_effect": "The downstream effect is not \"a dropped event.\" It is **duplicate execution under a divergent cursor.** Because the client cannot distinguish a legitimate fresh stream from a gap, its only recovery move on stream stall is to retry the originating request. The retry is a new `tools/call` on a session whose original call is still in flight on another replica. ..."
  },
  "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": "ce9ed9dae8088a5074bf62847aafa3e6722b03de2ed76257706e3d6210bd90d2",
    "verified_classes": [
      "ResumptionCursorError",
      "SessionRecord",
      "McpReplica"
    ],
    "verified_functions": [
      "call_tool_idempotent",
      "__init__",
      "resume_stream",
      "_from_head"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "ResumptionCursorError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
