{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-an-mcp-streamable-http-session-resumed-into-a-half-drained-backpressure-state",
  "title": "How does an instance detect that an MCP streamable HTTP session resumed into a half-drained backpressure state",
  "date_of_record": "2026 November 24",
  "scope": "Applies to MCP servers and clients using the streamable HTTP transport with `Mcp-Session-Id` resumption and `Last-Event-ID` replay over SSE-framed responses. Does not apply to stdio transport sessions, nor to stateless per-request HTTP transports where no session continuity is expected.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-streamable-http-session-resumed-into-a-half-drained-backpressure-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-streamable-http-session-resumed-into-a-half-drained-backpressure-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-an-mcp-streamable-http-session-resumed-into-a-half-drained-backpressure-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1858,
    "python_slice_tokens": 259,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the session dropped.\" A dropped session is loud: the TCP connection resets, the client reconnects, and the server either honors `Last-Event-ID` or returns a fresh session. The failure mode here is subtler and is what makes it dangerous: **the session resumes successfully, the replay succeeds, and yet the resumed stream is already in a bac...",
    "what_was_observed": "A tool-calling agent (client) issued a long-running `tools/call` whose result streamed as SSE events `e1..e400`. At `e180` the network path flapped; the client's read loop aborted and it reconnected with `Last-Event-ID: e180`. The server: - Replayed `e181..e400` from its ring buffer — correct, gap-free. - Then resumed live emission for subsequent events — correct. - But the session's outbound write buffer still conta...",
    "condition_of_validity": "The atomic-reset invariant is valid — and the failure is preventable — only when all three of the following hold: 1. **The event log is the sole source of truth for replay.** If the server replays from a live producer's in-memory buffer rather than an append-only log, the stale-buffer race is structurally possible. The log must be written *before* the frame ...",
    "decision_boundary": "The operational decision is: **on resume, does the instance trust the stream or re-verify it?** - **Trust** is correct when the server exposes an explicit resume acknowledgment carrying the post-reset high-water mark and a session epoch/generation counter. The client compares the acknowledged epoch to its own; a mismatch means the server restarted the sessio...",
    "operational_effect": "The practical consequence for an agent runtime is that **resumption is a state-repair operation, not a retry.** Treating it as a retry — reconnecting, reading the replay, appending to the accumulator — is exactly the path to the corruption above. The correct handling is: - Maintain the received event-ID set (or at minimum a high-water mark plus a resume-boun..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION",
    "SPLIT_BRAIN_OR_ZOMBIE_WORKER"
  ],
  "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": "55ee6478178d1f748aab41edca32750c64e9e0d4f3742a4afab60cf1f1449e7c",
    "verified_classes": [
      "ResumptionIntegrityError",
      "StreamResumeGuard"
    ],
    "verified_functions": [
      "__init__",
      "on_reconnect",
      "accept"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResumptionIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
