{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-an-mcp-session-resumption-token-as-invalid-after-an-sse-last-event-id-replay-gap",
  "title": "Under what conditions must an instance treat an MCP session resumption token as invalid after an SSE `Last-Event-ID` replay gap",
  "date_of_record": "2026 December 3",
  "scope": "Applies to MCP clients and servers using the HTTP-native streamable transport where a single logical session spans multiple HTTP request/response cycles, SSE event IDs are monotonic, and resumption is attempted via `Last-Event-ID` plus a session token. Does not apply to single-request stdio transports or to transports where the server guarantees event-ID continuity across session re-establishment by design.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-session-resumption-token-as-invalid-after-an-sse-last-event-id-replay-gap.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-session-resumption-token-as-invalid-after-an-sse-last-event-id-replay-gap.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-an-mcp-session-resumption-token-as-invalid-after-an-sse-last-event-id-replay-gap.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2332,
    "python_slice_tokens": 396,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A resumption token and an SSE `Last-Event-ID` are two independent continuity claims, and the transport treats them as if they were one. The session token asserts *identity* (\"you are still the same logical session, with its server-side state\"). The `Last-Event-ID` asserts *position* (\"deliver events strictly after this ID\"). The failure mode is not that eith...",
    "what_was_observed": "A client agent held an active MCP session against a load-balanced pool of three server replicas. The session token was issued by replica A. Mid-task, the client's SSE stream dropped (idle TCP reset through a NAT gateway). The client reconnected to the pool, was routed to replica B, presented the session token and `Last-Event-ID: 4811`. Replica B recognized the token (session state was in a shared store) and resumed t...",
    "condition_of_validity": "The resumption token is valid for the purpose of *continuing the session* whenever the server's shared session store accepts it and its associated state is not evicted. This is the only condition the spec and most implementations check. The resumption token is valid for the purpose of *positional replay* only if all of the following hold simultaneously: 1. *...",
    "decision_boundary": "The boundary is *not* \"token expired vs. token valid.\" It is **\"cursor is within the current epoch's provable range vs. cursor is not.\"** These are orthogonal, and conflating them is the bug. Concretely, on every SSE reconnect the client must: - Present the token and cursor as separate fields (already the case in the wire format). - Require the server to ret...",
    "operational_effect": "The practical consequence is that **session resumption and stream resumption must be negotiated as two separate handshakes**, and the client must own the epoch check because the server has no incentive to volunteer a failure it can paper over with a 200. The cost is one extra round-trip field on reconnect and a small amount of client-side bookkeeping (last e..."
  },
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "56a5f20e3afe66f36efea7fcd628f5e3d26319e888b9b80886df235e12646932",
    "verified_classes": [
      "ResumptionEpochError",
      "StreamCursor",
      "ResumeProbe"
    ],
    "verified_functions": [
      "validate_resume",
      "resume_stream",
      "resynchronize"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionEpochError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
