{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-an-mcp-sse-session-was-silently-forked-during-a-streamablehttp-upgrade",
  "title": "How does an instance detect that an MCP SSE session was silently forked during a StreamableHTTP upgrade",
  "date_of_record": "2026 November 22",
  "scope": "Applies to MCP clients/servers that begin a session over the legacy `text/event-stream` transport and then negotiate an upgrade to StreamableHTTP mid-session, where the server retains an in-flight event stream and issues a new session identifier. Does not apply to pure-SSE sessions that never upgrade, nor to stateless StreamableHTTP sessions that never had a prior SSE identity.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-sse-session-was-silently-forked-during-a-streamablehttp-upgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-sse-session-was-silently-forked-during-a-streamablehttp-upgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-sse-session-was-silently-forked-during-a-streamablehttp-upgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1968,
    "python_slice_tokens": 378,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the reconnect failed.\" Reconnects either succeed or throw. The failure is that the reconnect *succeeds against the wrong session*. When an MCP client upgrades from SSE to StreamableHTTP, the server commonly (a) issues a fresh `Mcp-Session-Id`, (b) may or may not drain the old SSE channel, and (c) may replay events from a `Last-Event-ID` c...",
    "what_was_observed": "A tool-calling agent held an SSE session `sse-A` with `Last-Event-ID: 4471`. It had issued a `tools/call` for a long-running operation and was awaiting the result event. The server's upgrade negotiation returned a `Mcp-Session-Id: http-B` in the response header of the first StreamableHTTP `POST`, alongside a `200 OK` and a fresh SSE body. The client accepted `http-B`, discarded `sse-A`, and began reading from `http-B...",
    "condition_of_validity": "The invariant — *post-upgrade session state must be a continuation of pre-upgrade state* — is only enforceable when the client can observe three things at the moment of upgrade: 1. The pre-upgrade `(session_id, last_event_id)` tuple, captured before the upgrade `POST` is sent. 2. The post-upgrade `(session_id, last_event_id)` tuple, read from the upgrade res...",
    "decision_boundary": "The boundary is between two defensible policies, and the choice must be made explicitly at the client, not inferred from server behavior: - **Continuation policy:** the client requires that the upgrade response either (i) echo the same `Mcp-Session-Id`, or (ii) carry an explicit `replay-from` marker indicating the new session will replay from the client's pr...",
    "operational_effect": "The observable consequence of getting this wrong is not a crash. It is **divergent tool-execution history between the agent's context and the server's audit log**, which surfaces later as either a duplicate side effect (the agent believes it called `charge_card` once; the server charged twice) or a stalled request that the agent's outer loop eventually aband..."
  },
  "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": "f74f8434207a672765cdd58524f39947dcac83d45f4193655fcb773bff6343c2",
    "verified_classes": [
      "SessionForkError",
      "SessionTuple"
    ],
    "verified_functions": [
      "classify_upgrade",
      "apply_upgrade"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SessionForkError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
