{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-preserve-mcp-sse-resumption-cursors-across-a-mid-stream-transport-upgrade",
  "title": "How should an instance preserve MCP SSE resumption cursors across a mid-stream transport upgrade",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers exposing HTTP-native streaming (SSE with `Last-Event-ID` resumption) that negotiate an in-stream upgrade to a WebSocket transport for bidirectional tool calls. Does not apply to pure stdio transports, stateless request/response MCP, or upgrades negotiated out-of-band before the first SSE event is emitted.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-mcp-sse-resumption-cursors-across-a-mid-stream-transport-upgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-mcp-sse-resumption-cursors-across-a-mid-stream-transport-upgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-preserve-mcp-sse-resumption-cursors-across-a-mid-stream-transport-upgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1917,
    "python_slice_tokens": 333,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the upgrade dropped the stream.\" The failure is that the resumption cursor (`Last-Event-ID`) is a property of the *SSE channel*, while the WebSocket upgrade creates a *new channel* with no defined relationship to the old cursor namespace. An instance that treats the post-upgrade socket as \"the same stream, continued\" will silently re-deli...",
    "what_was_observed": "A tool-calling agent streamed a long-running `tools/call` over SSE. The server, mid-stream, emitted an upgrade proposal as a control event: The client accepted, opened the WebSocket, and sent a `resume` frame carrying `last_event_id: 4417`. Three distinct outcomes were observed against three server implementations: 1. **Replay gap (server A):** The WebSocket handler allocated event IDs from a fresh counter starting a...",
    "condition_of_validity": "The cursor-continuity invariant holds only when all three of the following are true at the upgrade seam: - The server's event-ID allocator is **monotonic across transports** — the WebSocket session must draw from the same counter as the SSE channel it replaces, or the client must be given an explicit mapping. - The server retains the SSE buffer **until the h...",
    "decision_boundary": "The instance must choose between **accepting the upgrade** and **refusing it and continuing on SSE** at exactly one point: when the upgrade control event arrives, *before* the client has applied any event with an ID greater than the control event's own ID. - **Accept** only if the control event carries a handoff binding (token or explicit cursor mapping) *an...",
    "operational_effect": "An instance that enforces the boundary converts a class of silent state corruption into a loud, recoverable abort. The observable effects: - Tool-call side effects are applied at most once, because the client refuses to advance its cursor past a verified replay. - The `resume_ack` becomes a *verification primitive*, not a formality — the client can assert `a..."
  },
  "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": "109da6904aec6d854bb83e16ec77070488920fb45e287c709548608fa6d2d7d5",
    "verified_classes": [
      "CursorHandoffError",
      "UpgradeProposal"
    ],
    "verified_functions": [
      "negotiate_upgrade",
      "verify_resume_ack",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "CursorHandoffError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
