{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-tool-session-when-an-mcp-http-native-streamable-transport-upgrades-sse-to-a-resumable-stream-mid-negotiation",
  "title": "Why does an instance lose its tool session when an MCP HTTP-native streamable transport upgrades SSE to a resumable stream mid-negotiation",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP clients and servers using the HTTP-native streamable transport where an initial `GET` returns an SSE stream that is later upgraded to a resumable stream via a `Last-Event-ID`-bearing reconnect and a transport-negotiation handshake. Does not apply to pure stdio MCP transports or to stateless request/response-only HTTP bindings with no stream upgrade.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-session-when-an-mcp-http-native-streamable-transport-upgrades-sse-to-a-resumable-stream-mid-negotiation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-session-when-an-mcp-http-native-streamable-transport-upgrades-sse-to-a-resumable-stream-mid-negotiation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-session-when-an-mcp-http-native-streamable-transport-upgrades-sse-to-a-resumable-stream-mid-negotiation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1938,
    "python_slice_tokens": 319,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the SSE connection dropped.\" Dropped SSE connections are routine and recoverable. The failure is that the *upgrade negotiation itself* is treated by the client as a stateless reconnect while the server treats it as a stateful continuation. The two sides disagree about whether the session's stream position and its capability set are the sa...",
    "what_was_observed": "A representative trace from a failing run (session `sess-9f3a`, tool `db.query`): 1. Client opens `GET /mcp/session/sess-9f3a`, server replies `200 text/event-stream`, emits `id: 45` (`initialize` result with `capabilities.tools.listChanged=true`, `tools` schema v3), `id: 46` (`notifications/tools/list_changed`), `id: 47` (a `ping` keepalive). 2. Network path flaps. Client reconnects with `Last-Event-ID: 47` and head...",
    "condition_of_validity": "This failure is bounded by three conditions; it does not occur outside them: - **The transport is HTTP-native streamable with resumability enabled.** The server must honor `Last-Event-ID` and emit `id:` fields. If resumability is off (no IDs, plain SSE), there is no upgrade and no split. - **Capability negotiation is per-request, not per-session.** If the se...",
    "decision_boundary": "The architectural guardrail is a single rule: **the resumable cursor and the capability epoch must be versioned together.** Concretely, the server must bind a `capability_epoch` (monotonic integer) to the session and must either (a) refuse a `Last-Event-ID` reconnect whose request does not carry the matching epoch, or (b) re-emit a `capabilities` event at th...",
    "operational_effect": "The practical consequence is that resumable MCP streams are *not* transparently resumable. They resume the byte stream and lose the semantic session. For an agent runtime this manifests as: - **Tool schema drift mid-task.** A multi-step plan that cached tool schemas at step 1 executes step 4 against a v1 schema, producing argument validation failures that lo..."
  },
  "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": "9e3ea47895ad51fd1e6fc246af4f629d376310cc708e5f7ac6eb6f9b243df1bf",
    "verified_classes": [
      "CapabilityEpochMismatch",
      "UnknownStreamEventType"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CapabilityEpochMismatch",
      "UnknownStreamEventType"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
