{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-event-stream-divergence-across-mcp-resumable-sse-sessions",
  "title": "Which invariants prevent silent event-stream divergence across MCP resumable SSE sessions",
  "date_of_record": "2026 November 26",
  "scope": "Applies to MCP servers and clients using HTTP-native transport (Streamable HTTP with SSE streaming plus `Last-Event-ID` resumption) to carry long-running tool invocations across reconnects. Does not apply to pure stdio transports, nor to stateless request/response MCP calls that never emit server-sent events.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-stream-divergence-across-mcp-resumable-sse-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-stream-divergence-across-mcp-resumable-sse-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-event-stream-divergence-across-mcp-resumable-sse-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1738,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **transport-level replay** and **semantic-level replay**. HTTP-native MCP transport allows a client to reconnect to a session and resume an event stream by presenting `Last-Event-ID`; the server is expected to replay any events emitted after that ID. This is a *byte/event* continuity guarantee. It says nothing about wh...",
    "what_was_observed": "A client agent issued a `tools/call` that produced a long stream of `notifications/progress` events interleaved with a final `result`. The connection dropped mid-stream after the client had received progress events 1–40 but before the terminal `result`. On reconnect the client sent `Last-Event-ID: 40`. The server replayed 41 onward correctly—no gaps, monotonic IDs, valid SSE framing. The client's resume logic, howeve...",
    "condition_of_validity": "The transport-level resumption guarantee is valid only under the assumption that **the client's consumption of the event stream is idempotent with respect to `Last-Event-ID` replay**. That assumption holds if and only if all of the following are true: 1. The client commits state to its working context only *after* a complete logical JSON-RPC message has been...",
    "decision_boundary": "The operational decision is where to place the commit point for agent state relative to the SSE frame boundary. There are three defensible placements, and exactly one is safe: - **Commit per SSE frame (unsafe):** The agent advances its accumulator on every `data:` frame. This maximizes perceived liveness but makes the agent's state a function of transport ch...",
    "operational_effect": "When the invariant holds, reconnect is genuinely transparent: the agent's post-resume state is indistinguishable from a connection that never dropped, and downstream reasoning is unaffected. When it fails, the failure is *silent and delayed*—the corruption surfaces not at reconnect but several reasoning steps later, when the agent acts on a mis-accumulated c..."
  },
  "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": "09b87a986785a15437a5b2668055814c720d98f36e6d9499ae33ae7847966346",
    "verified_classes": [
      "ResumeDivergenceError",
      "SessionState"
    ],
    "verified_functions": [
      "on_frame",
      "on_reconnect"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumeDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
