{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-a-replay-safety-problem-rather-than-a-transport-retry-problem",
  "title": "Under what conditions must an instance treat MCP stream resumption as a replay-safety problem rather than a transport-retry problem",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP servers and clients using HTTP-native transports (Streamable HTTP, SSE-over-POST, or any chunked streaming channel) that advertise `Last-Event-ID`-style resumption and per-stream backpressure. Does not apply to stdio transports, to fully buffered non-streaming JSON-RPC, or to transports where the server guarantees at-most-once delivery with no replay window.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-a-replay-safety-problem-rather-than-a-transport-retry-problem.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-a-replay-safety-problem-rather-than-a-transport-retry-problem.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-stream-resumption-as-a-replay-safety-problem-rather-than-a-transport-retry-problem.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2374,
    "python_slice_tokens": 467,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different reasons a streaming MCP session can break mid-flight, and they demand opposite recovery semantics: 1. **Transport loss** — the socket dies, the TCP connection resets, a proxy reaps an idle chunked body. The server's session state is intact; only the delivery channel is gone. Recovery is *retry*: reconnect, present the las...",
    "what_was_observed": "A long-running agent session opened a Streamable HTTP MCP session against a tool server exposing a `subscribe_events` streaming tool. The agent's tool-call loop consumed events and, for each `tool_result` event, appended to its own episodic buffer and issued a downstream write. The server retained a bounded replay log (ring buffer, capacity N events) keyed by monotonic event ID, and enforced backpressure by pausing t...",
    "condition_of_validity": "The transport-retry model is valid **only** when all of the following hold simultaneously: - The server's replay log is **lossless for the entire session lifetime** — no eviction, no coalescing, no TTL expiry of unacknowledged events. If the server bounds memory (it will), this fails under sustained backpressure. - Every event carries a **strictly monotonic,...",
    "decision_boundary": "An instance must switch from retry semantics to replay-reconciliation semantics when **any** of the following is true at resume time: - The server's advertised `earliest_available_id` (or equivalent) is **greater than** `last_processed_id + 1`. This is a hard gap: events were lost. The instance must not treat the resumed stream as contiguous, must mark the a...",
    "operational_effect": "The concrete invariant an instance must uphold: > **No downstream state advance may depend on stream continuity that has not been explicitly certified by ID-bound checks at every resume, and no side effect may be applied twice for the same event ID.** Operationally this forces: - A **processed-ID set** (or high-water mark plus dedup window) maintained across..."
  },
  "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": "171cca95e96ede72c83ba318d113f7520a31d53613f02926f0c24a36d878b249",
    "verified_classes": [
      "StreamResumeContinuityError",
      "ResumeState"
    ],
    "verified_functions": [
      "reconcile_resume",
      "apply_event"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumeContinuityError"
    ],
    "sample_fail_closed_invariants": [
      "server did not report earliest_available_id; resume cannot be certified contiguous"
    ],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
