{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-resume-an-sse-stream-after-migrating-to-streamable-http-the-last-event-id-replay-window-invariant",
  "title": "When must an instance refuse to resume an SSE stream after migrating to Streamable HTTP: the Last-Event-ID replay window invariant",
  "date_of_record": "2026 November 29",
  "scope": "Applies to MCP servers that expose both the legacy HTTP+SSE transport (`GET /sse` + `POST /messages`) and the Streamable HTTP transport (`POST /mcp` with `Mcp-Session-Id`), and to clients that attempt to carry an in-flight SSE session across that boundary using `Last-Event-ID` and `Mcp-Session-Id` continuity. Does not apply to pure stdio transports or to servers that never emit resumable event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-sse-stream-after-migrating-to-streamable-http-the-last-event-id-replay-window-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-sse-stream-after-migrating-to-streamable-http-the-last-event-id-replay-window-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-sse-stream-after-migrating-to-streamable-http-the-last-event-id-replay-window-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1895,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Dropped streams are routine and the SSE spec's `Last-Event-ID` resumption mechanism exists precisely for them. The failure is a **category error at the transport boundary**: a client treats `Last-Event-ID` as a session-scoped cursor that survives a change of transport, when in the Streamable HTTP transport the event I...",
    "what_was_observed": "A long-running agent tool-call loop (a \"fetch-and-summarize\" task spanning ~40 tool invocations) was executing over `GET /sse`. The server emitted events with IDs of the form `sse-<monotonic-int>`. At event `sse-1841` the underlying connection was severed by a load balancer idle timeout (60s, no keepalive configured). The client had been configured with a migration policy: on SSE failure, attempt Streamable HTTP with...",
    "condition_of_validity": "The resumption is valid **iff** the event-ID space is shared and monotonic across the transport transition, or the server explicitly signals a non-resumable gap. Formally, let `E_old` be the ordered event log of the SSE session and `E_new` that of the Streamable HTTP session. A resume with cursor `c` is sound iff there exists a total order `≺` over `E_old ∪ ...",
    "decision_boundary": "The agent-side decision boundary is crisp: **on any transport migration, treat `Last-Event-ID` as untrusted until the server proves the cursor is live in the new session's log.** Concretely, before resuming the task loop, the agent must confirm one of: - the server returned a non-empty replay whose first event ID equals `lastEventId + 1` (contiguous), or - t...",
    "operational_effect": "Without this invariant, agents exhibit a specific and reproducible pathology: **silent state divergence at transport boundaries**, manifesting as hallucinated tool outputs. The agent's reasoning loop is sound given its (corrupted) belief state; the corruption happened at the transport layer and was laundered through a `200 OK`. Because the failure is silent,..."
  },
  "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": "9beb89b3b1c021f7f3f501f8bb8ba720ae83df3e2143e4598ac9aeb4f9b36e0e",
    "verified_classes": [
      "ResumabilityLost",
      "EventLog"
    ],
    "verified_functions": [
      "resume_stream",
      "migrate_and_resume",
      "can_resume"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumabilityLost"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
