Skip to content

fix(ws): reconnect at once when a phone wakes instead of waiting out the backoff - #843

Merged
devswha merged 2 commits into
mainfrom
fix/ws-reconnect-on-wake
Oct 11, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/ws-reconnect-on-wake

Conversation

@devswha

@devswha devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Summary

Switching from the PC to a phone often shows "reconnecting" for a few seconds. While the phone was asleep or in the background, reconnect attempts failed and the backoff grew to its 5s cap; on wake the client waited out the remaining delay because the visibility handler only refreshed health, never the socket.

  • HerdrSocket.wake(): if a reconnect is pending, clear the timer, reset the backoff and connect now. No-op when connected, closed, or after an output-stalled close (only an attach resumes that).
  • The socket listens for visibilitychange (visible only), pageshow and online from its first connect(), and removes them in close().

Tests

  • src/lib/ws.test.ts: wake skips a backed-off reconnect and does nothing on a live connection; wake does not reopen a stalled or closed client.
  • bun run check fast: typecheck, build, 2751 unit tests pass.

🤖 Generated with Claude Code

…the backoff

A phone asleep or in the background fails reconnect attempts until the
backoff reaches its 5s cap. When the page is shown again (visibilitychange,
pageshow) or the network returns (online), skip the pending wait, reset the
backoff and connect now. A stopped output stays stopped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ddbb23f6-425a-4bcc-8203-a7392b5338c1

📥 Commits

Reviewing files that changed from the base of the PR and between 76875d9 and 69df6ed.


📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/lib/ws.test.ts
  • src/lib/ws.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit 005f525 into main Oct 11, 2026
9 checks passed
@devswha
devswha deleted the fix/ws-reconnect-on-wake branch October 11, 2026 22:25
devswha added a commit that referenced this pull request Oct 12, 2026
## Change

Release 0.4.8, from main at ca6db6e (20 PRs since v0.4.7: the 0.4.7
mobile walk-through fixes, two contributor PRs and the revived #793).

- `package.json` and `herdr-plugin.toml`: 0.4.8.
- CHANGELOG: `[Unreleased]` becomes `[0.4.8] - 2026-10-12`, with the
compare links. Twelve entries that had no PR link get theirs (#835 #837
#838 #840 #842 #843 #844+#848 #845 #847 #849 #851 #852). A Maintenance
line says the remote-PC runtime is now version 27.
- `release-summaries.json`: 0.4.8 in en/ko/ja/zh/tr (3 new, 6 improved,
8 fixed). The Turkish lines are not checked by a native speaker.
- `REMOTE_BUNDLE_VERSION` 26 -> 27: #836 adds the `pending-hold` server
feature and #787 serves precompressed assets, so `remote-v27` is
published before the app release.

Every PR merged since v0.4.7 is linked in the section: #787 #788 #793
#835 #836 #837 #838 #839 #840 #841 #842 #843 #844 #845 #846 #847 #848
#849 #851 #852.

## Validation

- `bun scripts/release-notes.ts 0.4.8` renders the summaries and the
full changelog (116 lines).
- `bun run check fast`: generated types, typecheck, build and 2800+ unit
tests pass.

## Release

After this merges and its CI on `main` passes: push `remote-v27`, wait
for its release, then run the Release workflow with `0.4.8`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
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