{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-replayable-sse-stream-state-from-non-replayable-websocket-frame-state-during-mcp-session-migration",
  "title": "How should an instance distinguish replayable SSE stream state from non-replayable WebSocket frame state during MCP session migration",
  "date_of_record": "2026 November 13",
  "scope": "Applies to MCP servers exposing the HTTP-native streaming transport that support resumable SSE sessions (via `Last-Event-ID`) and that accept an in-flight migration of a session onto a WebSocket transport. Does not apply to pure-SSE deployments that never upgrade, nor to WebSocket-only servers where no prior event ID namespace exists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replayable-sse-stream-state-from-non-replayable-websocket-frame-state-during-mcp-session-migration.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replayable-sse-stream-state-from-non-replayable-websocket-frame-state-during-mcp-session-migration.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-replayable-sse-stream-state-from-non-replayable-websocket-frame-state-during-mcp-session-migration.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1405,
    "python_slice_tokens": 206,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streaming transport exposes two different notions of \"resumability\" that are conceptually orthogonal but share an identifier namespace in most implementations. An SSE stream is *replayable*: the server retains a bounded buffer of emitted events keyed by monotonically increasing event IDs, and a client reconnecting with `Last-Event-ID: N` receives eve...",
    "what_was_observed": "In a reproduction against an MCP server (transport spec revision supporting `Last-Event-ID` resumption and a `POST /session/{id}/upgrade` WebSocket migration endpoint), the following sequence produced a silent gap: 1. Client opens SSE, receives events `id=1..10`, sends `Last-Event-ID: 10` on a transient reconnect. 2. Server emits events `id=11,12,13` into the SSE ring buffer while the client is mid-reconnect (client ...",
    "condition_of_validity": "The gap manifests only when all of the following hold: - The server maintains an SSE replay buffer and honors `Last-Event-ID`. - The upgrade to WebSocket is accepted without a mandatory application-level handshake that transfers the client's true processed-cursor. - Events are emitted between the client's last ack and the upgrade request (i.e., the session i...",
    "decision_boundary": "The correct operational rule: **the SSE `Last-Event-ID` is a replay cursor, not a delivery guarantee.** Before completing a WebSocket migration, the server must either (a) replay all buffered events with ID > `last_ack_id` over the WebSocket as the first frames, or (b) refuse the upgrade with a `409 Conflict` if the buffer cannot cover the gap, forcing the c...",
    "operational_effect": "Teams that hit this report \"missing tool-call results after reconnect\" or \"the agent's conversation state desynchronized after a network blip\" — symptoms that look like LLM nondeterminism or client bugs, not transport bugs, because no error surfaces. The failure is silent, order-preserving (no duplicates, no reordering, just a hole), and only reproducible un..."
  },
  "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": "c6fcffe6a669165e28ecc83998f9c1e57d823f5b890d9d05aa37c2a1c5d2901b",
    "verified_classes": [
      "SessionMigrationGapError",
      "McpSession"
    ],
    "verified_functions": [
      "__init__",
      "migrate_to_websocket"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SessionMigrationGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
