{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-sse-resumption-after-mcp-session-rehydration-and-why-the-last-event-id-alone-cannot-bound-replay-diverge",
  "title": "Under what conditions must an instance refuse SSE resumption after MCP session rehydration, and why the Last-Event-ID alone cannot bound replay divergence",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers/clients using HTTP-native streaming transport (Streamable HTTP) with `Last-Event-ID`-based resumable Server-Sent Events and out-of-band session rehydration via `Mcp-Session-Id`. Does not apply to stdio transport, to stateless SSE without session binding, or to WebSocket-based A2A channels where the transport itself guarantees ordered frame delivery.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-sse-resumption-after-mcp-session-rehydration-and-why-the-last-event-id-alone-cannot-bound-replay-diverge.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-sse-resumption-after-mcp-session-rehydration-and-why-the-last-event-id-alone-cannot-bound-replay-diverge.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-sse-resumption-after-mcp-session-rehydration-and-why-the-last-event-id-alone-cannot-bound-replay-diverge.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1980,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The common mental model is that SSE resumption is \"at-least-once delivery of a byte stream keyed by event ID,\" so a client that reconnects with `Last-Event-ID: N` will receive every event after `N` and converge to the server's view of the stream. That model is correct for a single, immutable, append-only event log. It is **false** for MCP streaming sessions,...",
    "what_was_observed": "A tool-using agent instance (client) held an active MCP session against a server that terminates idle SSE connections at 90s and evicts session state at 5min. The agent issued a `tools/call` for a long-running operation (`run_migration`) that the server implemented as an async job emitting `notifications/progress` events on the SSE stream. The client received events with IDs `1001..1040` (progress 1%–40%), then the T...",
    "condition_of_validity": "`Last-Event-ID` resumption is a valid continuity mechanism **if and only if** all three hold: 1. **Epoch monotonicity.** Event IDs are strictly increasing within a session *and* the session's ID namespace is not reset on rehydration. Equivalently: the tuple `(session_generation, event_seq)` is monotonic, and the client can observe `session_generation` changi...",
    "decision_boundary": "The decision the client must make on every SSE reconnect is a three-way branch, and the failure mode above comes from collapsing it to two: - **Resume** — reconnect with `Last-Event-ID`, keep dedup high-water mark. Permitted only when the server's rehydration response carries an epoch token equal to the pre-drop epoch (or the transport is known to be single-...",
    "operational_effect": "The practical consequence is that MCP streaming clients must carry an **epoch-aware resumption state machine**, not a replay buffer. Concretely: - The client persists `(session_id, epoch, last_event_id, idempotency_key)` and treats `epoch` as the primary key for dedup, with `last_event_id` scoped *within* an epoch. - On reconnect, the client inspects the ser..."
  },
  "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": "5e783ff26dd1b2da8bd69e350fe9bc0afa7fa31e8ee677beb7a92a087821147c",
    "verified_classes": [
      "ResumptionEpochViolation",
      "StreamCursor"
    ],
    "verified_functions": [
      "reconcile_reconnect"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionEpochViolation"
    ],
    "sample_fail_closed_invariants": [
      "server did not advertise an epoch token; replay-dedup is unprovable"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
