{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-an-mcp-sse-stream-across-a-server-restart-last-event-id-resumption-and-the-silent-session-generation-mismatch",
  "title": "What happens when an instance replays an MCP SSE stream across a server restart: Last-Event-ID resumption and the silent session-generation mismatch",
  "date_of_record": "2026 November 21",
  "scope": "Applies to MCP clients using the HTTP-native transport (Streamable HTTP / SSE with `Last-Event-ID` resumption) where the server is a stateful agent runtime that can restart, redeploy, or evict sessions between SSE reconnects. Does not cover stdio transport, nor stateless request/response MCP servers where every call is self-contained.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-an-mcp-sse-stream-across-a-server-restart-last-event-id-resumption-and-the-silent-session-generation-mismatch.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-an-mcp-sse-stream-across-a-server-restart-last-event-id-resumption-and-the-silent-session-generation-mismatch.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-an-mcp-sse-stream-across-a-server-restart-last-event-id-resumption-and-the-silent-session-generation-mismatch.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2008,
    "python_slice_tokens": 407,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *transport-level resumption* and *session-level continuity*. MCP's HTTP transport gives the client a reconnection primitive: on a dropped SSE stream, the client reconnects with `Last-Event-ID: <n>` and the server is expected to replay events after `n`. This is a transport invariant — it guarantees \"no events lost on th...",
    "what_was_observed": "A tool-using agent held an MCP session against a server that maintained a per-session event log keyed by monotonically increasing event IDs, plus a server-side session object holding in-flight tool-call state (a long-running `build_index` operation tracked as `job_id=7f3a`). The server process was restarted by a deploy at event ID 412; the new process came up with an empty session table but a *persisted* event log (t...",
    "condition_of_validity": "The transport resumption guarantee is valid only under the invariant: > *For any event with ID `n` replayed after a reconnect, the session state that event was produced under is the same session state the client will operate under after resumption.* This invariant holds when (a) the event log and the session table share a lifecycle — both survive or both are...",
    "decision_boundary": "The boundary is: **does the reconnection path require proof of session liveness, or only proof of cursor validity?** If only cursor validity, the server will replay into a dead session and the client must defend itself. If session liveness is required, the reconnect either fails loudly (forcing a fresh session and a re-issued request) or succeeds with a sess...",
    "operational_effect": "Without the generation binding, the observable symptom is a class of silent wrong answers that no transport-level health check catches: SSE streams reconnect cleanly, event IDs are contiguous, latency is normal, and the agent completes tasks with stale or absent state. The blast radius is proportional to how much the agent's reasoning trusts tool-result *sha..."
  },
  "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": "662b6e93a7d80a1065ae73e7ec3dec6634d531e3badce8e15526e140ea20bee5",
    "verified_classes": [
      "StaleSessionResumeError",
      "EventCursor",
      "PendingOperation"
    ],
    "verified_functions": [
      "validate_resume",
      "correlate_tool_result"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "StaleSessionResumeError"
    ],
    "sample_fail_closed_invariants": [
      "no cursor and no live session; open fresh session"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
