{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-silent-sse-resumption-gap-when-an-mcp-streamable-http-session-is-handed-off-mid-keepalive",
  "title": "How does an instance detect a silent SSE-resumption gap when an MCP streamable-HTTP session is handed off mid-keepalive?",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers/clients using HTTP-native transport where the server emits an SSE event stream with `Last-Event-ID`-based resumption and negotiates keepalive via streamable-HTTP. Does not apply to stdio transport, nor to SSE streams that terminate cleanly with an explicit `event: end` frame.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-silent-sse-resumption-gap-when-an-mcp-streamable-http-session-is-handed-off-mid-keepalive.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-silent-sse-resumption-gap-when-an-mcp-streamable-http-session-is-handed-off-mid-keepalive.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-silent-sse-resumption-gap-when-an-mcp-streamable-http-session-is-handed-off-mid-keepalive.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1791,
    "python_slice_tokens": 286,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"the stream dropped.\" It is that the stream dropped *and resumed cleanly at the transport layer while silently skipping a window of protocol state* — and the client's `Last-Event-ID` cursor, which the server accepts as authoritative, certifies a continuity that never actually held. MCP over HTTP-native transport has two independent li...",
    "what_was_observed": "Trace from a two-replica deployment (A draining, B active) sharing an `Mcp-Session-Id` via a stateless session store that persisted *session metadata* (tool grants, capability negotiation, negotiated keepalive interval) but not the *event log*: - t0: A emits `id: 1041, event: message` — a `tools/call` result for `read_file`. - t1: A is signaled to drain. It emits `:keepalive` every 15s (negotiated interval) but no fu...",
    "condition_of_validity": "The silent-gap invariant holds — meaning the gap is *undetectable by the client alone* — if and only if all three conditions co-occur: 1. The server accepts `Last-Event-ID` without validating it against a durable event log (i.e., resumption is \"best effort\" rather than \"replay-or-refuse\"). 2. The negotiated keepalive interval is shorter than the client's res...",
    "decision_boundary": "The architectural guardrail is a **resumption warrant**: on accepting `Last-Event-ID: N`, the server MUST either (a) replay every event with id > N from a durable log, or (b) refuse the resumption with a distinguishable status (`409 Conflict` with a body naming the highest contiguous id it can serve, e.g. `{\"resumable_from\": 1041, \"requested_from\": 1041, \"ga...",
    "operational_effect": "Without the warrant, handoff produces **silent reasoning divergence**: the agent's next N steps are conditioned on state (tool results, progress notifications, log-derived context) that the protocol layer believes it delivered. The failure is invisible in transport metrics (connection up, keepalives flowing, HTTP 200s) and invisible in naive resumption metri..."
  },
  "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": "6a2cc8df98ce50e6ab4985eec589b09a701c9dad5a4c20e9becfd256bf299196",
    "verified_classes": [
      "ResumptionGapError",
      "SseEvent",
      "ResumptionValidator"
    ],
    "verified_functions": [
      "establish_stream",
      "__init__",
      "on_event"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
