{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-stream-continuity-when-an-mcp-http-native-transport-resumes-across-a-renegotiated-session",
  "title": "Why does an instance lose stream continuity when an MCP HTTP-native transport resumes across a renegotiated session",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers and clients using HTTP-native transport (SSE-over-POST / streamable HTTP) where a stream may be resumed via `Last-Event-ID` after a connection drop, session expiry, or transport renegotiation. Does not apply to stdio transports, or to HTTP transports that treat each request as a fully buffered, non-streaming RPC.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-stream-continuity-when-an-mcp-http-native-transport-resumes-across-a-renegotiated-session.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-stream-continuity-when-an-mcp-http-native-transport-resumes-across-a-renegotiated-session.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-stream-continuity-when-an-mcp-http-native-transport-resumes-across-a-renegotiated-session.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1795,
    "python_slice_tokens": 279,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Streams drop constantly and resumption is designed to handle that. The failure is that **resumption is negotiated against a session, but the event-ID namespace is scoped to the stream, and these two scopes are not the same object.** When the transport renegotiates a session (e.g., after `Mcp-Session-Id` expiry, a load...",
    "what_was_observed": "A client agent maintaining a long-running tool-execution stream (a `tools/call` that emits incremental progress notifications over SSE) lost its TCP connection mid-call. The client reconnected with: The server had, in the intervening ~40 seconds, been rescheduled by its orchestrator. The new instance accepted the same `Mcp-Session-Id` (session state was in a shared store, so the header validated) but the SSE stream c...",
    "condition_of_validity": "The failure requires all of the following to co-occur: - **Event IDs are assigned from a counter whose scope is narrower than the session's scope.** Per-process counters, per-worker counters behind a round-robin LB, or counters that reset on deploy all satisfy this. A counter that is durable and session-scoped (e.g., a monotonic sequence stored alongside ses...",
    "decision_boundary": "The boundary is: **does the server treat `Last-Event-ID` as a resume hint or as a resume contract?** - *Hint semantics* (what most implementations ship): the server does a best-effort lookup; on miss it starts from head. This is correct for a single-process, single-stream server and catastrophically wrong the moment the counter is shared or reset. - *Contrac...",
    "operational_effect": "When the invariant is violated, the observable signature is **a stream that resumes cleanly, delivers a contiguous sequence, and is nonetheless semantically discontinuous.** There is no error, no gap, no timeout—the worst class of failure, because every liveness signal reads green while the agent's checkpoint advances on data it never received. The downstrea..."
  },
  "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": "a110f3b84f1f98d7dbbaff737ca3d8c769051d53fd6611e324214a78e7180f38",
    "verified_classes": [
      "StreamResumeViolation",
      "ResumeCursor"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
