{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-silently-desynchronize-its-tool-call-ledger-when-an-http-native-mcp-server-upgrades-a-stateless-stream-to-a-stateful-session-mid",
  "title": "Why does an instance silently desynchronize its tool-call ledger when an HTTP-native MCP server upgrades a stateless stream to a stateful session mid-response?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients that speak the streamable-HTTP transport (single `POST` endpoint returning `application/json` or `text/event-stream`, with optional `Mcp-Session-Id` header) and that multiplex several in-flight JSON-RPC requests over one connection. Does not apply to stdio transports, nor to servers that pin every request to a fresh stateless exchange with no session upgrade.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-desynchronize-its-tool-call-ledger-when-an-http-native-mcp-server-upgrades-a-stateless-stream-to-a-stateful-session-mid.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-desynchronize-its-tool-call-ledger-when-an-http-native-mcp-server-upgrades-a-stateless-stream-to-a-stateful-session-mid.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-desynchronize-its-tool-call-ledger-when-an-http-native-mcp-server-upgrades-a-stateless-stream-to-a-stateful-session-mid.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1776,
    "python_slice_tokens": 376,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the server dropped a response\" and not \"the client timed out.\" It is a **correlation-key collision across a transport-mode transition**. In stateless mode, a client can legitimately assign JSON-RPC `id` values from a per-request counter that resets, because each HTTP exchange is self-contained and the response is bound to the request by T...",
    "what_was_observed": "A client agent issued two tool calls in parallel against an MCP server (`tools/call` for `read_file` and `search_index`). Both were sent as separate `POST`s with `id: 1` and `id: 2`. The server had advertised `capabilities.session = true` and returned `Mcp-Session-Id: s_7f3a` on the `initialize` response. On the second `POST`, the server responded with `Content-Type: text/event-stream` and held the connection open, e...",
    "condition_of_validity": "This failure requires the conjunction of four conditions; remove any one and the mechanism does not fire: 1. **Conditional upgrade.** The server returns `application/json` for some requests and `text/event-stream` for others within the same session, so the client cannot statically assume one framing. Servers that *always* stream, or *never* stream, do not ex...",
    "decision_boundary": "The boundary is **where the client decides whether an in-flight request is \"done.\"** Two regimes: - **Stateless regime:** request completion is bound to HTTP exchange completion. A timeout means the exchange failed; re-issuing with a fresh `id` is safe because the old exchange's response, if it ever arrives, arrives on a *different* connection and is discard...",
    "operational_effect": "Downstream, the desync is *silent and compounding*. Because the JSON-RPC layer reports success (every response is valid), the agent's tool-result validation passes, and the poisoned result enters the reasoning loop as ground truth. Error compounding then proceeds at the rate of one bad premise per subsequent step: the agent writes against a stale snapshot, t..."
  },
  "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": "0e770e4eaea608be052a41cfef8a246bd7f7818825efa32f48c9029c7ab4b520",
    "verified_classes": [
      "LedgerDesyncError",
      "PendingFuture",
      "SessionLedger"
    ],
    "verified_functions": [
      "allocate_id",
      "on_response",
      "on_timeout"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "LedgerDesyncError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "itertools",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
