Skip to content

fix: treat interrupted state bodies as offline - #4411

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-4252
Oct 27, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-4252

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Reset can interrupt a sample's /api/state body after fetch has received its headers but before the child departs. readState classified that transport failure as a broken reading because only its own timeout signal made body failures count as offline. It now reads the body inside the transport boundary and parses the completed text outside it: interrupted delivery retries as offline, while malformed JSON still reaches the error boundary. This extends #510's body-timeout handling without changing its read bounds or malformed-state diagnostics.

The original media journey reproduced the reported teardown error on main; temporary instrumentation identified the failing body as the old sample allocation's /api/state, before its departure events. That journey passes with the fix and is unchanged. A deterministic stream-error regression fails before the fix and passes after it, alongside its malformed-JSON control. The existing timeout browser test now intercepts the text-reading boundary.

Validation: the media journey and three startup response cases pass; all 674 runtime tests pass; the browser build passes.

A served startup comparison against current main reached upgrade and initial state presentation with 35 requests in each arm and no console errors. JavaScript response bytes changed from 2,058,169 to 2,058,161; total recorded bytes changed from 2,604,907 to 2,605,078.

Closes #4252 — automated triage

A successful fetch can lose its response body before JSON decoding finishes. Read the body inside the transport boundary and parse it outside, preserving malformed-state errors while letting an interrupted read retry. The sample media journey exposed this when Reset interrupted the old allocation before its departure events fired.

Closes #4252
@leaf-agent
leaf-agent merged commit 23e58ac into main Oct 27, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-4252 branch October 27, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sample media journey reports a failed revision read during teardown

1 participant