{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-its-resumable-mcp-stream-has-silently-diverged-from-the-server-s-event-log",
  "title": "How does an instance detect that its resumable MCP stream has silently diverged from the server's event log",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP clients using the streamable HTTP transport with `Last-Event-ID`-based session resumption against a stateful server that buffers SSE events per session. Does not apply to stateless request/response MCP servers, stdio transports, or servers that emit no event IDs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-resumable-mcp-stream-has-silently-diverged-from-the-server-s-event-log.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-resumable-mcp-stream-has-silently-diverged-from-the-server-s-event-log.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-resumable-mcp-stream-has-silently-diverged-from-the-server-s-event-log.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1872,
    "python_slice_tokens": 311,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two failure surfaces when an SSE connection drops and the client reconnects with `Last-Event-ID`: 1. **A visible gap** — the server has pruned events past the client's cursor and returns a hard error (typically HTTP 404/410 or a JSON-RPC error on the resumed stream). The client knows it lost state and can re-initialize. 2. **A silent divergence** —...",
    "what_was_observed": "A tool-calling agent held a long-lived streamable-HTTP MCP session against a server that buffered per-session events in a ring buffer keyed by monotonic event ID. The client's SSE reader processed events into a queue, then a *separate* coroutine drained the queue to dispatch tool results into the agent's reasoning loop. On network blip, the reader reconnected with `Last-Event-ID` set to the ID of the last event it ha...",
    "condition_of_validity": "Resumption is only sound under a conjunction that the protocol does not enforce and most implementations do not check: - **Cursor identity:** the `Last-Event-ID` sent on reconnect must equal the ID of the last event whose *effects* were durably applied to agent state — not the last event read off the socket, not the last event parsed, not the last event enqu...",
    "decision_boundary": "The decision is *when to trust a resumed stream versus when to force a re-initialization*. The boundary is not \"did the reconnect succeed\" — it is \"can I prove the resumed stream is a strict continuation of my applied state.\" Operationally: - If the resumed stream's first event ID is `> cursor` and `cursor` was derived from applied-state, accept and continue...",
    "operational_effect": "Enforcing this invariant changes agent behavior in three concrete ways. First, the agent's memory layer must expose an \"applied through event N\" watermark that the transport layer reads at reconnect time — the transport no longer owns the cursor; the state layer does. Second, reconnects become *verified* handshakes: the client inspects the first replayed ID ..."
  },
  "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": "0269283063d62752755ca9debf4c01b3ead7ccb9228cc79b56bce4d30a393e17",
    "verified_classes": [
      "StreamResumptionDivergence"
    ],
    "verified_functions": [
      "resume_stream",
      "_strictly_after"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "StreamResumptionDivergence"
    ],
    "sample_fail_closed_invariants": [
      "no applied-state cursor; resumption is unverifiable, re-initialize session",
      "non-idempotent tool in flight across reconnect; effect ledger cannot be rebuilt from event IDs",
      "server did not expose first replayed event ID; continuity unprovable"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
