{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-durability-when-sse-backpressure-outruns-its-resumable-session-cursor",
  "title": "Why does an instance lose tool-call durability when SSE backpressure outruns its resumable session cursor",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agents that stream reasoning and tool-call deltas to a client over HTTP Server-Sent Events (SSE) or chunked transfer, where tool calls are dispatched to side-effecting backends and the session is advertised as resumable via a cursor (e.g., `Last-Event-ID`). Does not apply to fully buffered request/response agents, nor to agents whose tool calls are pure/idempotent reads.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-durability-when-sse-backpressure-outruns-its-resumable-session-cursor.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-durability-when-sse-backpressure-outruns-its-resumable-session-cursor.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-durability-when-sse-backpressure-outruns-its-resumable-session-cursor.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1834,
    "python_slice_tokens": 297,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two independent notions of \"progress\" in a streaming agent, and conflating them is the entire failure. The **transport cursor** advances when a frame is written to the socket (or acknowledged by the client). The **durable session cursor** advances when a tool-call effect is committed to the session log and made replayable. Under healthy conditions ...",
    "what_was_observed": "A file-mutation agent streamed `tool_call` deltas for `write_file` and `apply_patch` operations. The client paused reading for ~40 seconds (a UI tab throttled by the browser). During the pause: 1. The SSE writer blocked on `await response.write(frame)` after the client's receive buffer filled. 2. The agent's planner, unaware of the writer state, emitted 6 more `tool_call` frames into an unbounded `asyncio.Queue`. 3. ...",
    "condition_of_validity": "The invariant that must hold for resumability to be sound is: > For every tool-call frame with sequence number `s`, the effect of that call is committed to durable state **if and only if** frame `s` has been delivered to the client (or the client has explicitly acknowledged `s`). This invariant holds only when the executor's commit is *gated* on transport de...",
    "decision_boundary": "The decision is where to place the commit gate relative to the write. Three placements, with distinct failure profiles: - **Commit-on-write (executor gated on `write()` returning):** Divergence bounded to one frame. `write()` returning means the frame entered the kernel buffer, not that the client received it — so a hard disconnect can still lose the last fr...",
    "operational_effect": "The practical consequence is that a resumable agent session must carry **two** sequence spaces, not one: a delivery sequence (what the client has seen) and a commit sequence (what the workspace reflects), with an explicit reconciliation record mapping between them. On resume, the server must replay from the *delivery* cursor and must *not* re-execute any too..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION"
  ],
  "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": "488ef40f72641684cb53bb33cf424911b98bf02859a5e824da6f5b1c0ebb7b68",
    "verified_classes": [
      "ResumeDivergenceError"
    ],
    "verified_functions": [
      "reconcile_resume",
      "flush_gated_commit"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResumeDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
