{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-stream-with-a-stale-last-event-id-after-server-side-replay-window-eviction",
  "title": "What happens when an instance resumes an MCP stream with a stale `Last-Event-ID` after server-side replay-window eviction",
  "date_of_record": "2026 November 21",
  "scope": "Applies to MCP clients using HTTP-native transport with Server-Sent Events and `Last-Event-ID`-based stream resumption, where the server maintains a bounded per-session replay buffer. Does not apply to stdio transport or to SSE servers that persist the full event log indefinitely.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-with-a-stale-last-event-id-after-server-side-replay-window-eviction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-with-a-stale-last-event-id-after-server-side-replay-window-eviction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-with-a-stale-last-event-id-after-server-side-replay-window-eviction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1470,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct resumption failure classes, and conflating them produces the wrong recovery primitive: 1. **Session-token invalidation** — the `Mcp-Session-Id` is rejected (404/410), meaning the *session identity* is gone. Recovery requires re-initialization: a fresh `initialize` handshake, capability re-negotiation, and loss of all in-flight request ...",
    "what_was_observed": "A tool-orchestrating agent issued a long-running `tools/call` (a batch filesystem scan) over streamable HTTP. Mid-call, the client's network path reset; the SSE connection dropped after the server had emitted event `id: 412`. The client reconnected per spec, sending: The server's replay buffer held a ring of the most recent 128 events (IDs 390–517 at that moment). By the time the reconnect landed, the buffer had adva...",
    "condition_of_validity": "The silent-gap hazard holds only under the conjunction of: - **Bounded replay buffer** on the server (ring buffer, TTL-evicted, or size-capped). Unbounded logs make eviction impossible and the gap cannot occur. - **Progress/notification traffic during disconnect**, so the buffer advances past the client's cursor while the client is offline. A quiescent serve...",
    "decision_boundary": "The architectural invariant required to bound this hazard: > A resumed stream MUST be treated as *unverified* until the client confirms event-ID continuity, and any tool-call whose terminal event falls in an unconfirmed gap MUST be treated as **indeterminate**, never as failed-and-retryable. Concretely, the client must, on every resumption: 1. Compare the fi...",
    "operational_effect": "Without the continuity invariant, the agent exhibits **phantom-completion divergence**: its internal plan believes a tool call is still pending while the world has already advanced, and its recovery action (re-issue) is non-idempotent. The observable signature is a duplicate side effect with a single logical intent, correlated with a reconnect whose `Last-Ev..."
  },
  "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": "7f809701dc9917dd8886d756163e2b05c1e9ae64c071b57beea01b8589b8d446",
    "verified_classes": [
      "StreamGapDetected",
      "InFlightCall"
    ],
    "verified_functions": [
      "resume_stream",
      "maybe_retry",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StreamGapDetected"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
