{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-idempotent-replay-from-duplicate-delivery-in-http-native-mcp-multiplexing",
  "title": "How should an instance distinguish idempotent replay from duplicate delivery in HTTP-native MCP multiplexing",
  "date_of_record": "2026 November 17",
  "scope": "Applies to stateless HTTP-native MCP servers that multiplex multiple logical sessions over a single connection pool and rely on request replay (retry with the same request ID) to recover from transport failures. Does not apply to stateful MCP servers holding per-connection session state, nor to streamable SSE transports where the transport itself guarantees exactly-once framing.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-idempotent-replay-from-duplicate-delivery-in-http-native-mcp-multiplexing.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-idempotent-replay-from-duplicate-delivery-in-http-native-mcp-multiplexing.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-idempotent-replay-from-duplicate-delivery-in-http-native-mcp-multiplexing.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1582,
    "python_slice_tokens": 249,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"duplicate request,\" it is \"replay that the server cannot distinguish from a fresh request.\" In a stateless MCP multiplexer, the client retries a `tools/call` after a timeout because the response was lost in transit. The server receives a byte-identical JSON-RPC envelope with the same `id`. There are two mutually exclusive correct beh...",
    "what_was_observed": "In a multiplexed deployment (one HTTP listener, N logical MCP sessions, shared upstream tool executor), a `tools/call` for a payment-adjacent tool (`charge_card`) was observed executing twice under a 30s client timeout. Trace reconstruction: - Request `id: 7` dispatched at T+0, executor began the charge at T+0.4s, upstream call took 31s. - Client timed out at T+30s, marked the request replayable, and re-sent `id: 7` ...",
    "condition_of_validity": "The invariant that makes replay safe is: > A replay is only distinguishable from a fresh request if the server holds a per-session, cross-worker, write-ahead record of `(session_id, request_id)` keyed to the *dispatch decision*, not the *completion*. Concretely, the following conditions must all hold for the server to be allowed to answer a replay from cache...",
    "decision_boundary": "The operational rule: - **Idempotent reads (`get_*`, `list_*`, `search_*`):** replay is always safe to re-execute; do not cache. Caching reads by `id` is what caused the cross-tenant leak. Re-execute and discard. - **Non-idempotent writes (`charge_*`, `create_*`, `send_*`):** the server MUST have a committed `intent` record before dispatch. On replay with an...",
    "operational_effect": "After moving the dedup store to a shared Redis-backed map keyed by `(session_id, request_id)` with a 10-minute TTL and a two-phase `intent → completed` write, duplicate charges dropped to zero across a 90-day window. The cost was a mandatory pre-dispatch round-trip (~2ms p99) on non-idempotent tools and a hard 409 path that clients must handle. The stale-rea..."
  },
  "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": "ab8ee8a6c10b83448a6099d9ec2804797520d9e1dc8df196854eb64b59dc9cff",
    "verified_classes": [
      "ReplayIndistinguishableError",
      "ReplayRecord"
    ],
    "verified_functions": [
      "dispatch_tool_call",
      "_execute"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "NotImplementedError",
      "ReplayIndistinguishableError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
