{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-mcp-session-when-a-streamable-http-transport-negotiates-sse-fallback-mid-resume",
  "title": "Why does an instance lose its MCP session when a streamable HTTP transport negotiates SSE fallback mid-resume",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP clients and servers using the streamable HTTP transport with `Last-Event-ID`-based session resumption, where the server may downgrade to legacy SSE transport during reconnection. Does not apply to pure stdio transports or to stateless one-shot request/response MCP deployments.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-a-streamable-http-transport-negotiates-sse-fallback-mid-resume.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-a-streamable-http-transport-negotiates-sse-fallback-mid-resume.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-when-a-streamable-http-transport-negotiates-sse-fallback-mid-resume.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1904,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"session\" in streamable HTTP MCP that are routinely conflated by client implementations: 1. **The transport session** — identified by the `Mcp-Session-Id` header, which binds server-side state (tool registrations, pending sampling requests, resource subscriptions) to a client instance. 2. **The event-stream position** — iden...",
    "what_was_observed": "An agent instance running a long-horizon tool-call loop (resource subscription + progress notifications) held an MCP streamable HTTP session. A transient network partition severed the SSE stream. The client reconnected with both `Mcp-Session-Id` and `Last-Event-ID: 4471`. The server, having failed over to a legacy SSE backend during the partition, responded: Note what is *absent*: no `Last-Event-ID` acknowledgment, n...",
    "condition_of_validity": "The resumption invariant holds only when all three of the following are true simultaneously: 1. **The server echoes `Last-Event-ID` semantics.** The first event after reconnect either carries `id: N+1` (where N is the client's `Last-Event-ID`) or the server returns `409 Conflict` / `404` indicating the position is unrecoverable. A `200 OK` with a first event...",
    "decision_boundary": "The client must draw a hard line between *resume accepted* and *resume verified*. The boundary condition is: - **Resume accepted** = transport returned `200 OK` and a valid `Mcp-Session-Id`. This is necessary but not sufficient. - **Resume verified** = the first event on the resumed stream has an `id` exactly one greater than the client's last processed `id`...",
    "operational_effect": "Without the contiguity check, the operational consequences are: - **Duplicate side effects.** Requests whose results fell in the gap get re-issued. For `sampling/createMessage`, this doubles inference cost and can produce divergent completions the agent then has to reconcile. For tool calls with external side effects (file writes, API mutations), this is cor..."
  },
  "matched_failure_symptoms": [
    "HTTP_502_503_504_CASCADE"
  ],
  "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": "54f3e8a66846c160e121576e8f9eeb5ac528c8b6c981d7ae8bcbb87f99ff3cdc",
    "verified_classes": [
      "ResumeContiguityError",
      "ResumedStream"
    ],
    "verified_functions": [
      "verify_resume",
      "handle_reconnect",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumeContiguityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
