Skip to content

local:gate cannot pass on Windows — pre-existing failures in test:scripts, coverage:web and coverage:mcpdo #2748

Closed

Description

@olaservo

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

  1. added this to the v2.13.0 milestone on Oct 20, 2026
  2. added
    bug
    v2
    on Oct 20, 2026
  3. modified the milestones: v2.13.0, v2.14.0 on Oct 25, 2026
  4. laoyyu commented on Nov 2, 2026

    @laoyyu

    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.mjs prints nothing and exits 0 on an untouched checkout. It should have thrown --status is required. Same for the other 20 scripts that end in import.meta.url === \file://${process.argv[1]}``.

    Fix shape that works: one helper in scripts/lib/, comparing the canonical URL from node:url instead of a string prefix:

    export function isMainModule(importMetaUrl, argv1 = process.argv[1]) {
      return typeof argv1 === "string" && importMetaUrl === pathToFileURL(argv1).href;
    }

    Guarded 21 files (the 21st is sdk-watch.mjs), and after the change board-card-add.mjs reaches 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 Windows argv[1] (C:\work\inspector\scripts\board-card-add.mjs) against the raw file://${argv1} form that never matched, and one for a path with a space, since pathToFileURL percent-encodes it.

    Two details worth knowing before you write it:

    • verify-action-pins.mjs is the only script in that set that is not prettier-clean on main, so format:check:scripts fails there independently of this change.
    • scripts/gate-lease.mjs does 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:

    In scripts/lib/, add main-module.mjs exporting isMainModule(importMetaUrl, argv1 = process.argv[1]) that returns whether importMetaUrl equals pathToFileURL(argv1).href, and main-module.test.mjs with node:test cases for a POSIX path, a Windows path the raw file://${argv1} comparison misses, a path containing a space, another script's URL, and a missing argv[1]. Replace the import.meta.url === \file://${process.argv[1]}`guard in everyscripts/.mjswithif (isMainModule(import.meta.url)). Verify with node --test "scripts/**/.test.mjs"` that the failing set is unchanged and the new file's 5 cases pass.

    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.

  5. modified the milestones: v2.14.0, v2.15.0 on Nov 4, 2026
  6. cliffhall commented on Nov 5, 2026

    @cliffhall
    Member

    Shipped in #2906 (merge d988b85) on v2/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions