{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-resume-an-mcp-streamable-session-against-a-replayed-sse-event-log-and-silently-double-apply-the-last-tool-call",
  "title": "Why does an instance resume an MCP streamable session against a replayed SSE event log and silently double-apply the last tool call?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients using the HTTP-native streamable transport (SSE server-push with `Last-Event-ID` resumption) when a session is re-established after transport interruption. Does not apply to stdio transports, nor to stateless HTTP request/response MCP servers that never emit resumable event streams.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-an-mcp-streamable-session-against-a-replayed-sse-event-log-and-silently-double-apply-the-last-tool-call.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-an-mcp-streamable-session-against-a-replayed-sse-event-log-and-silently-double-apply-the-last-tool-call.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resume-an-mcp-streamable-session-against-a-replayed-sse-event-log-and-silently-double-apply-the-last-tool-call.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2349,
    "python_slice_tokens": 642,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" Connections drop constantly and that is a solved problem. The distinction that matters is between **transport-level replay** and **semantic-level re-execution**. The MCP streamable transport contract says: on reconnect, the client sends `Last-Event-ID`, and the server replays every SSE event with an ID strictly gr...",
    "what_was_observed": "A research agent drove a long-running task across an MCP server exposing `append_to_notes`, `run_shell`, and `fetch_url`. The server used server-push SSE: it emitted `event: message` frames carrying JSON-RPC responses and notifications, each with a monotonically increasing `id:` field. The client persisted `last_event_id` to disk after each *received* frame. The trace: 1. Agent issues `tools/call` for `append_to_note...",
    "condition_of_validity": "The double-apply only occurs when all of the following hold simultaneously, which is why it is rare enough to escape testing but common enough to hit in production: - The server-push transport is used with resumable event IDs (SSE `id:` field present), and the server retains an event buffer (required for `Last-Event-ID` to return anything). - The client pers...",
    "decision_boundary": "The precise boundary is between two resume policies, and choosing wrong is the entire failure: - **Replay-as-redelivery (correct):** On resume, replayed events are fed through a *deduplicating* intake keyed on event ID. Any event whose ID is ≤ the highest ID already *semantically applied* (tracked in the durable action ledger, not just the transport cursor) ...",
    "operational_effect": "Downstream of a double-apply, the effects compound in ways that look like reasoning failures rather than transport failures, which is why they are misdiagnosed: - The agent's context now contains a *second* successful tool result for a call it believes happened once. Its belief state is internally consistent but factually wrong, so it will not self-correct —..."
  },
  "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": "960853398ae1a51b0aa98526da554d0bcb863924353a354cdcb23dc5894d7e64",
    "verified_classes": [
      "StreamResumptionViolation",
      "ActionLedger",
      "ReplayedEvent"
    ],
    "verified_functions": [
      "reconcile_resume",
      "resume_and_maybe_reissue",
      "commit",
      "already_applied"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "StreamResumptionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
