Repository navigation
fix: keep the server running on hangup and log why it stops - #4965
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (23)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe server now shares a Suggested reviewers: Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No identified shutdown or test-workflow issue remains to resolve before merge. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The server now survives terminal hangups and records why shutdown begins. The inspected changes preserve existing stop permissions and isolation. No material security regression was established, but platform-specific and concurrent shutdown edge cases remain incompletely covered. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 45.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 70 functions across 22 files. (1 skipped: 1 unsupported.)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
| let reason = if self.host_shutdown_requested.load(Ordering::Acquire) { | ||
| ShutdownReason::HostShutdown | ||
| } else { | ||
| self.server_stop | ||
| .take_reason() | ||
| .unwrap_or(ShutdownReason::Unknown) | ||
| }; | ||
| info!(%reason, "server shutdown initiated"); |
There was a problem hiding this comment.
After a successful server.live_handoff, finish_live_handoff_shutdown() sets shutting_down directly. The loop then runs complete_shutdown() without calling initiate_shutdown(), so the old server never emits the new shutdown-reason line. This leaves a gap in the logs when diagnosing why that server stopped.
There was a problem hiding this comment.
intentional: the handoff exit already logs its own reason line, live handoff completed; old server exiting, in finish_live_handoff_shutdown. routing it through initiate_shutdown would also send ServerShutdown to clients that were already handed off, so i kept one line per shutdown there.
There was a problem hiding this comment.
That’s a valid distinction. finish_live_handoff_shutdown() already records the handoff-specific exit (live handoff completed; old server exiting), and routing it through initiate_shutdown() would incorrectly notify clients that have already been handed off. I’m withdrawing the finding; one shutdown log line for this path is intentional and sufficient.
If the shell that started the server exits, it can hang the server up, for example
herdr server &in zsh. Right now that stops the server and kills every pane. The log also never says why the server stopped, which is what made #4920 hard to read.herdr serverin a terminal, and the live-handoff replacement. Ctrl+C and SIGTERM still stop it.server.stoprequest with the calling process and its parent (Linux and macOS), host shutdown, or a Windows console event.herdr server stop.refs #4920
Validation:
just check, plus Windowsclippy --all-targetsthrough the cross setup. On macOS,server_headlessand the new unit tests. Live on Linux: a zsh job hangup, thenkill -HUPwith a running pane (both survive),kill -TERMandherdr server stop(both log the reason).