{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reject-a-resumed-mcp-stream-when-the-server-s-last-event-id-replay-window-has-already-been-compacted-the-silent-event-gap-invar",
  "title": "Where must an instance reject a resumed MCP stream when the server's `Last-Event-ID` replay window has already been compacted: the silent event-gap invariant in HTTP-native transport",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP clients that consume server-sent-event (SSE) streams over HTTP-native transport and attempt session resumption via `Last-Event-ID` after a transport drop, where the server maintains a bounded replay buffer. Does not apply to stdio transport, nor to servers that guarantee unbounded replay or require full session re-initialization on every reconnect.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-mcp-stream-when-the-server-s-last-event-id-replay-window-has-already-been-compacted-the-silent-event-gap-invar.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-mcp-stream-when-the-server-s-last-event-id-replay-window-has-already-been-compacted-the-silent-event-gap-invar.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-mcp-stream-when-the-server-s-last-event-id-replay-window-has-already-been-compacted-the-silent-event-gap-invar.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1954,
    "python_slice_tokens": 367,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways an SSE stream can \"resume,\" and they are not equivalent: 1. **Replay-contiguous resumption** — the client reconnects with `Last-Event-ID: N`, and the server replays every event `N+1, N+2, …` before switching to live tailing. The client's event sequence is gap-free. 2. **Cursor-acknowledged resumption** — the client reconnects with `Last-Ev...",
    "what_was_observed": "A client agent held a long-running MCP session against a server exposing a `run_pipeline` tool that emits progress notifications (`notifications/progress`) and a terminal `notifications/tools/result` event. Each event carried an `id:` field assigned by a monotonic counter persisted in the server's session record. Trigger sequence: 1. Client received event `id: 4102` (progress 62%). 2. Network partition for ~90s (NAT ...",
    "condition_of_validity": "The replay-contiguous invariant holds only under the conjunction: - **Server-side:** the replay buffer has not evicted any event with ID in `(last_event_id, current_head]` at the moment the resume request is processed. Equivalently: `buffer.min_id ≤ last_event_id + 1`. - **Transport-side:** the server, on inability to satisfy contiguity, MUST either (i) retu...",
    "decision_boundary": "The precise decision the client must make on the first event after a resume: The dangerous branch is `observed > expected`, because it is the branch where a naive client does the *wrong* thing silently: it accepts, advances its cursor, and loses the semantic content of the gap. The gap may contain the very terminal event the agent is blocked on. There is no ...",
    "operational_effect": "The observable consequence of violating this invariant is **phantom blocking followed by duplicate execution**: the agent's call future never resolves because its terminal event was in the evicted window, the call-level timeout fires, and the agent's retry policy re-invokes a non-idempotent tool. The server sees two `run_pipeline` invocations for one logical..."
  },
  "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": "768b31e2a4b467e4d9e2d8c6a2196e452b86d9f0b433e97ffe69401e974bdd47",
    "verified_classes": [
      "McpResumeGapError",
      "ResumeState"
    ],
    "verified_functions": [
      "validate_resume_seam",
      "resume_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "McpResumeGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
