{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-negotiates-an-sse-to-websocket-upgrade-mid-stream-under-mcp-http-native-transport-with-resumable-event-ids",
  "title": "What happens when an instance negotiates an SSE-to-WebSocket upgrade mid-stream under MCP HTTP-native transport with resumable event IDs",
  "date_of_record": "2026 November 10",
  "scope": "Applies to MCP servers implementing the HTTP-native transport where a client begins a Server-Sent Events (SSE) stream, supplies `Last-Event-ID` for resumption, and concurrently requests a WebSocket upgrade to the same logical session. Does not apply to stdio transport, nor to deployments where the upgrade is negotiated before the first SSE event is emitted.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-negotiates-an-sse-to-websocket-upgrade-mid-stream-under-mcp-http-native-transport-with-resumable-event-ids.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-negotiates-an-sse-to-websocket-upgrade-mid-stream-under-mcp-http-native-transport-with-resumable-event-ids.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-negotiates-an-sse-to-websocket-upgrade-mid-stream-under-mcp-http-native-transport-with-resumable-event-ids.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1341,
    "python_slice_tokens": 184,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP HTTP-native transport treats the SSE event ID as a *resumption cursor*, not a *delivery acknowledgment*. The WebSocket upgrade path treats the connection as a *fresh channel* whose first frame establishes a new ordering domain. These two semantics are individually correct and mutually incompatible at the seam. The boundary failure is not a lost messa...",
    "what_was_observed": "During a controlled failover test, a client opened `GET /mcp/session/{id}/events` and received events `eid: 41` through `eid: 47`. Mid-stream, it issued `GET /mcp/session/{id}/events` with `Upgrade: websocket` and `Last-Event-ID: 47`. The server accepted the upgrade with `101 Switching Protocols` but did **not** include the cursor in the handshake response headers. The first WebSocket frame carried a server notificat...",
    "condition_of_validity": "The resumable upgrade is valid **only** when all of the following hold: 1. The `101` response includes a header (e.g., `X-MCP-Resume-Cursor`) whose value equals the highest event ID the server has durably committed to the session's replay log *at the instant the upgrade is accepted*, not at the instant it was requested. 2. The server does not emit any WebSoc...",
    "decision_boundary": "The decision boundary is the **handshake commit point**: the moment the server writes `101 Switching Protocols`. Everything before it belongs to the SSE cursor domain; everything after belongs to the WebSocket frame domain. The server must make the cursor echo atomic with the `101` write. A common bug is computing the cursor *before* draining the replay buff...",
    "operational_effect": "In the observed deployment, the silent gap caused an agent orchestrator to miss four `notifications/tools/list_changed` events, leaving it with a stale tool registry for 38 minutes until an unrelated full reconnect. The registry divergence produced three failed tool invocations before detection. The fix was to add the cursor echo and a `cursor-ack` gate; pos..."
  },
  "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": "2c2e10f1a28d7f62bf64a34319efd857da8d9315b5f1ec7493f1559ed3374c48",
    "verified_classes": [
      "CursorDiscontinuityError"
    ],
    "verified_functions": [
      "negotiate_upgrade"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CursorDiscontinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
