{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-resumption-gap-when-an-mcp-client-upgrades-from-sse-to-streamable-http-mid-stream",
  "title": "How does an instance detect a resumption gap when an MCP client upgrades from SSE to Streamable HTTP mid-stream?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers exposing both the legacy HTTP+SSE transport and the Streamable HTTP transport on the same endpoint family, where a client is permitted to negotiate an upgrade mid-session and expects to resume an in-flight tool-call stream via `Last-Event-ID`. Does not apply to pure stdio transport, nor to servers that force a hard session teardown on transport change.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-resumption-gap-when-an-mcp-client-upgrades-from-sse-to-streamable-http-mid-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-resumption-gap-when-an-mcp-client-upgrades-from-sse-to-streamable-http-mid-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-resumption-gap-when-an-mcp-client-upgrades-from-sse-to-streamable-http-mid-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1935,
    "python_slice_tokens": 317,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" It is that **the event-ID namespace is not shared across transports.** Under HTTP+SSE, event IDs are typically monotonic integers scoped to a single SSE response body. Under Streamable HTTP, the same logical stream may be re-served as chunked `text/event-stream` frames inside a POST response, with IDs regenerated ...",
    "what_was_observed": "A client running a multi-step tool loop opens `GET /mcp` as SSE and receives `event: message` frames with `id: 38`, `id: 39`, `id: 40`. The 40th frame is a `notifications/progress` for a long-running tool. The client's transport layer decides to upgrade: it opens `POST /mcp` with `Accept: application/json, text/event-stream` and `Mcp-Session-Id: <sid>` plus `Last-Event-ID: 40`, expecting to continue the same logical ...",
    "condition_of_validity": "The invariant that must hold for safe resumption across an SSE→Streamable-HTTP upgrade is: > For a given `Mcp-Session-Id`, the pair `(stream_id, event_id)` is globally unique and stable across transport transitions, and `Last-Event-ID` is only honored when the server can prove the referenced event belongs to the *same logical stream* the new request is resum...",
    "decision_boundary": "The operational decision is: **on upgrade, does the instance resume or restart?** The boundary is determined by whether the server can answer \"do I have event N of *this* stream?\" with a proof, not a guess. - If the server's resumption store is keyed by `(session, stream, seq)` and the upgrade request carries all three → **resume**. Replay events strictly af...",
    "operational_effect": "Without the invariant, the failure surfaces as **reasoning divergence with no transport-level symptom.** The agent's tool loop completes, the model emits a final answer, and the answer is wrong because one tool result was silently truncated or cross-wired. This is the worst class of agent failure: it is not a crash, not a timeout, not a 4xx — it is a confide..."
  },
  "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": "d9898eb19796fca2cc96403a94c7355ecf0cb55b21be440ced59a3b4435b44ca",
    "verified_classes": [
      "ResumptionGapError",
      "EventRef",
      "ResumptionLog"
    ],
    "verified_functions": [
      "resume_stream",
      "__init__",
      "append",
      "lookup"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
