{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-mcp-stream-continuity-when-a-resumable-session-handshake-renegotiates-mid-stream",
  "title": "Why does an instance lose MCP stream continuity when a resumable session handshake renegotiates mid-stream",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP servers and clients using HTTP-native streaming transports (SSE-over-HTTP, chunked `text/event-stream`, or streamable-HTTP MCP) that advertise resumable sessions via `Last-Event-ID` / session-resume tokens. Does not apply to stdio transports, WebSocket-only MCP, or non-resumable one-shot request/response MCP calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-mcp-stream-continuity-when-a-resumable-session-handshake-renegotiates-mid-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-mcp-stream-continuity-when-a-resumable-session-handshake-renegotiates-mid-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-mcp-stream-continuity-when-a-resumable-session-handshake-renegotiates-mid-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1941,
    "python_slice_tokens": 330,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Transport drops are expected and are exactly what resumability exists to absorb. The failure is that a **resume handshake re-establishes the session at a different logical stream epoch than the one the client's `Last-Event-ID` refers to**, and the client cannot distinguish \"events 41–58 were never emitted\" from \"event...",
    "what_was_observed": "A client agent held an open streamable-HTTP MCP session against a tool server. The server emitted SSE frames with monotonically increasing `id:` values scoped per session. At event `id: 40` the client's TCP connection was cut by a load-balancer idle timeout (a routine 60s reset). The client reconnected per spec, sending the resume request with header `Last-Event-ID: 40` and its stored `Mcp-Session-Id`. The server's r...",
    "condition_of_validity": "This analysis holds only when all of the following are true: 1. The transport is HTTP-native with SSE-style event IDs and the server advertises resumability (an `Mcp-Session-Id` or equivalent resume token plus `Last-Event-ID` support). 2. Event IDs are generated by a server-side emitter whose counter/lifetime is *not* strictly bound to the session lifetime —...",
    "decision_boundary": "The architectural guardrail is a **two-part check at the resume boundary**, and the decision hinges on whether the server can prove continuity: - On resume, the server MUST resolve `(session_id, last_event_id)` to a specific emitter epoch. If the current emitter's epoch ≠ the epoch that produced `last_event_id`, the server MUST NOT resume. It must return an ...",
    "operational_effect": "When this boundary is violated, the failure is *semantically silent* — the worst class for an agent, because the agent's reasoning loop continues and compounds the error. The agent does not see a transport error; it sees a plausible event stream with a hole in it, and finite context plus probabilistic reasoning means it will confabulate the missing link rath..."
  },
  "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": "3b5f4f059181a1df1e901806e4f3e51ec4f9e4689eb3c2358c125e9e67229d70",
    "verified_classes": [
      "StreamEpochMismatch"
    ],
    "verified_functions": [
      "resume_stream",
      "client_consume"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamEpochMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
