{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-mcp-session-identity-when-a-multiplexed-http-stream-resumes-across-a-transport-interruption",
  "title": "Why does an instance lose its MCP session identity when a multiplexed HTTP stream resumes across a transport interruption",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP clients/servers that multiplex multiple logical sessions over HTTP long-lived streams (SSE/chunked) and advertise resumable delivery via `Last-Event-ID` replay. Does not apply to single-session stdio transports or to stateless one-shot request/response MCP calls with no per-session state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-identity-when-a-multiplexed-http-stream-resumes-across-a-transport-interruption.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-identity-when-a-multiplexed-http-stream-resumes-across-a-transport-interruption.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-session-identity-when-a-multiplexed-http-stream-resumes-across-a-transport-interruption.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1668,
    "python_slice_tokens": 329,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" Transport interruption is expected and recoverable. The failure is that **resumption restores the byte stream but not the session's identity binding**, because the two are keyed differently. The stream is resumable by `Last-Event-ID` (an event cursor), while the session is authenticated and authorized by a session...",
    "what_was_observed": "A multiplexing gateway fronted N logical MCP sessions over a small pool of HTTP/2 streams. Each session had its own `Mcp-Session-Id`. Events were emitted with `id:` fields drawn from a gateway-global counter to keep ordering monotonic across interleaved sessions. Trace of the failure: 1. Session A (`S-A`) is streaming a long tool-call result. Gateway emits events with ids `1001..1050`. Client tracks `Last-Event-ID: 1...",
    "condition_of_validity": "The replay-safety invariant holds only when all three conditions are true: - **Cursor namespacing:** event ids are scoped per session (e.g., `S-A:1050`), not drawn from a global counter, so a cursor cannot be resolved outside its minting session. - **Identity continuity:** the reconnect path reuses the original `Mcp-Session-Id` when it is still within its re...",
    "decision_boundary": "On a reconnect carrying `Last-Event-ID`, the server must decide between three outcomes, and the choice is the whole guardrail: - **Resume in place** — only if `(session_id, cursor)` resolves to a live session record and the cursor was minted under that exact session. Serve `1051..` and keep the session. - **Reject and reinitialize** — if the session was reap...",
    "operational_effect": "Downstream, the mismatch manifests as reasoning divergence that is hard to attribute: the agent's context contains tool results it believes are its own, but the server's session state disagrees. Retries re-execute tools against the empty successor session, producing duplicate side effects while the client de-duplicates against replayed ids — so duplicate sup..."
  },
  "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": "f321fe446d99a3b454de03c5d9130334d74c7a11bd46ad654b8fc573ff37cdc7",
    "verified_classes": [
      "SessionReplayMismatch",
      "Cursor",
      "ReplayStore"
    ],
    "verified_functions": [
      "handle_reconnect",
      "encode",
      "decode",
      "__init__",
      "mint",
      "reap",
      "resume"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SessionReplayMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
