{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-mcp-sse-stream-resumption-as-a-replay-hazard-rather-than-a-reconnect",
  "title": "When must an instance treat MCP SSE stream resumption as a replay hazard rather than a reconnect?",
  "date_of_record": "2026 November 23",
  "scope": "Applies to MCP clients using the HTTP-native transport with `text/event-stream` server-to-client streaming and `Last-Event-ID` based resumption, when a tool call's stream is interrupted and the client reconnects mid-execution. Does not apply to stdio transports or to stateless request/response MCP servers that never emit resumable event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-stream-resumption-as-a-replay-hazard-rather-than-a-reconnect.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-stream-resumption-as-a-replay-hazard-rather-than-a-reconnect.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-mcp-sse-stream-resumption-as-a-replay-hazard-rather-than-a-reconnect.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2096,
    "python_slice_tokens": 400,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A reconnect and a resumption look identical at the socket layer and are semantically opposite at the agent layer. A **reconnect** re-establishes a transport and expects *no* prior state to be re-delivered. A **resumption** asks the server to replay events from a cursor (`Last-Event-ID`) that the client believes is a *contiguous, exactly-once* log position. M...",
    "what_was_observed": "A tool call `analyze_repo` streamed incremental progress events with `id:` values `1, 2, 3, ...` assigned by a per-connection counter in the server's request handler. The stream was interrupted at event `id: 47` by an upstream proxy idle-timeout (the tool was silent for 90s while cloning a large repository — no heartbeat events were emitted, so the proxy closed the connection). The MCP client, per spec, reconnected w...",
    "condition_of_validity": "The invariant that must hold for `Last-Event-ID` resumption to be safe: > The pair `(session_id, event_id)` must identify a unique, immutable event, and the server must guarantee that a resumption request either (a) replays every event after the cursor exactly once in order, or (b) fails with a distinguishable error indicating the cursor is no longer service...",
    "decision_boundary": "The decision boundary is whether to **trust the resumption** or **escalate to a fresh invocation**. The rule: - **Trust resumption** only if the server advertises a durable log (e.g., an `X-MCP-Event-Log: durable` header or a `resume_supported: true` capability in the session-init response) *and* the resumed stream's first event ID is strictly greater than t...",
    "operational_effect": "The concrete effect on an agent chain is **silent result truncation or stale substitution**, both of which are indistinguishable from success at the agent's reasoning layer. The agent's next step consumes a partial or wrong tool output and compounds the error. Because no exception is raised, no retry logic fires, and the trace shows a clean tool call. The on..."
  },
  "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": "4fb98200c5c7b20390db948e3d16f760528c05247b2649246940390dee074625",
    "verified_classes": [
      "StreamResumptionViolation",
      "StreamCursor"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "StreamResumptionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
