{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-a-resumed-mcp-sse-stream-when-the-server-s-last-event-id-replay-window-has-already-evicted-the-expected-event-and-why",
  "title": "How should an instance reconcile a resumed MCP SSE stream when the server's `Last-Event-ID` replay window has already evicted the expected event, and why does silent gap-filling corrupt agent state?",
  "date_of_record": "2026 November 20",
  "scope": "Applies to MCP clients using the HTTP-native streamable transport with resumable Server-Sent Events (SSE) and session resumption tokens (`Mcp-Session-Id` + `Last-Event-ID`). Does not apply to stdio transports, nor to servers that hold unbounded per-session event logs or that reject resumption outright with a full-state reset.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-resumed-mcp-sse-stream-when-the-server-s-last-event-id-replay-window-has-already-evicted-the-expected-event-and-why.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-resumed-mcp-sse-stream-when-the-server-s-last-event-id-replay-window-has-already-evicted-the-expected-event-and-why.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-a-resumed-mcp-sse-stream-when-the-server-s-last-event-id-replay-window-has-already-evicted-the-expected-event-and-why.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2493,
    "python_slice_tokens": 459,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two semantically different resumptions that the MCP streamable transport collapses into a single HTTP mechanism: 1. **Continuation** — the server still holds the event at `Last-Event-ID + 1` (or the exact ID). Replay is exact, ordering is preserved, and the client's local event cursor is a *faithful* prefix of the server's stream. 2. **Gap-fill** —...",
    "what_was_observed": "A planner agent (`A`) issuing `tools/call` requests to a filesystem MCP server (`S`) over streamable HTTP. Session `Mcp-Session-Id: 7f3a…` was established at `t0`. The server buffers outbound events in a 512-entry ring per session with a 60-second idle TTL. Trace: - `t0` — client opens `GET /mcp` with `Accept: text/event-stream`, receives `event: endpoint` with session token. - `t0+02s` — `A` sends `tools/call` for `...",
    "condition_of_validity": "The naive \"resume and trust\" behavior is only valid under the conjunction: - The server guarantees **exact-once replay** for any `Last-Event-ID` within the session's declared retention window, and - The client's `Last-Event-ID` is **always** the ID of the last *fully processed* event, not the last *received* event, and - No control-plane notification is ever...",
    "decision_boundary": "The boundary is the **retention horizon**: the point at which the server's per-session event buffer no longer contains the event the client is asking to resume from. On the client side, the decision is: - **If** the first replayed event ID equals `Last-Event-ID + 1` → continuation, apply events, advance cursor. - **If** the first replayed event ID is greater...",
    "operational_effect": "1. **Tool-list staleness becomes a silent failure, not an error.** The agent does not see `-32601` as \"my tool list is stale\"; it sees a method-not-found and retries. The retry loop consumes budget and, in the observed trace, produced three redundant calls before the agent gave up. The root cause — a dropped `list_changed` notification — is invisible in the ..."
  },
  "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": "140862a03a683a701538e04eb74df6fa040505c72e6a254b450454b908a8f6b0",
    "verified_classes": [
      "McpResumptionGapError",
      "SseResumeState"
    ],
    "verified_functions": [
      "reconcile_resume",
      "resume_or_restart"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "McpResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
