Skip to content

fix(daemon-stream): reset reconnect backoff after a long-healthy stream dies dirty#349

Merged
laulpogan merged 1 commit into
mainfrom
fix/daemon-stream-backoff-symmetry
Jun 20, 2026
Merged

fix(daemon-stream): reset reconnect backoff after a long-healthy stream dies dirty#349
laulpogan merged 1 commit into
mainfrom
fix/daemon-stream-backoff-symmetry

Conversation

@laulpogan

Copy link
Copy Markdown
Collaborator

#346 floored the clean-close (Ok) path's backoff reset behind STREAM_HEALTHY_SECS, but the Err arm had a pre-existing asymmetry: a stream healthy for minutes that then dies with an Err (mid-stream reset / relay restart surfacing as an error, not a clean EOF) took the Err arm — which never reset backoff. Repeated healthy-then-Err cycles ratcheted backoff toward the 30s cap despite each connection being fine.

Fix: mirror the Ok-arm healthy check — reset backoff to 1 in the Err arm when stayed_open >= STREAM_HEALTHY_SECS, so a long-lived stream that dies dirty reconnects promptly. Capped + self-healing either way.

Surfaced by the post-fix verification fan-out (confirmed LOW, pre-existing — explicitly not a #346 regression). Closes the loop on the reconnect logic #346 touched.

cargo test --lib → 609; fmt + clippy clean.

🤖 Generated with Claude Code

…am dies dirty

#346 floored the clean-close (Ok) path's backoff reset behind STREAM_HEALTHY_SECS
but left the Err arm's pre-existing asymmetry: a stream healthy for minutes that
then dies with an Err (mid-stream transport reset / relay restart surfacing as an
error rather than a clean EOF) took the Err arm, which never reset backoff — so
repeated healthy-then-Err cycles ratcheted backoff toward the 30s cap even though
each connection was fine.

Mirror the Ok-arm healthy check: in the Err arm, reset backoff to 1 first when
the stream stayed open >= STREAM_HEALTHY_SECS, so a long-lived stream that dies
dirty reconnects promptly. Capped + self-healing either way.

Surfaced by the post-fix verification fan-out (confirmed LOW, pre-existing — not
a #346 regression). Closing the loop on the reconnect logic #346 touched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wireup-landing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4c757d2
Status: ✅  Deploy successful!
Preview URL: https://a816c063.wireup-landing.pages.dev
Branch Preview URL: https://fix-daemon-stream-backoff-sy.wireup-landing.pages.dev

View logs

@laulpogan laulpogan merged commit ccae714 into main Jun 20, 2026
13 checks passed
@laulpogan laulpogan deleted the fix/daemon-stream-backoff-symmetry branch June 20, 2026 14:51
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.

1 participant