[PR #5086] [MERGED] Stop dev process trees when the terminal disconnects #6620

Closed
opened 2026-10-23 04:12:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5086
Author: @SpicyMarinara
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5062-dev-launcher-sighup


📝 Commits (7)

  • a90aae4 fix: stop dev children on terminal hangup
  • fb7b2b4 Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup
  • 99945a1 test: bound launcher health probes
  • 4fab3d9 Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup
  • a940019 Merge branch 'staging' into fix/5062-dev-launcher-sighup
  • 774d3db Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup
  • 7cc5343 Merge remote-tracking branch 'origin/fix/5062-dev-launcher-sighup' into fix/5062-dev-launcher-sighup

📊 Changes

3 files changed (+43 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+1 -1)
📝 scripts/dev.mjs (+4 -0)
📝 scripts/regressions/dev-launcher-process.regression.mjs (+38 -6)

📄 Description

Why

The original #5062 fix cleans up detached server/client process groups on SIGINT and SIGTERM, but a terminal disconnect sends SIGHUP. Without a SIGHUP handler, scripts/dev.mjs can exit while its detached pnpm -> tsx watch process tree survives, eventually blocking the next launch with its storage writer lease.

What changed

  • Handle SIGHUP with the conventional exit code while gracefully terminating launcher-owned child groups with SIGTERM.
  • Add a macOS/Linux lifecycle regression that proves a terminal hangup leaves no descendant PIDs and no health endpoint.
  • Clarify the existing #5062 changelog entry to cover terminal-disconnected sessions.

The storage writer lease and its concurrent-writer safety behavior are unchanged.

Closes #5062

Automated evidence

  • pnpm regression:launcher-update — passed
  • pnpm check — passed

Manual verification

  • Manually verify closing a macOS/Linux terminal running pnpm dev leaves no Engine server, watcher, or .writer-lease.
  • Manually verify Ctrl+C still shuts down both server and client trees.

Manual verification boxes are intentionally left unchecked for maintainers.

Summary by CodeRabbit

  • Bug Fixes

    • Improved development-session shutdown when the terminal disconnects.
    • Child processes are now stopped cleanly, preventing lingering development servers.
    • Shutdown exit codes now accurately reflect terminal hangups and standard termination.
  • Tests

    • Added regression coverage for terminal-disconnection scenarios on Unix systems.
  • Documentation

    • Updated the unreleased changelog to include terminal-disconnected sessions.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5086 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/15/2026 **Status:** ✅ Merged **Merged:** 8/15/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5062-dev-launcher-sighup` --- ### 📝 Commits (7) - [`a90aae4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a90aae4a509676f8c690c5a513e4a5d473c6622f) fix: stop dev children on terminal hangup - [`fb7b2b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fb7b2b4a053601ca45cfa58853f32c79973286f4) Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup - [`99945a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/99945a166aeef43d9a8f41c803e148eefcbd13d2) test: bound launcher health probes - [`4fab3d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4fab3d9be85d78e82afa77b2b41ef9e78bf5da79) Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup - [`a940019`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a940019f86cc1537fa0863e2d826adfe3d3ab1a7) Merge branch 'staging' into fix/5062-dev-launcher-sighup - [`774d3db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/774d3db0d262061f01cdffe190090ce591c8d886) Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-sighup - [`7cc5343`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7cc5343050c65303764cca8551856b153e8a15a4) Merge remote-tracking branch 'origin/fix/5062-dev-launcher-sighup' into fix/5062-dev-launcher-sighup ### 📊 Changes **3 files changed** (+43 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -1) 📝 `scripts/dev.mjs` (+4 -0) 📝 `scripts/regressions/dev-launcher-process.regression.mjs` (+38 -6) </details> ### 📄 Description ## Why The original #5062 fix cleans up detached server/client process groups on SIGINT and SIGTERM, but a terminal disconnect sends SIGHUP. Without a SIGHUP handler, `scripts/dev.mjs` can exit while its detached `pnpm -> tsx watch` process tree survives, eventually blocking the next launch with its storage writer lease. ## What changed - Handle SIGHUP with the conventional exit code while gracefully terminating launcher-owned child groups with SIGTERM. - Add a macOS/Linux lifecycle regression that proves a terminal hangup leaves no descendant PIDs and no health endpoint. - Clarify the existing #5062 changelog entry to cover terminal-disconnected sessions. The storage writer lease and its concurrent-writer safety behavior are unchanged. Closes #5062 ## Automated evidence - `pnpm regression:launcher-update` — passed - `pnpm check` — passed ## Manual verification - [ ] Manually verify closing a macOS/Linux terminal running `pnpm dev` leaves no Engine server, watcher, or `.writer-lease`. - [ ] Manually verify Ctrl+C still shuts down both server and client trees. Manual verification boxes are intentionally left unchecked for maintainers. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved development-session shutdown when the terminal disconnects. * Child processes are now stopped cleanly, preventing lingering development servers. * Shutdown exit codes now accurately reflect terminal hangups and standard termination. * **Tests** * Added regression coverage for terminal-disconnection scenarios on Unix systems. * **Documentation** * Updated the unreleased changelog to include terminal-disconnected sessions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:12:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6620
No description provided.