{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reconcile-a-replayed-sse-event-against-a-resumed-mcp-session-before-it-trusts-the-stream-upgrade",
  "title": "Where must an instance reconcile a replayed SSE event against a resumed MCP session before it trusts the stream upgrade",
  "date_of_record": "2026 November 30",
  "scope": "Applies to MCP clients that resume a prior `streamable-http` session via `Last-Event-ID` and simultaneously receive a server-initiated SSE upgrade (`GET /mcp` with `Accept: text/event-stream`) on the same session ID. Does not cover stateless MCP transports, stdio transports, or fresh sessions with no prior event history.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-a-replayed-sse-event-against-a-resumed-mcp-session-before-it-trusts-the-stream-upgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-a-replayed-sse-event-against-a-resumed-mcp-session-before-it-trusts-the-stream-upgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reconcile-a-replayed-sse-event-against-a-resumed-mcp-session-before-it-trusts-the-stream-upgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1764,
    "python_slice_tokens": 240,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The ambiguity that breaks resumption is not \"did the server resend events.\" It is that the MCP streamable-HTTP transport permits *two independent mechanisms* to deliver the same logical event to a client: (1) replay triggered by `Last-Event-ID` on a resumed `POST`/`GET`, and (2) a server-initiated SSE upgrade that opens a fresh stream on the same session and...",
    "what_was_observed": "A client agent held session `sess_7f3a` mid-tool-call. The connection dropped after the client had received events `id: 40` through `id: 47` and recorded `Last-Event-ID: 47`. On reconnect, the client issued a resumption `GET /mcp` with `Last-Event-ID: 47` and `Accept: text/event-stream`. The server, per its upgrade policy, responded `200 OK` with `Content-Type: text/event-stream` and immediately began streaming — but...",
    "condition_of_validity": "The client MAY treat the upgraded SSE stream as a pure continuation (no reconciliation needed) only if all of the following hold: - The server's upgrade response includes an explicit cursor commitment — e.g., a first event with `id` strictly greater than the client's `Last-Event-ID`, or a `X-MCP-Resume-From` header equal to the client's declared cursor. - Th...",
    "decision_boundary": "The decision the client must make on the first event of an upgraded stream is not \"is this a duplicate\" but \"what is the relationship between the server's replay window and my acknowledged set.\" Concretely: - If `event.id <= max(acknowledged_ids)` and `event.id` is in the acknowledged set: **drop** (exact replay). - If `event.id <= max(acknowledged_ids)` and...",
    "operational_effect": "The guardrail is a session reducer that maintains an acknowledged-id set and a logical clock decoupled from arrival order, plus a hard refusal to apply id-less events on a resumed stream. Applied to the trace: event `44` is in the acknowledged set → dropped; `45`, `46` dropped; `47` is in the acknowledged set → dropped (no second sampling request, no buffer ..."
  },
  "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": "f0f5cba3df146a50cf35db94e3401744b315b259503d1da3243cd5b103b214ee",
    "verified_classes": [
      "ResumptionInvariantError",
      "SessionState"
    ],
    "verified_functions": [
      "reconcile_upgraded_event",
      "handle_upgrade_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ResumptionInvariantError"
    ],
    "sample_fail_closed_invariants": [
      "event on resumed stream has no id; abort resumption, open fresh session"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
