{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-resume-an-mcp-http-native-streaming-session-after-a-partial-sse-to-websocket-upgrade",
  "title": "Where must an instance refuse to resume an MCP HTTP-native streaming session after a partial SSE-to-WebSocket upgrade",
  "date_of_record": "2026 November 9",
  "scope": "Applies to MCP servers exposing the HTTP-native transport with `Last-Event-ID`-based SSE resumption and an in-band upgrade negotiation to WebSocket. Does not apply to pure SSE transports without upgrade, nor to WebSocket-first transports where the session token is minted at handshake time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-resume-an-mcp-http-native-streaming-session-after-a-partial-sse-to-websocket-upgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-resume-an-mcp-http-native-streaming-session-after-a-partial-sse-to-websocket-upgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-resume-an-mcp-http-native-streaming-session-after-a-partial-sse-to-websocket-upgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1321,
    "python_slice_tokens": 264,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The critical distinction is between *event-id continuity* and *stream-identity continuity*. SSE resumption is defined purely in terms of the event ID: a client that reconnects with `Last-Event-ID: N` is entitled to receive all events with ID > N. The WebSocket upgrade negotiation, however, is defined in terms of a *stream identity* — a session-scoped duplex ...",
    "what_was_observed": "During fault-injection testing of an MCP server (HTTP-native transport, SSE with `Last-Event-ID`, `Sec-WebSocket-Protocol: mcp.v1` upgrade), we induced a client-side TCP reset 40–90 ms after the server wrote the `upgrade-accepted` SSE event but before the client's HTTP Upgrade request arrived. On reconnect, the client sent `Last-Event-ID: N` where N was the ID of `upgrade-accepted`. The server, following a naive resu...",
    "condition_of_validity": "The invariant holds only when the following three conditions are simultaneously true: 1. The server has *durably* emitted an `upgrade-accepted` event (it is in the event log and cannot be retracted). 2. The WebSocket handshake for that upgrade has not completed (no `Sec-WebSocket-Accept` has been written). 3. A resume request arrives carrying `Last-Event-ID`...",
    "decision_boundary": "An instance **must refuse to resume** and must instead terminate the session with a distinct, non-retryable error when in the (1)∧(2)∧(3) state. It must not: - silently return an idle SSE stream (deadlock, as observed); - mint a second `upgrade-accepted` for the same session token (dual-negotiation, as observed); - replay from `Last-Event-ID` as if the upgra...",
    "operational_effect": "Implementing the refusal converts a 300 s deadlock into a deterministic ~50 ms failure with a machine-readable cause. Clients that observe `session-superseded` must discard their `Last-Event-ID` cursor and renegotiate. The cost is that a transient network blip during a ~100 ms window forces a full session re-establishment, including re-authentication and rep..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "a56740b81ed2a42317c404f61f5e423e561204387a8cfa9458940341ace70c58",
    "verified_classes": [
      "SessionState",
      "NonResumableUpgradeBoundaryError",
      "Session"
    ],
    "verified_functions": [
      "resume_sse_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "NonResumableUpgradeBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
