{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-sse-stream-with-a-stale-last-event-id-after-the-server-has-already-garbage-collected-the-event-ring-buffe",
  "title": "What happens when an instance resumes an MCP SSE stream with a stale `Last-Event-ID` after the server has already garbage-collected the event ring buffer",
  "date_of_record": "2026 November 29",
  "scope": "Applies to MCP servers exposing the HTTP-native streamable transport (POST for JSON-RPC requests, GET for the SSE event stream) with `Last-Event-ID`-based resumability and `Mcp-Session-Id` session resumption. Does not apply to stdio transports, nor to SSE streams where the server replays from durable storage keyed by monotonic event ID with no eviction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-with-a-stale-last-event-id-after-the-server-has-already-garbage-collected-the-event-ring-buffe.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-with-a-stale-last-event-id-after-the-server-has-already-garbage-collected-the-event-ring-buffe.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-with-a-stale-last-event-id-after-the-server-has-already-garbage-collected-the-event-ring-buffe.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2073,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *session validity* and *event-log continuity*. The `Mcp-Session-Id` header answers \"does this logical session still exist?\" The `Last-Event-ID` header answers \"can I resume the byte stream at exactly event N+1?\" These are two independent axes, and the MCP spec treats them as separable — a server may return `200 OK` wit...",
    "what_was_observed": "An agent worker maintains a long-lived GET SSE stream to an MCP server (`text/event-stream`). On each disconnect (network blip, load-balancer idle timeout at 60s, or server pod restart), the client reconnects with `Last-Event-ID: <last-seen-id>` and the same `Mcp-Session-Id`. The server keeps a per-session in-memory ring buffer of the last N=256 emitted events to serve replays. Under normal load this works. The bound...",
    "condition_of_validity": "The invariant that must hold for resumability to be safe is: > For every `Last-Event-ID: K` the client presents, the server either (a) retains event K and all subsequent events, or (b) explicitly signals that resumption is impossible so the client can perform full-state reconciliation. The failure arises precisely when the server satisfies (a) for the sessio...",
    "decision_boundary": "The boundary is drawn at the point where the client must decide: *trust the resumed stream, or treat the session as logically broken and re-synchronize state from scratch?* The decision hinges on information the transport does not carry by default. The operational rule: - If the reconnecting client can observe that the first event ID received after reconnect...",
    "operational_effect": "In practice, the effect is a class of *silent* agent failures that look like reasoning bugs. The agent appears to \"forget\" a tool result, or \"re-run\" a tool it already ran. Root cause is the forked stream. Downstream effects compound: a duplicated `tools/call` with side effects (file write, payment, external API mutation) violates exactly-once semantics; a d..."
  },
  "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": "46b8f9c828e479b00f61c45cbd03829a20dc7cf7932b07fbb04bb0fbbc08448f",
    "verified_classes": [
      "StreamResumeGapError",
      "SSEResumeCursor"
    ],
    "verified_functions": [
      "resume_stream",
      "issue_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeGapError"
    ],
    "sample_fail_closed_invariants": [
      "server opened stream but sent no event; cannot confirm continuity"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
