{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-sse-client-resumes-across-a-rotated-session-token",
  "title": "Which invariants prevent silent event-loss when an MCP streamable-SSE client resumes across a rotated session token",
  "date_of_record": "2026 November 28",
  "scope": "Applies to MCP servers using the HTTP-native streamable transport with `Last-Event-ID` replay and a server-issued `Mcp-Session-Id` header. Does not apply to stdio transport, nor to single-connection SSE without resumption, where no cross-request cursor exists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-sse-client-resumes-across-a-rotated-session-token.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-sse-client-resumes-across-a-rotated-session-token.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-loss-when-an-mcp-streamable-sse-client-resumes-across-a-rotated-session-token.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1721,
    "python_slice_tokens": 243,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure people architect for is *reconnection*: the SSE stream drops, the client reconnects with `Last-Event-ID`, the server replays from its ring buffer, and execution continues. The failure that actually bites is *resumption across a session-identity rotation*. These are different problems and they are routinely conflated. Reconnection preserves the se...",
    "what_was_observed": "Trace from a reproduction against an MCP server with a 300s session idle TTL and a 1024-event replay ring: 1. Client opens session `S1`, receives `Mcp-Session-Id: S1`, opens SSE stream, consumes events `1..4471` on a long-running `tools/call`. 2. Network partition for 310s. Server GCs session `S1`; its event ring and its in-flight request state are dropped. 3. Client reconnects with `Mcp-Session-Id: S1` and `Last-Eve...",
    "condition_of_validity": "The invariant that must hold for resumption to be sound is: > An event cursor is only meaningful within the event space identified by the session token it was issued under. A cursor MUST NOT be presented against a session token that did not issue it. The spec implies this but does not enforce it at the wire level, because `Last-Event-ID` and `Mcp-Session-Id`...",
    "decision_boundary": "The server, on receiving `(session, last_event_id)`, sits on a boundary it must resolve explicitly rather than by comparison: - **Cursor < head, same session:** normal replay. Sound. - **Cursor == head:** caught up. Sound *only if* the session is the issuing session. - **Cursor > head:** ambiguous. Two real cases: (i) client is ahead because *this* session a...",
    "operational_effect": "Without the invariant, the failure mode is *silent event loss with duplicate side effects*: the client neither errors nor resumes, its in-flight request result is dropped, and its eventual retry re-executes a non-idempotent tool call. This is worse than a hard failure because it corrupts state quietly and only manifests as a downstream inconsistency (double-..."
  },
  "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": "dd487b04c132329d4252fc08323a1f4ea9e552f0e572c6b189042fa5984f0fd2",
    "verified_classes": [
      "ForeignCursorError"
    ],
    "verified_functions": [
      "resume_stream"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ForeignCursorError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
