Skip to content

Retry the hosted state read through up to five connection resets - #5412

Merged
max-sixty merged 1 commit into
mainfrom
fix/state-read-reset-retries
Nov 5, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/state-read-reset-retries

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The hosted journey's state poll now retries through up to five connection resets instead of one, so a short burst of resets between the runner and Cloudflare's edge no longer fails publish-site. This is the repair @max-sixty chose on #4521.

read_state passes a new STATE_RESET_RETRIES = 5 to Playwright's native max_retries. Playwright retries only ECONNRESET, with a backoff that doubles from 250 ms, so one read keeps going through about eight seconds of resets. HTTP failures still surface at once through answered, and #4604's socket capture still logs every failed attempt.

Why one retry wasn't enough: in publish-site run 41876972316, request 26 reset on a reused socket after 3.1 s. Playwright's retry then opened a fresh socket, finished the TLS handshake, and reset again after 5.3 s, which used up #4881's single retry. In all three recorded cases the reset came before Workers Observability logged any request, so retrying this idempotent GET is safe.

The transport test in dev/tests/model/test_http_transport.py now sets the constant to 1, which keeps its exhausted-retry case inside the model tier's 3 s budget. It still checks recovery, exhaustion, HTTP 500 without retry, and credential-free capture. It passes locally (3 passed), and ruff is clean.

Closes #4521

The publish-site journey's state poll lost a read on November 4 when two
consecutive attempts reset, the second on a freshly opened connection, so
#4881's single retry was exhausted (publish-site run 41876972316). In all
three recorded cases the reset arrived before Workers Observability recorded
any request, which places it between the runner and Cloudflare's edge; the
maintainer chose to treat it as transport noise the poll retries through.

read_state now passes STATE_RESET_RETRIES (5) to Playwright's native retry,
whose backoff doubles from 250 ms, so one read rides through about eight
seconds of resets. HTTP failures still surface without retry, and #4604's
socket capture still records every failed attempt.

The transport test now pins the constant to one retry, so its exhausted case
stays within the model tier's budget; the behavior it checks is unchanged.

Refs #4521
@max-sixty
max-sixty merged commit 297fc44 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/state-read-reset-retries branch November 5, 2026 06:44
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.

Hosted journey state polling fails with a connection reset

2 participants