[PR #4570] [GUI] Time Skip Stop ends the job's process group on Linux and macOS #5095

Open
opened 2026-11-07 16:32:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4570
Author: @Nyarlathoteppppp
Created: 10/29/2026
Status: 🔄 Open

Base: main ← Head: fix/4529-killtree-group


📝 Commits (1)

  • 7a6db87 timeskip: Stop ends the job's process group on Linux and macOS, not just the job (#4529)

📊 Changes

2 files changed (+3 additions, -1 deletions)

View changed files

📝 apps/host/server/timeskip.mjs (+2 -1)
📝 apps/host/tests/timeskip-real.test.mjs (+1 -0)

📄 Description

Problem and result

killTree() in apps/host/server/timeskip.mjs ends the whole tree only on Windows (taskkill /T). On Linux and macOS it signals the job's direct child only, so the revision command the job runs survives Stop. apps/host/tests/timeskip-real.test.mjs ("Stop ends the job and everything it started…") already expects the grandchild to end, and fails on main here (macOS) as the issue reports on Linux.

After the change Stop ends the job's process group on Linux and macOS, so the revision command ends too.

Fixes #4529. Focused fix, no scope change.

Approach

The same pattern native-control.mjs already uses for engines (detached: process.platform !== 'win32' and process.kill(-pid, signal)):

  • the job spawn in startDetached (the only child that reaches killTree, via live) is started as its own process group on non-Windows;
  • killTree sends SIGTERM to that group, falling back to the child itself if the group kill fails.

The Windows branch is unchanged. Nothing is unref'd; the job's stdio pipes and exit handling are as before. The existing test also checks now that whenEnded settles after Stop, so the detached job still closes its pipes.

Validation

Passed:

  • node --test apps/host/tests/timeskip-real.test.mjs: on 46c152a 6 pass, 1 fail (the grandchild assertion, after the 6 s poll); with the fix 7/7 pass, 3 runs out of 3.
  • node --test apps/host/tests/timeskip*.test.mjs: 14/14 pass.
  • Environment: macOS 26 (Darwin 25.5) arm64, Apple M1 Pro, Node 26.0.0, Python 3.14.7, base 46c152a.

Failed:
none observed.

Not run:
full host suite, Linux, Windows, the desktop app.

Limits

As a group leader the job no longer gets terminal signals sent to the host's group (Ctrl+C on a host started from a terminal), the same as engines started by native-control.mjs. The host has no Time Skip shutdown cleanup either way.


🔄 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/Niko1221/Strata/pull/4570 **Author:** [@Nyarlathoteppppp](https://github.com/Nyarlathoteppppp) **Created:** 10/29/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/4529-killtree-group` --- ### 📝 Commits (1) - [`7a6db87`](https://github.com/Niko1221/Strata/commit/7a6db87445056c0474325e60533a1cd7403c1da9) timeskip: Stop ends the job's process group on Linux and macOS, not just the job (#4529) ### 📊 Changes **2 files changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/timeskip.mjs` (+2 -1) 📝 `apps/host/tests/timeskip-real.test.mjs` (+1 -0) </details> ### 📄 Description ## Problem and result `killTree()` in `apps/host/server/timeskip.mjs` ends the whole tree only on Windows (`taskkill /T`). On Linux and macOS it signals the job's direct child only, so the revision command the job runs survives Stop. `apps/host/tests/timeskip-real.test.mjs` ("Stop ends the job and everything it started…") already expects the grandchild to end, and fails on main here (macOS) as the issue reports on Linux. After the change Stop ends the job's process group on Linux and macOS, so the revision command ends too. ## Related discussion Fixes #4529. Focused fix, no scope change. ## Approach The same pattern `native-control.mjs` already uses for engines (`detached: process.platform !== 'win32'` and `process.kill(-pid, signal)`): - the job spawn in `startDetached` (the only child that reaches `killTree`, via `live`) is started as its own process group on non-Windows; - `killTree` sends SIGTERM to that group, falling back to the child itself if the group kill fails. The Windows branch is unchanged. Nothing is `unref`'d; the job's stdio pipes and exit handling are as before. The existing test also checks now that `whenEnded` settles after Stop, so the detached job still closes its pipes. ## Validation **Passed:** - `node --test apps/host/tests/timeskip-real.test.mjs`: on `46c152a` 6 pass, 1 fail (the grandchild assertion, after the 6 s poll); with the fix 7/7 pass, 3 runs out of 3. - `node --test apps/host/tests/timeskip*.test.mjs`: 14/14 pass. - Environment: macOS 26 (Darwin 25.5) arm64, Apple M1 Pro, Node 26.0.0, Python 3.14.7, base `46c152a`. **Failed:** none observed. **Not run:** full host suite, Linux, Windows, the desktop app. ## Limits As a group leader the job no longer gets terminal signals sent to the host's group (Ctrl+C on a host started from a terminal), the same as engines started by `native-control.mjs`. The host has no Time Skip shutdown cleanup either way. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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
Niko1221/Strata#5095
No description provided.