You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flaky: gateway-fleet e2e on Windows fails cleanup with EBUSY on a worker temp folder #1852
bug:readyAn agent may fix it.fast-trackBug set ready by the fast-track check, not the maintainer (rule 17).flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.
src/daemon/gateway-fleet.e2e.test.ts, "gateway fleet smoke (ADR 0005 §35) > leases a device on the right worker and execs a real command against it through the gateway" failed on PR #1830 at 7290bed (CI run 45566787367, Unit tests (Windows)): EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\simlock-e2e-worker-b-9i4pD8'. The test ran 28.5 s before failing on removing the worker's temp folder. PR #1830's diff (a win32 ports test case) does not touch the gateway, the worker or this test.
The EBUSY is a daemon's npm child still running in worker-b's folder after the daemon stopped. A Windows process holds its working folder open, so the folder cannot be removed. The failed test took 28.5 s against 5.8 s on the rerun: the 25 s removal retry in afterEach ran out.
Test on bug/1852-repro: src/daemon/main-update.test.ts, "stopping a worker or a gateway ends the npm view its version check is still waiting on". It drives the real NodeNpmCli through a runner whose child ends only when aborted.
./node_modules/.bin/vitest run --project unit src/daemon/main-update.test.ts -t "ends the npm view"
AssertionError: expected { role: 'worker', ended: false } to deeply equal { role: 'worker', ended: true }
❯ src/daemon/main-update.test.ts:399:48
Root cause
Defect. src/daemon/version-check.ts:27 calls npm.view("simlock@latest") with no way to cancel it, and dispose (line 46) only sets disposed and cancels the 24 h timer. Every daemon started without an npm fake runs node npm-cli.js view with cwd set to its data directory (src/daemon/main.ts:315, src/ports/npm-cli.ts:93), with a 30 s limit. A stop during that call leaves the child running. On a loaded runner, worker-b starts last, so its child finishes last and holds the folder past the retry.
Simplest fix
NpmCli.view(spec, signal?). NodeNpmCli passes the signal on to runner.run. startVersionCheck makes an AbortController and dispose aborts it.
vitest run --project unit src/daemon/main-update.test.ts src/ports/npm-cli.test.ts src/daemon/main.test.ts
Tests 31 passed (31); pnpm typecheck: clean
bug:readyAn agent may fix it.fast-trackBug set ready by the fast-track check, not the maintainer (rule 17).flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.
Activity
V3RON commentedon Nov 26, 2026
Reproduction
The EBUSY is a daemon's npm child still running in worker-b's folder after the daemon stopped. A Windows process holds its working folder open, so the folder cannot be removed. The failed test took 28.5 s against 5.8 s on the rerun: the 25 s removal retry in
afterEachran out.Test on
bug/1852-repro:src/daemon/main-update.test.ts, "stopping a worker or a gateway ends the npm view its version check is still waiting on". It drives the realNodeNpmClithrough a runner whose child ends only when aborted.Root cause
Defect.
src/daemon/version-check.ts:27callsnpm.view("simlock@latest")with no way to cancel it, anddispose(line 46) only setsdisposedand cancels the 24 h timer. Every daemon started without annpmfake runsnode npm-cli.js viewwithcwdset to its data directory (src/daemon/main.ts:315,src/ports/npm-cli.ts:93), with a 30 s limit. A stop during that call leaves the child running. On a loaded runner, worker-b starts last, so its child finishes last and holds the folder past the retry.Simplest fix
NpmCli.view(spec, signal?).NodeNpmClipasses the signal on torunner.run.startVersionCheckmakes anAbortControlleranddisposeaborts it.Alternatives rejected
FakeNpmCliin the fleet rigs: hides the leftover child, and every other daemon test keeps it (Daemon tests that start a daemon without an npm fake ask the real npm registry for simlock@latest #1885).Risk
disposedoes not wait for the killed child to exit. The test's 25 s retry covers that gap.Fast track
Side findings
Written by an agent.
V3RON commentedon Nov 26, 2026
Delivery run
Merged: #1886 (#1852)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(daemon): stopping a daemon ends its version check's npm view (cal…