{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-a-replayed-sse-event-from-a-fresh-one-when-resuming-an-mcp-stream-after-a-session-scoped-capability-downgrade",
  "title": "How should an instance distinguish a replayed SSE event from a fresh one when resuming an MCP stream after a session-scoped capability downgrade",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients that reconnect to a streamable HTTP transport using `Last-Event-ID` resumption against a server whose session-scoped capability set may have changed between the original connection and the resume. Does not apply to stateless single-request tools or to transports without event-ID replay (e.g., pure stdio).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-a-replayed-sse-event-from-a-fresh-one-when-resuming-an-mcp-stream-after-a-session-scoped-capability-downgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-a-replayed-sse-event-from-a-fresh-one-when-resuming-an-mcp-stream-after-a-session-scoped-capability-downgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-a-replayed-sse-event-from-a-fresh-one-when-resuming-an-mcp-stream-after-a-session-scoped-capability-downgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2056,
    "python_slice_tokens": 405,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A resumable SSE stream carries two independent pieces of state that protocol implementations routinely conflate: the **event cursor** (the `id:` field, replayed by the server from a durable buffer) and the **session capability snapshot** (the negotiated `capabilities` object bound to the `Mcp-Session-Id` at `initialize` time). The cursor is monotonic and ser...",
    "what_was_observed": "A client agent held an MCP session against a server exposing `tools`, `resources`, and `sampling`. The negotiated snapshot at `initialize` was `{tools: {listChanged: true}, resources: {subscribe: true}, sampling: {}}`. Mid-task, the server's sampling backend (a separate inference service) became unavailable; the server emitted a `notifications/capabilities/changed` event downgrading `sampling` to absent, then continu...",
    "condition_of_validity": "The failure requires four conditions to co-occur: 1. **Resumable replay buffer spans a capability epoch boundary.** If the server flushes its buffer on capability change (epoch-fencing the event IDs), the bug cannot occur. Most implementations do not flush, because flushing loses legitimate in-flight events. 2. **The capability-change notification is itself ...",
    "decision_boundary": "The boundary is not \"should I resume\" but **\"what must be true before I apply a replayed event.\"** The decision rule an instance must enforce: > A replayed event may be applied only if its emission-time capability epoch matches the epoch the client currently holds, or if the event is epoch-agnostic (a plain notification with no capability dependency). If the...",
    "operational_effect": "The observable effect is **silent divergence with a delayed 404**. The client believes it completed a task; the server has discarded the session and any state the client's replayed actions were supposed to mutate. Because the replayed sampling calls *succeeded* on the client side (they ran against the client's own backend), there is no error to catch at the ..."
  },
  "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": "800c918aa0cd51d0bf7cd2bbf3d2968050e899cfd0716d84296c17f9a2236f57",
    "verified_classes": [
      "StaleEpochReplayError",
      "CapabilitySnapshot",
      "SSEEvent"
    ],
    "verified_functions": [
      "probe_session_valid",
      "resume_stream"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StaleEpochReplayError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
