{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-resume-an-mcp-http-native-transport-stream-the-last-event-id-session-lifetime-invariant",
  "title": "When must an instance refuse to resume an MCP HTTP-native transport stream: the Last-Event-ID / session-lifetime invariant",
  "date_of_record": "2026 November 17",
  "scope": "Applies to MCP servers and clients using the HTTP-native (Streamable HTTP) transport with SSE stream resumption via `Last-Event-ID` and `Mcp-Session-Id`. Does not apply to stdio transport, nor to stateless HTTP deployments that never issue session IDs or event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-mcp-http-native-transport-stream-the-last-event-id-session-lifetime-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-mcp-http-native-transport-stream-the-last-event-id-session-lifetime-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-resume-an-mcp-http-native-transport-stream-the-last-event-id-session-lifetime-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1709,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two superficially similar operations that must never be conflated: 1. **Resumption** — the client presents a `Last-Event-ID` for a stream that the server *can* still replay from, because the server retained the event buffer and the session that owns it. 2. **Reconnection** — the client reconnects with a `Mcp-Session-Id` (and possibly a stale `Last-...",
    "what_was_observed": "In a deployment where the MCP server kept per-session event buffers in an LRU cache with a 30-second idle TTL while the session record itself lived for 30 minutes, the following sequence recurred: - A long-running tool invocation emitted events `e100` … `e140` on a POST-initiated SSE stream. - The client's connection dropped at `e118` due to a load-balancer idle timeout. - The client reconnected with `Last-Event-ID: ...",
    "condition_of_validity": "Resumption is valid if and only if all of the following hold at the moment of the request: - The `Mcp-Session-Id` maps to a session that is in an active (not terminated, not expired) state. - The presented `Last-Event-ID` is parseable and belongs to the event-ID sequence of *that* session's stream. Event IDs are per-stream/per-session scoped; an ID from a di...",
    "decision_boundary": "The decision table the server must implement: The subtle rule: a `404` on an expired session is safe because the client knows to start over and can re-issue the original request. A `400` on an evicted buffer is safe because the client knows the in-flight operation's stream is unrecoverable and can decide to retry the operation idempotently or surface the gap...",
    "operational_effect": "Consequences of getting this boundary wrong: - **Silent event loss presented as success.** The most dangerous outcome. Agents make decisions on an incomplete event history with no error signal. - **Duplicate side effects on naive retry.** If the client, on a correct `400`/`404`, blindly re-issues a non-idempotent tool call, the operation may run twice. The s..."
  },
  "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": "e95f41a9d48141562b353d3db50297bc0d1c335bc7b914dce628e369e3fac314",
    "verified_classes": [
      "StreamResumeError"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StreamResumeError"
    ],
    "sample_fail_closed_invariants": [
      "unknown or expired Mcp-Session-Id; re-initialize session",
      "event buffer evicted for resume point; gap cannot be guaranteed",
      "events exist after Last-Event-ID but were not retained",
      "retained events do not start at the requested resume point"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
