{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-stream-across-a-serverless-cold-start-and-the-resumption-cursor-outlives-the-session-that-minted-it",
  "title": "What happens when an instance resumes an MCP stream across a serverless cold start and the resumption cursor outlives the session that minted it",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers deployed on stateless/serverless HTTP transports (per the Streamable HTTP transport binding) that emit `Mcp-Session-Id` and per-stream `Last-Event-ID` resumption tokens, where the agent client may reconnect after the server instance that minted the cursor has been reclaimed. Does not apply to long-lived stateful MCP servers holding both session state and event buffers in-process.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-across-a-serverless-cold-start-and-the-resumption-cursor-outlives-the-session-that-minted-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-across-a-serverless-cold-start-and-the-resumption-cursor-outlives-the-session-that-minted-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-stream-across-a-serverless-cold-start-and-the-resumption-cursor-outlives-the-session-that-minted-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1856,
    "python_slice_tokens": 348,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "MCP's HTTP-native transport carries two independent resumption axes that practitioners routinely conflate: 1. **Session resumption** — the `Mcp-Session-Id` header, which binds a logical conversation to server-side state (capability negotiation, subscriptions, in-flight tool calls). Session identity is *minted by the server* on `initialize` and must survive a...",
    "what_was_observed": "A tool-calling agent streamed a long-running tool invocation (a batch retrieval that emitted incremental `notifications/progress` events followed by a single `result`). The server ran on a serverless runtime with a 15-second idle reclamation. The agent's HTTP client dropped the SSE connection at ~12s due to a client-side read timeout and reconnected with `Last-Event-ID: 41` and a valid `Mcp-Session-Id`. Observed trac...",
    "condition_of_validity": "Cursor resumption is only well-defined under a conjunction that serverless deployments frequently break: - **(C1) Replay durability** — the event buffer for `(session_id, stream_id, event_id)` is durable across instance reclamation, OR the server is guaranteed to serve the reconnect on the same instance (it is not, in serverless). - **(C2) Cursor monotonicit...",
    "decision_boundary": "The boundary is whether the server can *prove* cursor validity at reconnect time: - If the event store is durable and keyed by cursor → honor, replay, continue. Safe. - If the event store is gone but the session is alive → the server faces a choice. It must **not** silently restart the stream. It should return an explicit resumption failure and let the agent...",
    "operational_effect": "Without the decoupling, the observable effect is a class of silent partial-result bugs that are extremely hard to attribute: the agent completes a task with a plausible-looking but incomplete tool history, and the only forensic trace is a `200` reconnect with a cursor the server ignored. Downstream, this corrupts episodic memory distillation (the agent recor..."
  },
  "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": "1814c102008c351875528b1c4475865d758cf616525f490eae3e0dbc922cb94d",
    "verified_classes": [
      "ResumptionContractViolation",
      "ReconnectRequest",
      "SessionRecord",
      "EventStore"
    ],
    "verified_functions": [
      "handle_reconnect",
      "has_cursor",
      "is_closed"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionContractViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
