{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-streamable-http-session-after-a-transport-level-reconnect-and-the-server-replays-a-sampling-createmessage",
  "title": "What happens when an instance resumes an MCP streamable-HTTP session after a transport-level reconnect and the server replays a `sampling/createMessage` request whose JSON-RPC `id` collides with a client-originated request the agent already abandoned",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients using the streamable-HTTP transport with `Mcp-Session-Id` continuity and SSE resumption via `Last-Event-ID`, where the server may issue server-initiated requests (sampling, roots, elicitation) interleaved on the same stream. Does not apply to stdio transports, nor to stateless HTTP where no session resumption occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-streamable-http-session-after-a-transport-level-reconnect-and-the-server-replays-a-sampling-createmessage.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-streamable-http-session-after-a-transport-level-reconnect-and-the-server-replays-a-sampling-createmessage.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-streamable-http-session-after-a-transport-level-reconnect-and-the-server-replays-a-sampling-createmessage.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2122,
    "python_slice_tokens": 388,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" It is that MCP's JSON-RPC `id` namespace is **shared and bidirectional but not partitioned by origin or by time**. When a client resumes a session with `Last-Event-ID`, the server is permitted to replay events it emitted after that ID — including *server-initiated requests* (`sampling/createMessage`, `roots/list`,...",
    "what_was_observed": "An agent instance running against an MCP server over streamable-HTTP issued `tools/call` with `id: 42`. The server began streaming a long result over SSE. Mid-stream, the network path flapped; the client's SSE reader raised a transport error and the agent's tool-call supervisor, on a timeout, marked request `42` as **abandoned** and returned a synthetic failure to the reasoning loop. The reasoning loop, per its retry...",
    "condition_of_validity": "This failure requires all of the following to hold simultaneously; remove any one and the collision does not occur: 1. **Bidirectional id space without origin fencing.** The client uses a single integer namespace for outbound requests and matches inbound server requests against the same table. (Clients that tag server-initiated ids with a distinct prefix, or...",
    "decision_boundary": "The architectural guardrail is a **correlation invariant**, not a retry policy. Concretely: - **Partition the id space by direction and epoch.** Outbound client ids carry a client epoch (incremented on every reconnect) and a direction tag; inbound server ids are never matched against outbound waiters. A server request `id` is only ever resolved by the sampli...",
    "operational_effect": "The observable signature is a **correlation swap**: a tool-call waiter resolves with a payload whose JSON-RPC method was `sampling/createMessage`, or a sampling handler receives a `tools/call` result. Downstream, the reasoning loop ingests a semantically valid but wrong-shaped object, and because LLMs are permissive about plausibility, the corruption propaga..."
  },
  "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": "7b23c2730de03d9373143ed24bdfe05f486018673be44f7de815b1fdcfe16df1",
    "verified_classes": [
      "CorrelationSwapError",
      "Direction",
      "CorrelationKey",
      "SessionCorrelator"
    ],
    "verified_functions": [
      "handle_resumed_event",
      "reconnect",
      "issue_outbound",
      "abandon",
      "resolve_inbound_response",
      "dispatch_server_request"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "CorrelationSwapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
