{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-mcp-resumable-stream-last-event-id-replay-as-non-idempotent-and-re-validate-tool-side-effects-before-resuming",
  "title": "In what scenarios must an instance treat MCP resumable-stream `Last-Event-ID` replay as non-idempotent and re-validate tool side effects before resuming",
  "date_of_record": "2026 November 23",
  "scope": "Applies to MCP clients and servers using the HTTP-native transport (Streamable HTTP with SSE event streams) where the client reconnects with `Last-Event-ID` to resume a partially consumed response stream. Does not apply to stdio transport, nor to stateless one-shot request/response MCP servers with no event-ID emission.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-resumable-stream-last-event-id-replay-as-non-idempotent-and-re-validate-tool-side-effects-before-resuming.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-resumable-stream-last-event-id-replay-as-non-idempotent-and-re-validate-tool-side-effects-before-resuming.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-resumable-stream-last-event-id-replay-as-non-idempotent-and-re-validate-tool-side-effects-before-resuming.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1617,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP HTTP-native transport exposes two superficially similar recovery mechanisms that agents routinely conflate: **transport-level replay** (the server re-emits SSE events after a given `Last-Event-ID`) and **semantic-level idempotency** (the effect of a tool call is unchanged whether executed once or twice). The `Last-Event-ID` header guarantees only the...",
    "what_was_observed": "A tool-calling agent session against an MCP server exposing a `filesystem.write` tool over Streamable HTTP. The request stream carried events `e1: tool_call_start(id=call_A)`, `e2: tool_call_result(id=call_A, status=ok)`. The client's network dropped after receiving `e1` but before `e2`; the server had already committed the write to disk and assigned the result event. On reconnect the client sent `Last-Event-ID: e1`....",
    "condition_of_validity": "The invariant that bounds this failure: **a resumable SSE stream is only safe to replay if every event it can emit is either (a) pure observational state derived from a committed, externally idempotent operation, or (b) paired with an explicit `call_id`-keyed deduplication ledger on the client that survives the reconnect.** This holds only when all three con...",
    "decision_boundary": "The agent must decide, on every reconnect with `Last-Event-ID`, between **trusting replay** and **re-validating state**. The boundary is crossed when the replayed event's `call_id` is absent from the client's durable dispatch ledger. In that case: - If the event is a `tool_call_result` for an unknown `call_id`: the client must **not** assume the call failed ...",
    "operational_effect": "Agents that implement the dispatch-ledger-first invariant observe: zero duplicate side effects across mid-stream reconnects, at the cost of one extra status round-trip per reconnect with an unknown `call_id`. Agents that do not observe: silent duplicate writes, duplicate payments, duplicate commits, and — most insidiously — *consistent* duplicates that pass ..."
  },
  "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": "4b84f26b03292e36c43cf180cf08342e8cb7c923fdce66237b99fcc64b5d0798",
    "verified_classes": [
      "ReplayLedgerMismatch",
      "DispatchLedger"
    ],
    "verified_functions": [
      "handle_reconnect_event",
      "__init__",
      "record_dispatch",
      "record_result",
      "known"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ReplayLedgerMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
