{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-mcp-streamable-http-session-resumption-as-invalid-after-an-sse-to-post-upgrade",
  "title": "Under what conditions must an instance treat MCP streamable-HTTP session resumption as invalid after an SSE-to-POST upgrade",
  "date_of_record": "2026 November 29",
  "scope": "Applies to MCP clients and servers using the streamable-HTTP transport where a session begins on a GET SSE stream and the client later issues a POST that triggers an upgrade negotiation (server-issued `Mcp-Session-Id`, `Last-Event-ID` resumption, or `202 Accepted` mutation handoff). Does not apply to pure stdio transports or to stateless request/response MCP deployments with no session identity.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-streamable-http-session-resumption-as-invalid-after-an-sse-to-post-upgrade.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-streamable-http-session-resumption-as-invalid-after-an-sse-to-post-upgrade.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-mcp-streamable-http-session-resumption-as-invalid-after-an-sse-to-post-upgrade.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1726,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A resumable MCP session is not identified by the SSE connection. It is identified by the tuple `(Mcp-Session-Id, Last-Event-ID, server-side event log position)`. The common failure is treating the SSE stream as the session: when the client upgrades from GET-SSE to POST (because the server returned `202 Accepted` with a session header, or because the client n...",
    "what_was_observed": "An agent driving a long tool-use chain (12 sequential tool calls with streaming partial results) ran over streamable-HTTP. The GET SSE stream delivered events `e1..e40` with monotonic `id`. At `e40` the server returned a `202 Accepted` on a POST that carried a `Mcp-Session-Id: s-7f3a` header and instructed the client to continue on the POST channel. The client, following a naive resumption policy, reconnected with `L...",
    "condition_of_validity": "The resume token is valid across an upgrade only if the server satisfies all of: 1. **Namespace continuity:** the server declares that event IDs are drawn from a single monotonic sequence spanning GET and POST legs. This must be asserted in the upgrade response (e.g., a `Mcp-Event-Log: unified` header or equivalent capability field in the `initialize` result...",
    "decision_boundary": "The client must branch at the upgrade response before issuing any POST: - **If** the upgrade response declares unified event-log continuity **and** echoes a committed watermark `>= Last-Event-ID` **and** the POST carries an idempotency key → resume is permitted; send `Last-Event-ID` on the POST leg. - **If** continuity is undeclared or the watermark is absen...",
    "operational_effect": "When the invariant is enforced, the failure mode is converted from silent state corruption into a bounded, observable restart. The cost is a checkpoint re-read and possibly a re-`initialize` round trip (tens to hundreds of milliseconds). The cost of not enforcing it is non-idempotent tool replay, duplicated side effects, and reasoning divergence that compoun..."
  },
  "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": "5e69f87fff2731babf010e9e2d252a3f5e432081aad3f514bb2c0515c75471ab",
    "verified_classes": [
      "ResumeTokenInvalidError",
      "LegContext",
      "ResumeToken"
    ],
    "verified_functions": [
      "validate_resume_on_upgrade",
      "resume_or_restart"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumeTokenInvalidError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
