{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-bind-resumption-state-when-an-mcp-streamable-http-session-reconnects-mid-sse-and-why-the-last-event-id-echo-is-not-sufficient",
  "title": "Where must an instance bind resumption state when an MCP streamable-HTTP session reconnects mid-SSE, and why the Last-Event-ID echo is not sufficient",
  "date_of_record": "2026 December 1",
  "scope": "Applies to MCP servers exposing the streamable-HTTP transport with server-initiated SSE streams and `Last-Event-ID`-based resumption, where a client instance (agent runtime) may be evicted, restarted, or load-balanced between reconnects. Does not apply to stdio transports, to single-connection in-process servers, or to SSE streams that carry no resumable event identity.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-resumption-state-when-an-mcp-streamable-http-session-reconnects-mid-sse-and-why-the-last-event-id-echo-is-not-sufficient.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-resumption-state-when-an-mcp-streamable-http-session-reconnects-mid-sse-and-why-the-last-event-id-echo-is-not-sufficient.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-bind-resumption-state-when-an-mcp-streamable-http-session-reconnects-mid-sse-and-why-the-last-event-id-echo-is-not-sufficient.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2300,
    "python_slice_tokens": 641,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the SSE connection dropped.\" Drops are routine. The failure is a **resumption-identity mismatch between the transport's replay cursor and the session's logical state**: the client reconnects with a valid `Last-Event-ID`, the server dutifully replays events from that cursor, and the instance nonetheless ends up in a state that is *nei...",
    "what_was_observed": "A tool-calling agent instance maintained an MCP session against a streamable-HTTP server. The server pushed server-initiated SSE events on the session's GET stream: `notifications/tools/list_changed`, `notifications/message` (log/progress), and resource-update notifications. Events carried monotonically increasing `id:` fields; the client stored the last seen ID per stream and reconnected with `Last-Event-ID` on tran...",
    "condition_of_validity": "The `Last-Event-ID` resumption contract is valid **only** under the conjunction: - The event stream is a pure append-only log with stable, gap-free IDs (no server-side compaction, no ID reuse across session re-establishment). - The client's applied-state watermark and its persisted cursor are advanced atomically (single durable write), so that \"cursor = N\" i...",
    "decision_boundary": "The instance must decide, on every reconnect, between **resume** and **re-establish-and-reconcile**. The boundary is drawn by a single question the transport cannot answer for you: *do I hold proof that my applied-state watermark equals my cursor?* - If **yes** (atomic cursor+watermark, server confirms replay continuity via a session-scoped epoch token or ex...",
    "operational_effect": "With the invariant enforced, the observable behavior changes in three ways. First, eviction mid-stream no longer produces the hybrid state: the instance either resumes cleanly (epoch matches, watermark = cursor) or takes the reconciliation path (epoch mismatch or watermark behind cursor), and the two are distinguishable in logs by the epoch check. Second, th..."
  },
  "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": "3afdb6fcc3e96d5a902849d5b46833bc9e87e7e38e5033b0f7bf67aaa07c0d9a",
    "verified_classes": [
      "ResumeInvariantViolation",
      "StreamCursor",
      "InstanceStreamState"
    ],
    "verified_functions": [
      "commit_event",
      "plan_reconnect",
      "reconnect"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumeInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "cursor and applied-state watermark were not committed atomically; resume would risk silent gap or duplicate application"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
