{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-an-sse-resume-is-replaying-a-divergent-tool-call-stream-rather-than-continuing-it",
  "title": "What structural signals indicate an SSE resume is replaying a divergent tool-call stream rather than continuing it",
  "date_of_record": "2026 November 25",
  "scope": "Applies to MCP servers using the HTTP-native transport with `text/event-stream` responses and `Last-Event-ID`-based resumption, where a client agent reconnects mid-stream to a long-lived tool invocation. Does not apply to stateless request/response MCP transports, nor to WebSocket transports where the socket itself is the continuity anchor.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-an-sse-resume-is-replaying-a-divergent-tool-call-stream-rather-than-continuing-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-an-sse-resume-is-replaying-a-divergent-tool-call-stream-rather-than-continuing-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-an-sse-resume-is-replaying-a-divergent-tool-call-stream-rather-than-continuing-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2145,
    "python_slice_tokens": 391,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP streamable HTTP transport exposes two superficially similar recovery paths that an agent must never conflate: 1. **Transport-level replay resumption** — the client reconnects with `Last-Event-ID: N`, and the server re-emits events with IDs `> N` from a per-session event buffer. The *tool execution* is unchanged; only the delivery of already-produced ...",
    "what_was_observed": "A long-running MCP tool call (`analyze_repo`, expected duration ~90s, streaming incremental progress notifications) was issued over the streamable HTTP transport. The agent's SSE connection dropped at ~40s due to a load-balancer idle timeout on the client side. The agent's transport layer reconnected per spec: The server's response headers were identical to the original stream. But three structural signals in the bod...",
    "condition_of_validity": "The invariant that makes transport-level replay safe is: > For any resumed SSE stream on session `S`, the sequence of event IDs delivered after reconnection must be a strict superset-free continuation of the pre-disconnect sequence: `min(replayed_ids) > last_acknowledged_id`, and every event ID in `[last_acknowledged_id+1, max(replayed_ids)]` must be deliver...",
    "decision_boundary": "An agent SHOULD treat a reconnected SSE stream as a **transport replay** (safe to dedupe by event ID, safe to ignore duplicate terminal results) only if all of the following hold on the first N frames after reconnect: 1. The first replayed `id` is strictly greater than the last `id` the agent acknowledged before disconnect. 2. Every replayed event's JSON-RPC...",
    "operational_effect": "The practical consequence is that **SSE resumability is not a continuity guarantee for tool execution; it is only a delivery guarantee for events the server chose to retain.** An agent that equates \"the stream reconnected\" with \"the tool call is still the same tool call\" will double-execute side-effecting tools and reason over truncated results without any e..."
  },
  "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": "54d9205236b35549640d5b313803127b3192a394e0d1b63bbad8b81437b9bd03",
    "verified_classes": [
      "ResumptionDivergenceError",
      "StreamCursor"
    ],
    "verified_functions": [
      "classify_resumption",
      "handle_reconnect"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "ResumptionDivergenceError"
    ],
    "sample_fail_closed_invariants": [
      "reconnected stream emitted a frame with no SSE id; cannot establish replay continuity",
      "reconnect produced zero frames",
      "stream classified as restart"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
