{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-half-upgraded-mcp-streamable-http-session-sse-to-post-handshake-divergence-and-the-orphaned-response-stream-invaria",
  "title": "What structural signals indicate a half-upgraded MCP streamable HTTP session: SSE-to-POST handshake divergence and the orphaned response-stream invariant",
  "date_of_record": "2026 November 21",
  "scope": "Applies to MCP servers exposing the streamable HTTP transport where a client establishes an SSE `GET` stream and then issues `POST` requests correlated to that stream via `Mcp-Session-Id` and a request-id namespace. Does not apply to stdio transports, nor to pure request/response MCP servers with no server-initiated stream channel.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-upgraded-mcp-streamable-http-session-sse-to-post-handshake-divergence-and-the-orphaned-response-stream-invaria.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-upgraded-mcp-streamable-http-session-sse-to-post-handshake-divergence-and-the-orphaned-response-stream-invaria.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-half-upgraded-mcp-streamable-http-session-sse-to-post-handshake-divergence-and-the-orphaned-response-stream-invaria.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1850,
    "python_slice_tokens": 369,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the SSE connection dropped.\" That is loud and recoverable. The failure mode is **silent half-upgrade divergence**: the server has accepted the `GET` SSE stream and bound a session, the client has issued `POST`s carrying that session id, but the *response-bearing* half of the duplex — the channel over which the server writes the `POST...",
    "what_was_observed": "A tool-using agent issues an `initialize`, receives a session id `S`, opens `GET /mcp` with `Accept: text/event-stream` and `Mcp-Session-Id: S`, and begins reading events. It then issues `POST /mcp` with `Mcp-Session-Id: S` and a JSON-RPC body `{\"id\": 41, \"method\": \"tools/call\", ...}`. Three observable states, all of which look \"connected\" to a health check: 1. **Fully upgraded (invariant holds).** The `POST` returns...",
    "condition_of_validity": "The invariant \"a `POST`'s result is delivered on the client-held SSE stream\" is only valid under a conjunction the protocol does not itself enforce: - The server must route by `Mcp-Session-Id` to a *single* stream binding, not mint a stream per request. - Any intermediary (LB, sidecar, gateway) must pin the `GET` and the `POST` for a given session id to the ...",
    "decision_boundary": "The agent must decide, per outstanding request, whether to keep waiting on the held stream or to fail the request and re-establish. The boundary is: - **Wait** while `elapsed < T_keepalive * (outstanding + 1)` *and* at least one `message` event with a matching id has arrived since the `POST` was issued for any *concurrent* request (proving the stream is the ...",
    "operational_effect": "An agent that treats heartbeats as liveness will hang for its full per-call timeout on every request in a half-upgraded session, then — if it retries naively by re-`POST`ing with the same session id — reproduce the divergence, since the routing fault is sticky to the session id. The correct recovery is to **abandon the session id and re-initialize**, forcing..."
  },
  "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": "3256eb42e28b9dd806375a1487d4823231bfb45584e24548a62fad213cd0fa18",
    "verified_classes": [
      "HalfUpgradedSessionError",
      "StreamBinding"
    ],
    "verified_functions": [
      "post_and_await",
      "on_heartbeat",
      "on_message",
      "assert_response_bearing"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "HalfUpgradedSessionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
