{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-its-mcp-tool-call-ledger-when-a-resumable-sse-session-is-upgraded-to-streamable-http-mid-stream",
  "title": "Why does an instance lose its MCP tool-call ledger when a resumable SSE session is upgraded to streamable HTTP mid-stream",
  "date_of_record": "2026 November 23",
  "scope": "Applies to MCP clients and servers that negotiate a resumable Server-Sent Events session (carrying `Last-Event-ID` for replay) and then upgrade the same logical session to the streamable HTTP transport while tool calls are in flight. Does not apply to pure SSE sessions that never upgrade, nor to stateless streamable-HTTP-only servers with no replay buffer.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-ledger-when-a-resumable-sse-session-is-upgraded-to-streamable-http-mid-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-ledger-when-a-resumable-sse-session-is-upgraded-to-streamable-http-mid-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-its-mcp-tool-call-ledger-when-a-resumable-sse-session-is-upgraded-to-streamable-http-mid-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2141,
    "python_slice_tokens": 446,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not a dropped connection. It is a **ledger discontinuity across a transport transition**: the SSE leg and the streamable-HTTP leg each maintain their own notion of which JSON-RPC messages the peer has acknowledged, and the upgrade handshake does not carry the acknowledgment cursor forward. The SSE leg tracks delivery by monotonic `id:` event s...",
    "what_was_observed": "An agent had issued three `tools/call` requests (`id` 41, 42, 43) over an SSE session. The server had emitted events for 41's result and 42's partial progress, with `id:` sequence numbers 118, 119, 120. Event 120 (42's result) had been written to the socket but the client's TCP read had not yet returned when the client decided to upgrade — a common trigger is the client's transport policy switching to streamable HTTP...",
    "condition_of_validity": "This failure requires all of the following to co-occur: - The session is **resumable** (server maintains a replay buffer keyed by `Last-Event-ID`), so the SSE leg has a durable cursor that the upgrade discards. - The upgrade occurs **while at least one `tools/call` is in flight** — i.e., a request has been sent but its result event has not been acknowledged ...",
    "decision_boundary": "The architectural guardrail is a **transport-independent request ledger** that lives above both transports and is keyed by a stable logical operation ID, not by the transport-level JSON-RPC `id`. Concretely: - Every `tools/call` is assigned a client-generated `operation_id` (UUID) that is carried in `params._meta` and is invariant across transport legs. - On...",
    "operational_effect": "When the invariant is violated, the observable effects are: - **Duplicate side effects** for non-idempotent tools, with no error surfaced to the agent — the agent's ledger shows two successful results for what it believes are two distinct operations. - **Orphaned operations**: a `tools/call` whose result was emitted on the abandoned SSE leg and never retriev..."
  },
  "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": "b60642ec86654b59374fa4ad2b8c23c955be57bd3e4a2dca1135c955db9595fe",
    "verified_classes": [
      "LedgerDiscontinuityError",
      "Transport",
      "OpState",
      "Operation",
      "RequestLedger"
    ],
    "verified_functions": [
      "dispatch",
      "acknowledge",
      "assert_upgrade_safe",
      "reconcile_on_upgrade"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "LedgerDiscontinuityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
