Skip to content

tests: load-dependent failures in the packages/codev suite on a native Windows dev machine (agy-auth-cache EPERM, metrics-model-id barrier, windows-job census, worker exit) #1923

Open

Description

@amrmelsayed

Problem

After #1922's fixes, three full runs of packages/codev on a native Windows developer machine (Windows 11, live Tower on 4100, run from inside a builder session) each failed a different small set of tests. Every one passes when its file runs alone (2-3 targeted runs each). They are load-dependent and Windows-host specific; the GitHub Windows workflow does not show them.

Run Failures
1 agy-auth-cache "lets a late OAuth banner overwrite the speculative auth verdict" (EPERM), plus Worker exited unexpectedly
2 metrics-model-id "survives concurrent first-open by several processes" (children did not reach the barrier within 20s), plus Worker exited unexpectedly
3 windows-job.windows "terminating the job ends a cmd start /b orphan…" (line 198), agy-auth-cache "keeps spawning per call when the cache is disabled" (EPERM)

1. agy-auth-cache: EPERM removing the temp dir

removeFakeCliTempDir (src/commands/consult/__tests__/fake-cli-temp-dir.ts) retries 20× and tolerates a lingering EBUSY on Windows, but these runs hit EPERM:

Error: EPERM, Permission denied: \?\C:\Users\…\Temp\agy-auth-cache-test-ww7UIm
  at removeFakeCliTempDir (fake-cli-temp-dir.ts:15:8)
  at agy-auth-cache.test.ts:158:3

The survivor check in the same afterEach runs first and found no live fake agy. The holder is unidentified (AV/indexer scanning the freshly written agy.cjs/agy.cmd is a candidate). Not the same as #1435/#1460/#1596 (TTL race).

2. metrics-model-id: concurrent first-open barrier

children did not reach the barrier within 20s (metrics-model-id.test.ts:269): child processes start too slowly under full-suite load.

3. windows-job.windows: census race

windows-job.windows.test.ts:198, expect(census.some((entry) => entry.pid === leaf!.ppid)).toBe(false): the orphan leaf's cmd parent was still in the census (it had not yet exited, or its PID was reused).

4. Worker exited unexpectedly (2 of 3 runs)

[vitest-pool]: Worker forks emitted error … Caused by: Error: Worker exited unexpectedly. Run 2 counted ~87 fewer tests than run 3, so a file's tests were lost. The default reporter does not name the file; run 3 (JSON reporter) did not crash.

Fix shape

Find each holder or race at its cause. Name the cause before adding any retry or tolerance. For 4, catch the crashing file first (e.g. --reporter=verbose until it reproduces).

Found while fixing #1922.

Activity

  1. added
    area/cross-cutting
    on Nov 18, 2026
  2. added a commit that references this issue on Nov 18, 2026
  3. amrmelsayed commented on Nov 18, 2026

    @amrmelsayed
    CollaboratorAuthor

    Update from #1922.

  4. amrmelsayed commented on Nov 22, 2026

    @amrmelsayed
    CollaboratorAuthor

    Three more Windows flakes seen on 2026-11-20 while building #1911. None is caused by that change.

    Local only, under full-suite load (never failed in the last 15 Windows CI runs):

    • src/commands/porch/__tests__/bugfix-1814-check-timeout.test.ts, "a protocol.json timeout_ms reaches the runner and kills the check at that value". Asserts a 0.3s-timeout check of sleep 3 ends in under 2500ms. Took 2574, 2690 and 3271ms in three loaded runs; passes 3/3 alone. On Windows the timeout kill is a process-tree snapshot followed by taskkill, two process launches that slow down under load. The 3271ms run means sleep 3 finished by itself before the kill landed. Suggested fix: use a longer sleep so a natural exit cannot pass for a kill, and loosen the bound on Windows. This one blocks porch's tests check when it trips.
    • launch-loop-exit-code.test.ts, "still auto-restarts after a crash". EPERM removing its temp directory (codev-1241-*). Passed on one re-run.

    CI only (passes 3/3 locally):

    • src/__tests__/tower-lifecycle.windows.test.ts, scenario 5 (a row whose shellper pid was reused). Fails with read ECONNRESET. Seen on three branches: run 44237325105 (builder/bugfix-1922), run 44258108002 (builder/pir-1919), run 44725012668 (builder/pir-1911, passed on re-run of the job).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cutting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions