{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-mcp-transport-backpressure-has-inverted-into-agent-side-state-corruption-during-long-running-streaming-tool-calls",
  "title": "What structural signals indicate MCP transport backpressure has inverted into agent-side state corruption during long-running streaming tool calls",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP clients and servers where a tool emits a streaming result (progress notifications, partial content chunks, or log lines) over a persistent transport (stdio or SSE) while the agent remains blocked awaiting terminal completion. Does not apply to single-shot request/response tools that return one bounded payload, nor to transports that provide true end-to-end flow control with per-message credit accounting.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-mcp-transport-backpressure-has-inverted-into-agent-side-state-corruption-during-long-running-streaming-tool-calls.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-mcp-transport-backpressure-has-inverted-into-agent-side-state-corruption-during-long-running-streaming-tool-calls.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-mcp-transport-backpressure-has-inverted-into-agent-side-state-corruption-during-long-running-streaming-tool-calls.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1958,
    "python_slice_tokens": 463,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Backpressure in MCP is *advisory and transport-local*. The protocol gives you `notifications/progress` with a `progressToken`, and JSON-RPC framing over stdio or SSE, but it does not define a credit window, an ACK requirement, or a bounded buffer contract between server write and client read. The distinction that matters operationally is between **transport ...",
    "what_was_observed": "A long-running streaming tool (`scan_repository`, emitting a progress notification per file scanned, ~40k files, ~2–6 KB per notification) ran over stdio. The server emitted progress on a tight loop without yielding to the event loop. Sequence observed: 1. **Saturation phase.** Client read loop could not drain at emit rate. The stdio pipe buffer (default ~64 KB on Linux) filled. Server's `write()` on the pipe blocked...",
    "condition_of_validity": "The invariant that must hold for streaming MCP tools to be safe under backpressure: > For any token `T`, the client dispatches progress notifications in emission order and observes a strictly monotonic `progress` field; and no token `T'` is considered live until the server has acknowledged (via terminal response or explicit cancel-ack) that `T` is closed. Th...",
    "decision_boundary": "The boundary is drawn at the point where the agent must choose between *draining harder* and *declaring the stream poisoned*. Concrete rule: - **Drain** while: bytes are still arriving on the transport (read-buffer high-water mark is non-zero or advancing), and the last dispatched progress is monotonic within its token. Congestion here is recoverable; do not...",
    "operational_effect": "The practical consequence is that **backpressure must be treated as a state-integrity event, not a performance event.** Three architectural guardrails bound the failure: - **Decouple the drain loop.** The transport reader runs on its own task and writes into a bounded ring buffer with an explicit overflow policy (drop-oldest with a gap marker, never silent t..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION",
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "a8a68bf744d6c4f2b8fdea815599ae1610ead3a57845f7ce6d1fa246dd4e4ceb",
    "verified_classes": [
      "StreamBackpressureInversion",
      "TokenState",
      "StreamGuard"
    ],
    "verified_functions": [
      "open_token",
      "on_progress",
      "checkpoint",
      "detect_dispatcher_starvation",
      "close_token"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "StreamBackpressureInversion"
    ],
    "sample_fail_closed_invariants": [
      "transport draining but dispatcher starved: read loop and agent loop have decoupled; treat checkpoint as untrusted"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "time"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
