{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-half-resumed-mcp-stream-the-sse-last-event-id-replay-gap-that-silently-duplicates-tool-side-effects",
  "title": "What structural signals indicate a half-resumed MCP stream: the SSE `Last-Event-ID` replay gap that silently duplicates tool side-effects",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers and clients using the HTTP-native transport where a single logical session is delivered as a Server-Sent Events (SSE) stream carrying JSON-RPC messages, and where the client resumes a dropped stream by sending `Last-Event-ID`. Does not cover stdio transport, WebSocket transport, or request/response-only MCP servers with no server-initiated message channel.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-resumed-mcp-stream-the-sse-last-event-id-replay-gap-that-silently-duplicates-tool-side-effects.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-resumed-mcp-stream-the-sse-last-event-id-replay-gap-that-silently-duplicates-tool-side-effects.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-resumed-mcp-stream-the-sse-last-event-id-replay-gap-that-silently-duplicates-tool-side-effects.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2344,
    "python_slice_tokens": 427,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"resumed\" in an MCP SSE session, and conflating them is the failure: 1. **Transport resumption** — the TCP/HTTP connection is re-established and the server begins emitting events again from some `event: id` cursor. 2. **Session continuity** — the logical MCP session's request/response pairing, in-flight tool-call accounting,...",
    "what_was_observed": "A coding agent holds an MCP session against a filesystem/tool server. It issues `tools/call` for `write_file` with a large payload. The server accepts the call, begins streaming a `progress` notification sequence (event IDs 101–140), and is about to emit the final `result` (event ID 141) when the client's network drops for ~40 seconds (mobile tethering flap, load-balancer idle timeout, or a proxy `read_timeout`). The...",
    "condition_of_validity": "The gap-detection rule below is valid only when all of the following hold: - The server assigns monotonically increasing, gap-free integer event IDs per session (not per-connection, not per-worker). If IDs are per-connection or reset on reconnect, contiguity is unprovable and this entire analysis does not apply — you must instead rely on request-level idempo...",
    "decision_boundary": "The client must decide, on every SSE reconnect, whether to **trust the resume** or **force a session re-sync** (re-issue `initialize`/`tools/list`, replay outstanding requests with idempotency keys, discard any in-flight state). The boundary is drawn by comparing the first replayed event ID against the expected continuation: - Let `L` = last event ID the cli...",
    "operational_effect": "Concretely, for an agent runtime: - **Duplicate side-effects** are the dominant failure. `write_file`, `send_email`, `execute_sql`, `git push` issued during the disconnect window and retried on half-resume execute twice. The agent's reasoning trace shows one call; the world shows two effects. This is silent — no exception, no error code, just a doubled effec..."
  },
  "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": "f61bf347e80c4872dc779209375ca10702e8f3150acc7d790fe2df34f008a747",
    "verified_classes": [
      "MCPStreamResumeError",
      "ResumeState"
    ],
    "verified_functions": [
      "classify_resume",
      "handle_reconnect"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "MCPStreamResumeError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
