{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-tool-call-ledger-when-an-mcp-stream-reconnects-mid-tool-execution",
  "title": "Why does an instance lose its tool-call ledger when an MCP stream reconnects mid-tool-execution?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP servers exposing HTTP-native transport (SSE-based `text/event-stream` responses with `Last-Event-ID` resumption) where a single logical session spans multiple HTTP requests and tool invocations. Does not apply to stdio transports, stateless one-shot request/response MCP deployments, or WebSocket transports with their own framing-level resumption.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-call-ledger-when-an-mcp-stream-reconnects-mid-tool-execution.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-call-ledger-when-an-mcp-stream-reconnects-mid-tool-execution.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-tool-call-ledger-when-an-mcp-stream-reconnects-mid-tool-execution.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2092,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the stream dropped.\" Streams drop constantly and the `Last-Event-ID` resumption contract is designed for exactly that. The failure is a **ledger divergence between the client's replay cursor and the server's side-effect cursor**. MCP's resumable HTTP transport guarantees *message* replay from a given event ID, but it does not guarantee—an...",
    "what_was_observed": "A concrete trace from an agent runtime using an MCP server over HTTP/SSE with a 30-second idle timeout on the load balancer in front of it: 1. Server assigns event `evt_1042` to a `tools/call` request for `write_file(path=\"/tmp/out.json\", content=...)`. Sends it, appends to replay buffer. 2. Client receives `evt_1042`, executes the tool, produces a result, begins POSTing the `tools/call` result to the server's `/mess...",
    "condition_of_validity": "The resumption contract is only sound under the conjunction of three conditions, and the transport spec does not enforce any of them: - **Condition A — Durable client-side execution ledger keyed by event ID.** The client must persist `(event_id → execution_status)` across connection boundaries, not just across process memory. If the ledger is in-memory and t...",
    "decision_boundary": "The boundary is **whether the client's replay cursor is durable and whether the server's result acceptance is idempotent**. The decision to make at design time: - If the MCP server's replay buffer is bounded (typical: last N events, N = 100–1000), resumption beyond the buffer window forces a full session restart, which discards the ledger entirely. The bound...",
    "operational_effect": "The practical consequence is that MCP HTTP-native transport with resumption is **safe for read-only tools and unsafe for mutating tools unless the client implements a durable event-ID ledger and the server implements result deduplication**. Most implementations do neither, because the spec's resumption section describes message replay and is silent on side-e..."
  },
  "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": "acf7665c45f8a5785c80f4a01997367c23eeec86ce2a828c8b05cf4c918a07a0",
    "verified_classes": [
      "ReplayLedgerDivergence",
      "ToolCallLedger"
    ],
    "verified_functions": [
      "handle_replayed_event",
      "__init__",
      "status",
      "record_executed",
      "record_result_committed"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplayLedgerDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
