Repository navigation
fix(remote): start herdr when its leftover socket refuses the connection - #405
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe bridge now checks whether an existing socket is stale after ChangesStale Socket Startup Recovery
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to This change lets the bridge start herdr when a leftover socket file has no listener. No merge-blocking risk was identified. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Bumps package.json and herdr-plugin.toml to 0.3.48, moves the Unreleased notes under [0.3.48] - 2026-10-04 (with the PR links #403, #405 and #406 lacked), and adds the compare link. Raises the remote PC bundle to 15 (the bridge starts herdr on a stale socket, #405; `/api/worktree/create` takes `agent`, #401): push the `remote-v15` tag and let the bundle workflow publish before running release.yml. Carries #393, #376, #403, #405, #402, #400, #397, #406, #401, #407, #408. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <[email protected]>
Change
A Linux or macOS PC whose herdr was lost to a restart (or a kill) could not be connected again: Update ended in "Bridge did not start. Check ~/.config/herdr-web-ui/bridges/bridge.log on the PC." every time, until someone started herdr on that PC by hand.
herdr leaves its socket file behind when it dies that way.
server/remote-entry.tsstarts herdr only when the socket is absent; a socket that exists and does not answer was treated as an operator problem and rethrown, so the bridge exited before it wrote its descriptor:Windows already tells a leftover marker from a live daemon (
staleMarker). This adds the same for Unix sockets:refusedSocket(path)connects and returns true only onECONNREFUSED, the kernel's answer for a socket file nobody listens on. Then the bridge starts herdr as it does for an absent socket. Any other failure (a daemon that is slow, a file that may not be read) still rethrows and leaves the daemon alone.Found on a MacBook that restarted by itself: its bridge registry held a descriptor of a dead v13 bridge, herdr was not running, and
herdr.sockdated from before the restart.Validation
server/herdr-marker.test.ts: a child process listens on a socket and is killed with SIGKILL;refusedSocketis false for a missing file and for the live listener, true for the file left behind.herdr --session … serverin a temporaryXDG_CONFIG_HOME, killed with SIGKILL and started again, on Linux (herdr 0.9.3) and macOS arm64 (herdr 0.9.0). Both giveECONNREFUSEDfor the leftover socket with the bundle's Bun 1.4.2.HOME: with a leftover socket in place,bun server/remote-entry.tsstarted herdr and wrote its descriptor (bundle_version 14). Before the change it exits with the error above.bun run typecheck: pass.bun run test:unit: 1128 pass, 3 skip, 0 fail.Not checked
bun run test:ssh), and a built remote bundle.staleWindowsMarker.REMOTE_BUNDLE_VERSIONbump here; PCs get this with the next bundle release.