{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-replayed-last-event-id-as-a-new-stream-rather-than-a-resumption-and-why-the-naive-resume-if-the-id-is-k",
  "title": "Under what conditions must an instance treat a replayed `Last-Event-ID` as a *new* stream rather than a resumption — and why the naive \"resume if the ID is known\" rule corrupts tool-call semantics",
  "date_of_record": "2026 November 11",
  "scope": "Applies to MCP servers and clients speaking the HTTP-native transport where a single POST stream carries server→client SSE events with `id:` fields and the client may reconnect with `Last-Event-ID` (or `Mcp-Session-Id` plus a resumption token). Does *not* apply to stateless one-shot request/response MCP servers, nor to transports that never emit SSE `id:` fields, nor to session resumption that is purely for *re-establishing a session* without replaying an event cursor.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-replayed-last-event-id-as-a-new-stream-rather-than-a-resumption-and-why-the-naive-resume-if-the-id-is-k.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-replayed-last-event-id-as-a-new-stream-rather-than-a-resumption-and-why-the-naive-resume-if-the-id-is-k.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-replayed-last-event-id-as-a-new-stream-rather-than-a-resumption-and-why-the-naive-resume-if-the-id-is-k.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1575,
    "python_slice_tokens": 252,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two superficially identical reconnects that a streamable MCP server must handle in opposite ways: 1. **Cursor resumption** — the client reconnects with a `Last-Event-ID` that points into the *currently live* logical stream, and the server replays buffered events strictly after that ID. This is the documented, intended use of SSE resumability. 2. **...",
    "what_was_observed": "A server maintained a per-session ring buffer of emitted SSE events keyed by a monotonically increasing `id`. When a client's POST stream dropped mid-`tools/call`, the client reconnected with `Last-Event-ID`. The server looked up the ID in the buffer, found it, and replayed from that point — correct for the *same* stream. The failure appeared when a client (or an intermediary proxy) reconnected *after the original st...",
    "condition_of_validity": "The \"resume if ID is known\" rule is valid **only** when all of the following hold: - The event ID resolves to a position in a stream that is still in the `open` or `resumable` state (not `completed`, `aborted`, or `superseded`). - The event ID's embedded stream/epoch identifier matches the stream the incoming POST is being attached to (i.e., the client is no...",
    "decision_boundary": "The decision is not \"is this ID in my buffer?\" but \"**is this ID a valid continuation point for the stream this POST is joining?**\" Concretely: - Embed a **stream generation** (epoch) into the event ID namespace, e.g. `{session_epoch}-{stream_id}-{seq}`, and reject resumption when the incoming `Last-Event-ID`'s `stream_id` differs from the stream the POST de...",
    "operational_effect": "When the boundary is honored (stale cursor → fresh stream), the client sees a clean new event sequence with no replayed terminal frames, its correlation map stays consistent, and non-idempotent tools execute exactly once. When it is violated, the failure is silent: the server reports a successful resume, the client reports a successful result, and the corrup..."
  },
  "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": "28c86c65231c008ebfe7c9365d139e8498dbadb9f700876855ae4d3a1fba6538",
    "verified_classes": [
      "StaleResumptionCursor",
      "EventStream"
    ],
    "verified_functions": [
      "resume_stream",
      "__init__",
      "make_event_id",
      "emit"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "StaleResumptionCursor"
    ],
    "sample_fail_closed_invariants": [
      "cursor points into a completed stream; must start a fresh stream"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
