[GH-ISSUE #6135] The restart and shutdown regression lanes fail instantly on Windows before they test anything #3413

Closed
opened 2026-10-21 06:02:49 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6135

Originally assigned to: @SpicyMarinara on GitHub.

On Windows, two of the regression lanes die within a second of starting and report a failure that looks like a real restart or shutdown bug. Nothing is actually wrong with the server - the test harness hands Node a Windows path where Node requires a URL, so the test process never gets far enough to check anything.

How to reproduce (try it yourself)

This one has no in-app click path. It lives in the regression harness, not in the running app, so the reproduction is a command line.

On a Windows machine:

  1. Check out Marinara Engine staging at 52799569c and run corepack pnpm install.
  2. Open PowerShell at the repo root.
  3. Type exactly: node .\scripts\run-regressions.mjs --filter restart-supervisor
  4. Repeat with: node .\scripts\run-regressions.mjs --filter server-signal-shutdown

(Use the full lane names above. --filter restart picks up a second, unrelated lane and muddies the summary line.)

What you'll see: each run fails in well under a second with AssertionError [ERR_ASSERTION]: Supervisor exited: ... Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:', then FAILED (...ms) (exit 1) and Regression summary: 0/1 passed; 1 failed.

What should happen: Real skill restart route, single launcher ownership, old-process exit and launcher wiring passed. for the first lane and Production server PID-targeted TTY interrupt and duplicate-signal graceful shutdown passed. for the second, each with Regression summary: 1/1 passed; 0 failed. - which is exactly what both print on Linux and macOS today.

Two-second check of the mechanism on any operating system: node --import 'C:\Users\test\x.mjs' -e 'console.log(1)' fails with that same error, while node --import 'file:///C:/Users/test/x.mjs' -e 'console.log(1)' gets past the scheme check.

Where it is

At staging 52799569c:

  • scripts/regressions/restart-supervisor.regression.ts:22-23 - "--import", followed by serverRequire.resolve("tsx/esm"), inside the spawn argument array.
  • scripts/regressions/server-signal-shutdown.regression.ts:28-29 - the same pair. (The earlier --import data:text/javascript,... on lines 25-26 is fine; data: is an allowed scheme.)
  • scripts/run-server.mjs:22 - spawn(process.execPath, [...process.execArgv, ...process.argv.slice(2)], ...) forwards the bad value verbatim to the inner Node process.

Neither regression file imports node:url. A repo-wide search finds no other --import call site, so nothing in product or launcher code is affected.

What's happening

require.resolve always returns a native filesystem path - on Windows that is a bare C:\...\tsx\dist\esm\index.mjs. Node's --import flag expects a URL, and it parses anything that does not start with /, ./ or ../ as one, so C:\... reads as a URL with the protocol c: and Node refuses it. The launcher exits non-zero, the lane's own polling notices the dead child and calls assert.fail("Supervisor exited: ..."), and the runner prints a red lane. No product code ever runs: the restart lane never issues its POST /api/admin/restart, and the signal lane never sees the server's listening line.

The repo already knows this rule elsewhere - scripts/regressions/shutdown-deadline.regression.ts:19 uses pathToFileURL(...).href for the same class of value, and scripts/regressions/launcher/update.regression.mjs:485 asserts other scripts must. These two newer lanes missed it.

Suggested fix

In both files, import pathToFileURL from node:url and pass pathToFileURL(serverRequire.resolve("tsx/esm")).href as the --import value instead of the raw resolved path. A file:// URL is correct on Linux and macOS too, so this does not change behaviour there (a patched copy of the restart lane was run on Linux and still passed).

One caveat worth handling in the same change: the loader-path fix is necessary for both lanes but may not be sufficient for the signal one. scripts/regressions/server-signal-shutdown.regression.ts:80-84 sends SIGINT with process.kill and asserts the launcher exits with code 130, which comes from scripts/run-server.mjs:15 (128 + constants.signals[signal]) and only happens if the signal handler actually runs. Windows has no real signal delivery - Node emulates kill by terminating the target - so after fixing the loader path, confirm that lane actually passes on Windows. If it does not, give it an explicit, documented platform skip rather than leaving a lane that can never be green there.

Context

Both lanes were added by PR #5962 (merged 2026-09-08), which closed issue #5934 (the restart zombie, originally reported from a Windows box). That PR's validation ran on Linux and macOS, and every CI runner in the repo is ubuntu-latest, so this was never visible in CI - the PR body did note that native Windows behaviour remained a manual verification item. It landed after v2.4.4, so it is unreleased and only affects contributors running the regression harness on Windows; there is no product, user, or data impact. It is a good ride-along with the next change that touches these files. The reason it is still worth fixing is that the failure output impersonates a real restart/shutdown regression rather than reading as a path-format mistake.

Found by an AI-assisted sweep of merged PR #5962 against issue #5934, then re-verified against staging 52799569c on 2026-09-13. Please verify before fixing.

Originally created by @kolacheee on GitHub (Sep 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6135 Originally assigned to: @SpicyMarinara on GitHub. On Windows, two of the regression lanes die within a second of starting and report a failure that looks like a real restart or shutdown bug. Nothing is actually wrong with the server - the test harness hands Node a Windows path where Node requires a URL, so the test process never gets far enough to check anything. ## How to reproduce (try it yourself) This one has no in-app click path. It lives in the regression harness, not in the running app, so the reproduction is a command line. On a Windows machine: 1. Check out Marinara Engine `staging` at 52799569c and run `corepack pnpm install`. 2. Open PowerShell at the repo root. 3. Type exactly: `node .\scripts\run-regressions.mjs --filter restart-supervisor` 4. Repeat with: `node .\scripts\run-regressions.mjs --filter server-signal-shutdown` (Use the full lane names above. `--filter restart` picks up a second, unrelated lane and muddies the summary line.) **What you'll see:** each run fails in well under a second with `AssertionError [ERR_ASSERTION]: Supervisor exited: ... Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'`, then `FAILED (...ms) (exit 1)` and `Regression summary: 0/1 passed; 1 failed.` **What should happen:** `Real skill restart route, single launcher ownership, old-process exit and launcher wiring passed.` for the first lane and `Production server PID-targeted TTY interrupt and duplicate-signal graceful shutdown passed.` for the second, each with `Regression summary: 1/1 passed; 0 failed.` - which is exactly what both print on Linux and macOS today. Two-second check of the mechanism on any operating system: `node --import 'C:\Users\test\x.mjs' -e 'console.log(1)'` fails with that same error, while `node --import 'file:///C:/Users/test/x.mjs' -e 'console.log(1)'` gets past the scheme check. ## Where it is At staging 52799569c: - `scripts/regressions/restart-supervisor.regression.ts:22-23` - `"--import",` followed by `serverRequire.resolve("tsx/esm"),` inside the spawn argument array. - `scripts/regressions/server-signal-shutdown.regression.ts:28-29` - the same pair. (The earlier `--import data:text/javascript,...` on lines 25-26 is fine; `data:` is an allowed scheme.) - `scripts/run-server.mjs:22` - `spawn(process.execPath, [...process.execArgv, ...process.argv.slice(2)], ...)` forwards the bad value verbatim to the inner Node process. Neither regression file imports `node:url`. A repo-wide search finds no other `--import` call site, so nothing in product or launcher code is affected. ## What's happening `require.resolve` always returns a native filesystem path - on Windows that is a bare `C:\...\tsx\dist\esm\index.mjs`. Node's `--import` flag expects a URL, and it parses anything that does not start with `/`, `./` or `../` as one, so `C:\...` reads as a URL with the protocol `c:` and Node refuses it. The launcher exits non-zero, the lane's own polling notices the dead child and calls `assert.fail("Supervisor exited: ...")`, and the runner prints a red lane. No product code ever runs: the restart lane never issues its `POST /api/admin/restart`, and the signal lane never sees the server's listening line. The repo already knows this rule elsewhere - `scripts/regressions/shutdown-deadline.regression.ts:19` uses `pathToFileURL(...).href` for the same class of value, and `scripts/regressions/launcher/update.regression.mjs:485` asserts other scripts must. These two newer lanes missed it. ## Suggested fix In both files, import `pathToFileURL` from `node:url` and pass `pathToFileURL(serverRequire.resolve("tsx/esm")).href` as the `--import` value instead of the raw resolved path. A `file://` URL is correct on Linux and macOS too, so this does not change behaviour there (a patched copy of the restart lane was run on Linux and still passed). One caveat worth handling in the same change: the loader-path fix is necessary for both lanes but may not be sufficient for the signal one. `scripts/regressions/server-signal-shutdown.regression.ts:80-84` sends `SIGINT` with `process.kill` and asserts the launcher exits with code 130, which comes from `scripts/run-server.mjs:15` (`128 + constants.signals[signal]`) and only happens if the signal handler actually runs. Windows has no real signal delivery - Node emulates `kill` by terminating the target - so after fixing the loader path, confirm that lane actually passes on Windows. If it does not, give it an explicit, documented platform skip rather than leaving a lane that can never be green there. ## Context Both lanes were added by PR #5962 (merged 2026-09-08), which closed issue #5934 (the restart zombie, originally reported from a Windows box). That PR's validation ran on Linux and macOS, and every CI runner in the repo is `ubuntu-latest`, so this was never visible in CI - the PR body did note that native Windows behaviour remained a manual verification item. It landed after v2.4.4, so it is unreleased and only affects contributors running the regression harness on Windows; there is no product, user, or data impact. It is a good ride-along with the next change that touches these files. The reason it is still worth fixing is that the failure output impersonates a real restart/shutdown regression rather than reading as a path-format mistake. Found by an AI-assisted sweep of merged PR #5962 against issue #5934, then re-verified against staging 52799569c on 2026-09-13. Please verify before fixing.
bsakaguchi 2026-10-21 06:02:49 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 13, 2026):

@SpicyMarinara is taking this report through the issue sweep in draft PR #6137, with Codex assisting. The affected current-code path has been checked; implementation and focused regression verification are in progress.

<!-- gh-comment-id:5651924543 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): @SpicyMarinara is taking this report through the issue sweep in draft PR #6137, with Codex assisting. The affected current-code path has been checked; implementation and focused regression verification are in progress.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 13, 2026):

Fixed in #6137, now merged to staging (e044997a2). Portable loader URLs and native Windows CI now exercise restart ownership and graceful console shutdown.

<!-- gh-comment-id:5652785929 --> @SpicyMarinara commented on GitHub (Sep 13, 2026): Fixed in #6137, now merged to staging (`e044997a2`). Portable loader URLs and native Windows CI now exercise restart ownership and graceful console shutdown.
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#3413
No description provided.