Skip to content

flaky: edge-request-rules-devices.test.ts boot test times out at 20 s on the Windows unit job #1912

Done

Description

@V3RON

What happened

src/agent-device/edge-request-rules-devices.test.ts, "the agent-device front's request rules > A runner sends boot on its lease and simlock answers it; agent-device gets no boot", timed out on the Windows unit job of PR #1903 at 94ed2a3 (CI run 45971550656). The PR changes two files under docs/internal/adr/. Its next push (f7f3882, also ADR only) passed.

Error: Test timed out in 20000ms.
 ❯ src/agent-device/edge-request-rules-devices.test.ts:403:3
Error: Hook timed out in 20000ms.
 ❯ src/agent-device/test-support.ts:18:1

The run includes #1868 and #1887 (test daemons start without the host's real load probe).

What you expected

The test passes on every run.

How to reproduce

Not reproduced locally. No failed run was re-run in place; the commits above change no code the test reads, and the test passes on the runs around them.

Environment

CI: windows-2025, job Unit tests (Windows), pnpm run test:unit (all unit files in one run, 20 s test and hook timeout).

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Nov 27, 2026
  2. self-assigned this
    on Nov 28, 2026
  3. V3RON commented on Nov 28, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed from the CI logs. The new test pins the cause the rig controls: src/agent-device/worker-rig-directory-access.test.ts, "the agent-device worker test rig > starts its daemon, the phone rig's daemon and a restarted daemon without building the host's real directory-access reader", on bug/1912-repro.

    pnpm exec vitest run --project unit src/agent-device/worker-rig-directory-access.test.ts
    AssertionError: after setUp: expected 1 to be +0
     ❯ src/agent-device/worker-rig-directory-access.test.ts:25:40
    

    The boot test starts nine rig daemons in one 20 s test. Windows unit job timings, from the job logs:

    boot test, passing shards (4 runs): 6404 / 8218 / 8539 / 8783 ms
    run 45971550656: the file's other tests 1.0-1.4 s each (normal); boot test 42067 ms (20 s test + 20 s hook)
    macOS, same file, discarded probe: setUp 17-28 ms, stop 2-13 ms, rm <= 1 ms
    

    Root cause

    Defect in the test rig. src/agent-device/test-support.ts:170 calls startDaemon without directoryAccess. So src/daemon/main.ts:234 builds PowerShellDirectoryAccessReader, and on win32 prepareDataDirectory (src/daemon/connection-host.ts:70) waits for a real powershell.exe run (10 s limit) before each rig daemon serves. The boot test pays that nine times in a row. On a loaded runner where PowerShell takes more than about 2 s, the test passes 20 s. After the timeout the test keeps starting daemons, which loads the runner further while the afterEach stops and removals run, and that hook timed out too. src/daemon/test-main.ts:48-49 already fakes the reader for this reason.

    Simplest fix

    In src/agent-device/test-support.ts, pass directoryAccess: new FakeDirectoryAccessReader({ user: "S-1-5-21-1-2-3-1001", entries: [] }) with test-main.ts's why: line.

    vitest run --project unit: worker-rig-directory-access, edge-request-rules-devices, worker-rig-host-load, edge-request-rules, edge-release: 5 files, 81 passed
    pnpm test:changed: 18 files, 261 passed; pnpm typecheck: clean
    

    Alternatives rejected

    • Split the boot scenarios into it.each: gives each scenario its own budget, but every rig start still waits on PowerShell.
    • Raise the test's timeout: hides the wait, and the next test with many rigs hits it.
    • Skip the reader in startDaemon under tests: production code would then know about tests.

    Risk

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 28, 2026
  5. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 28, 2026
  6. self-assigned this
    on Nov 28, 2026
  7. V3RON commented on Nov 28, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1933 (#1912)
    Parked: none
    Waiting: none
    Decided: none
    Asleep: 165 min

    Written by an agent.

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

Metadata

Metadata

Assignees

Labels

bug:readyfast-trackflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions