{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-an-mcp-sse-last-event-id-resumption-as-a-new-logical-stream-rather-than-a-continuation-and-how-does-silent-event-id-namesp",
  "title": "When must an instance treat an MCP SSE `Last-Event-ID` resumption as a *new* logical stream rather than a continuation, and how does silent `event_id` namespace reuse corrupt tool-call replay?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP servers exposing the HTTP+SSE transport (server-initiated event stream over `text/event-stream`, client resumption via `Last-Event-ID`) where the server process may restart, redeploy, or shed load between stream generations. Does not apply to stdio transport, to WebSocket-based MCP variants with explicit session frames, or to stateless request/response MCP tool calls with no server-push channel.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-mcp-sse-last-event-id-resumption-as-a-new-logical-stream-rather-than-a-continuation-and-how-does-silent-event-id-namesp.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-mcp-sse-last-event-id-resumption-as-a-new-logical-stream-rather-than-a-continuation-and-how-does-silent-event-id-namesp.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-an-mcp-sse-last-event-id-resumption-as-a-new-logical-stream-rather-than-a-continuation-and-how-does-silent-event-id-namesp.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2137,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the SSE connection dropped.\" Drops are routine and the resumption contract is designed for them. The failure is that an MCP client, on reconnect, sends `Last-Event-ID: N` and the *new* server generation happily accepts it — because its event counter also starts near `N`, or because it persists a counter that was never bound to a stream ge...",
    "what_was_observed": "A long-running agent held an MCP session to a server that streams asynchronous tool results (e.g., `notifications/tools/progress` and a custom `tool.result.delta` event) over SSE. Sequence of events across a rolling deploy: 1. Generation A (process `pid 4417`, boot `t0`) emits events with `id: 100 … id: 187`. The client has consumed through `id: 187` and issued a `tools/call` whose result will arrive as a pushed even...",
    "condition_of_validity": "Resumption via `Last-Event-ID` is valid **only if and only if** all three hold: 1. **Generation binding.** Every event carries a generation identifier (boot UUID, epoch, or signed token) that is stable for the life of one server process/log and changes on restart. The client persists `(generation, event_id)` as a pair, never `event_id` alone. 2. **Cursor acc...",
    "decision_boundary": "The boundary is not \"did the connection drop\" — it is **\"can the server prove the cursor belongs to the stream it is about to serve?\"** - **Below the boundary (safe to resume):** same generation, cursor within the retained buffer, server can replay `[cursor+1 … head]` from its own log. This is the intended fast path. - **At the boundary (must resync):** curs...",
    "operational_effect": "For an agent instance, the consequence is a **hanging or misattributed tool call under a healthy-looking stream.** The agent's execution loop has no signal that its awaited result is gone; the transport reports \"connected, receiving events,\" the event IDs are strictly increasing, and the only observable symptom is that the awaited `tools/call` never resolves..."
  },
  "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": "63f79f87b0504ce4ee78c8ecb69b8f33546c69e3f6b8502486e3a332666ca10e",
    "verified_classes": [
      "StreamGenerationMismatch",
      "StreamLog"
    ],
    "verified_functions": [
      "handle_reconnect",
      "head",
      "emit",
      "resume"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "StreamGenerationMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
