[PR #5064] [MERGED] fix(dev): prevent orphaned servers from blocking restart #6610

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

📋 Pull Request Information

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

Base: staging ← Head: fix/5062-dev-launcher-process-tree


📝 Commits (5)

  • 4486595 fix(dev): clean up orphaned process trees
  • 6bbce6c Merge branch 'staging' into fix/5062-dev-launcher-process-tree
  • 9c05c97 test(dev): cover launcher process lifecycle
  • 166519a test(dev): terminate Windows launcher fixtures by tree
  • fbb4b69 Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-process-tree

📊 Changes

5 files changed (+335 additions, -20 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 package.json (+1 -1)
📝 scripts/dev.mjs (+76 -19)
➕ scripts/regressions/dev-launcher-process.regression.mjs (+254 -0)
📝 scripts/regressions/launcher-update.regression.mjs (+3 -0)

📄 Description

Linked issue

Closes #5062

Why this change

  • A dev session stopped through an IDE or parent process could leave the nested tsx server alive. That server correctly retained the storage writer lease, but the next pnpm dev then failed during bootstrap and users had no obvious recovery path.

What changed

  • Start persistent dev children in their own process groups on macOS/Linux and terminate each complete group during supervisor shutdown; retain Windows tree cleanup through taskkill /T.
  • Detect a verified Marinara health response before spawning a second server and reuse that server while starting the client.
  • Tighten readiness checks to reject unrelated services that merely answer on the configured port.
  • Add launcher regression guards and an Unreleased changelog entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Reproduced before the fix: sending SIGTERM only to node ./scripts/dev.mjs left its nested server/client process group alive and /api/health responding.
  • After the fix, launched an isolated server and client with temporary storage, sent SIGTERM only to the supervisor, and confirmed both child process groups stopped, the health endpoint closed, and .writer-lease was released.
  • Started two isolated dev sessions against the same port/storage and confirmed the second printed the verified server-reuse message, started only a client, and left exactly one server process. Stopping that second session kept the reused server healthy; stopping the owning session stopped it and released the lease.
  • node --check scripts/dev.mjs
  • pnpm regression:launcher-update
  • pnpm check

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] <paths> follow-up issue opened (see CONTRIBUTING.md, Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable; this is a development-launcher lifecycle fix.

Summary by CodeRabbit

  • Bug Fixes

    • Improved cleanup of stopped development sessions, including more reliable process termination.
    • Development launches now reuse an already healthy local server instead of starting a duplicate.
    • Improved server health validation and shutdown behavior across platforms.
  • Tests

    • Added regression coverage for process cleanup, signal handling, and local server reuse.
  • Documentation

    • Updated the unreleased changelog with these fixes.

🔄 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/5064 **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-process-tree` --- ### 📝 Commits (5) - [`4486595`](https://github.com/Pasta-Devs/Marinara-Engine/commit/44865955babf013bf710ddd3b0f4691f3e411214) fix(dev): clean up orphaned process trees - [`6bbce6c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6bbce6ce72ca70acd5deff9996d77bc259e9ed12) Merge branch 'staging' into fix/5062-dev-launcher-process-tree - [`9c05c97`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9c05c974b5f46ea2156b33cd650ffcf1aeba6a42) test(dev): cover launcher process lifecycle - [`166519a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/166519a5f58ab7fab0dc898e47b8aeea9cdf5fc2) test(dev): terminate Windows launcher fixtures by tree - [`fbb4b69`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fbb4b69c6e38ef878883b4cc7fdb1d94b376d337) Merge remote-tracking branch 'origin/staging' into fix/5062-dev-launcher-process-tree ### 📊 Changes **5 files changed** (+335 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `package.json` (+1 -1) 📝 `scripts/dev.mjs` (+76 -19) ➕ `scripts/regressions/dev-launcher-process.regression.mjs` (+254 -0) 📝 `scripts/regressions/launcher-update.regression.mjs` (+3 -0) </details> ### 📄 Description ## Linked issue Closes #5062 ## Why this change - A dev session stopped through an IDE or parent process could leave the nested `tsx` server alive. That server correctly retained the storage writer lease, but the next `pnpm dev` then failed during bootstrap and users had no obvious recovery path. ## What changed - Start persistent dev children in their own process groups on macOS/Linux and terminate each complete group during supervisor shutdown; retain Windows tree cleanup through `taskkill /T`. - Detect a verified Marinara health response before spawning a second server and reuse that server while starting the client. - Tighten readiness checks to reject unrelated services that merely answer on the configured port. - Add launcher regression guards and an Unreleased changelog entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Reproduced before the fix: sending SIGTERM only to `node ./scripts/dev.mjs` left its nested server/client process group alive and `/api/health` responding. - After the fix, launched an isolated server and client with temporary storage, sent SIGTERM only to the supervisor, and confirmed both child process groups stopped, the health endpoint closed, and `.writer-lease` was released. - Started two isolated dev sessions against the same port/storage and confirmed the second printed the verified server-reuse message, started only a client, and left exactly one server process. Stopping that second session kept the reused server healthy; stopping the owning session stopped it and released the lease. - `node --check scripts/dev.mjs` - `pnpm regression:launcher-update` - `pnpm check` ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n] <paths>` follow-up issue opened (see CONTRIBUTING.md, Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable; this is a development-launcher lifecycle fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved cleanup of stopped development sessions, including more reliable process termination. - Development launches now reuse an already healthy local server instead of starting a duplicate. - Improved server health validation and shutdown behavior across platforms. - **Tests** - Added regression coverage for process cleanup, signal handling, and local server reuse. - **Documentation** - Updated the unreleased changelog with these fixes. <!-- 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:02 +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#6610
No description provided.