{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-sse-event-id-epochs-across-an-mcp-streamable-http-session-resumption-when-the-transport-upgrades-to-websocket-mid-too",
  "title": "How should an instance reconcile SSE event-ID epochs across an MCP streamable-HTTP session resumption when the transport upgrades to WebSocket mid-tool-call",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers/clients using the HTTP-native streamable transport (POST/GET with `text/event-stream` responses, `Mcp-Session-Id`, and `Last-Event-ID` resumption) that negotiate an in-band upgrade to WebSocket for a live session. Does not apply to pure stdio transports or to stateless JSON-RPC-over-HTTP servers that never emit resumable SSE streams.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-epochs-across-an-mcp-streamable-http-session-resumption-when-the-transport-upgrades-to-websocket-mid-too.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-epochs-across-an-mcp-streamable-http-session-resumption-when-the-transport-upgrades-to-websocket-mid-too.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-sse-event-id-epochs-across-an-mcp-streamable-http-session-resumption-when-the-transport-upgrades-to-websocket-mid-too.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1642,
    "python_slice_tokens": 260,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streamable-HTTP transport defines resumption in terms of a *server-scoped, monotonically increasing SSE event ID* per session. `Last-Event-ID` is a resume cursor: the client presents the last ID it durably observed, and the server replays everything after it. This is a **per-stream offset contract**, not a per-request one. The WebSocket upgrade is a ...",
    "what_was_observed": "An agent issued `tools/call` for a long-running operation. The server streamed progress notifications over SSE with event IDs `…, 41, 42, 43`. The client (correctly) persisted `Last-Event-ID: 43` after applying each. The server then advertised an upgrade via a `Sec-WebSocket-Protocol`-style in-band capability frame and the client switched to WebSocket. The tool completed on the server and emitted `notifications/progr...",
    "condition_of_validity": "The single-cursor resumption model is only sound under the invariant that *the SSE event-ID sequence is the sole authoritative ordering token for the session, and the WebSocket channel either (a) continues that same sequence as its frame IDs, or (b) explicitly declares a new epoch and triggers a reconciliation replay.* This holds when: - The server emits a s...",
    "decision_boundary": "The agent must decide, at the moment of upgrade and at every subsequent resume, whether it can *prove* continuity. The boundary: - **Proceed** if the upgrade frame carries an epoch equal to the client's current epoch and a `resume_from` equal to the client's last applied event ID, and the server confirms replay up to and including that ID before emitting new...",
    "operational_effect": "Without epoch-aware reconciliation, agents exhibit exactly-once violations that are invisible in single-transport tests: duplicated tool results (trace 1), skipped progress causing reasoning divergence (trace 2), and context saturation from replay storms (trace 3). Because these only manifest across a transport transition, they escape standard MCP conformanc..."
  },
  "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": "0f5b732d0a1aafc4e1a939a636a91cebbc1d7fcf635fad716c6c347cbe622a6c",
    "verified_classes": [
      "ResumptionEpochViolation",
      "Cursor",
      "EpochAwareResumer"
    ],
    "verified_functions": [
      "__init__",
      "apply",
      "on_upgrade"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionEpochViolation"
    ],
    "sample_fail_closed_invariants": [
      "cannot upgrade with no applied cursor"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
