Repository navigation
Description
Problem
On Windows the gate goes red in three stages on an untouched checkout, so a Windows maintainer cannot get the green npm run local:gate AGENTS.md makes mandatory before a push. Each stage aborts the chain, so everything after it (local:dco, the remaining coverage runs, verify:build-gate, the smokes, Storybook) never runs unless invoked by hand.
Observed 2026-10-20 on Windows 11, Node 24, Git Bash, on main (2.11.0) and on a branch cut from v2/main at 1b4d4ec74. The failures are the same on both, so none is tied to a change under review.
| Stage | Failures | Shape |
|---|---|---|
test:scripts (last step of validate:guards) |
18 of 119 | board-recover.test.mjs and board-snapshot.test.mjs: 438 !== 384, a byte count that assumes LF line endings (one byte per line). gate-lease.test.mjs: 14 cases, exit codes 1 where 0 is expected, lease takeover and ordering, and the SIGTERM/SIGQUIT tree-kill cases (POSIX process-group semantics). skill-eval.test.mjs: the two runPrompt cases ("Bash must be denied", bounded tools). |
coverage:web |
30 of 9264, in 5 files | file-secret-store, secret-store-selection, oauth-secret-split, servers-route, node-persistence: file-permission assertions (0o644 read back as undefined), "permissions could not be set" warnings, and failed-disk-write rollback cases that expect a 500 and get a 200. All depend on POSIX mode bits or on making a path unwritable, which Windows does not honor. |
coverage:mcpdo |
65 of 499, in 11 files | daemon-stream, daemon-coverage, mcp-coverage, elicitation-client, daemon-paths, resolve-command, mcp-connection, daemon-private, skills-budget-hint, mcp-elicitation, agent-help: EACCES on listen for the Unix socket under %TEMP%, then 15s timeouts waiting on the daemon. |
Expected
Either each case passes on Windows, or the platform-bound cases are skipped there by name with a reason at the site, so every stage reports a real verdict and the chain reaches the stages after it. #1939 fixed the same class for verify:typecheck-coverage. mcpdo is documented as experimental and Unix-socket based, so skipping its daemon suites on Windows with a stated reason may be the whole answer there.
Also: the scripts' entry guard never fires on Windows
Separately from the test failures, every scripts/*.mjs CLI (21 files) ends with
if (import.meta.url === `file://${process.argv[1]}`) {
main();
}On Windows process.argv[1] is C:\Users\...\scripts\board-card-add.mjs while import.meta.url is file:///C:/Users/.../scripts/board-card-add.mjs, so main() never runs and the process exits 0 having printed nothing. Observed with npm run board:add and npm run board:status for #2740: both printed only the npm banner, exited 0, and the issue had no card afterwards. The procedures treat a missing card: … line as "step not done", but a silent exit 0 is easy to misread as success. The portable form compares against pathToFileURL(process.argv[1]).href from node:url, ideally through one helper in scripts/lib/ with a test that pins a Windows-style argv[1].
Workaround used: node --input-type=module -e "import('./scripts/board-card-add.mjs').then(m=>m.main([...]))".
Context
Found while running the gate for #2740.
Activity
laoyyu commentedon Nov 2, 2026
Confirmed the entry-guard half of this on Windows 11, Node 22.22.2, at
main(e321738). No PR per CONTRIBUTING — this is the diagnosis, the shape that works, and the prompt, so you can re-derive it through your own workflow.Reproduced:
node scripts/board-card-add.mjsprints nothing and exits 0 on an untouched checkout. It should have thrown--status is required. Same for the other 20 scripts that end inimport.meta.url === \file://${process.argv[1]}``.Fix shape that works: one helper in
scripts/lib/, comparing the canonical URL fromnode:urlinstead of a string prefix:Guarded 21 files (the 21st is
sdk-watch.mjs), and after the changeboard-card-add.mjsreaches its own argument validation instead of exiting silently.node --test "scripts/**/*.test.mjs"gave 22 failures both before and after — the same set, so nothing in the current Windows red moved — plus 5 passing tests for the helper, one of which pins a Windowsargv[1](C:\work\inspector\scripts\board-card-add.mjs) against the rawfile://${argv1}form that never matched, and one for a path with a space, sincepathToFileURLpercent-encodes it.Two details worth knowing before you write it:
verify-action-pins.mjsis the only script in that set that is not prettier-clean onmain, soformat:check:scriptsfails there independently of this change.scripts/gate-lease.mjsdoes not use this guard at all (it is one of the 22 failing files for other reasons), so fixing the guard does not turn that suite green.Prompt, if useful:
Happy to compare notes on the coverage and mcpdo stages separately if that is useful; those need the POSIX-mode and Unix-socket decisions you outlined, not this helper.
fix(scripts): portable entry guard and Windows-safe script tests (#2748)
test: make the Windows-bound cases pass or skip by name on win32 (#2748)
ci(windows): drop mcpdo's per-file threshold on win32 only; document …
ci: gate release publishing on the Windows job too (#2748)
ci: add a Windows job running test:scripts, coverage:web and coverage…
fix(scripts): portable entry guard and Windows-safe script tests (#2748)
test: make the Windows-bound cases pass or skip by name on win32 (#2748)
ci(windows): drop mcpdo's per-file threshold on win32 only; document …
ci: gate release publishing on the Windows job too (#2748)
Merge pull request #2906 from modelcontextprotocol/v2/fix/2748-window…
cliffhall commentedon Nov 5, 2026
Shipped in #2906 (merge d988b85) on v2/main.