Skip to content

consult: agy-auth-cache tests hit EPERM on temp-dir cleanup under load on Windows; find the cause and re-enable #1925

Open

Description

@amrmelsayed

Problem

agy-auth-cache.test.ts (consult's Gemini/agy lane) failed in roughly every other full-suite run on a native Windows developer machine with EPERM deleting its temp directory, on a different test in the file each time. It always passes in isolation. By owner ruling (2026-11-18) the file is skipped on native Windows in #1922 until the cause is understood; this issue is to find it and re-enable the file.

Evidence so far (from #1922, builder bugfix-1922)

  • The hold on the directory outlasted ~10 s of delete retries and was gone about 4 minutes later; a manual delete then succeeded.
  • Directories were ordinary: plain files, inherited ACLs, nothing read-only or reparse.
  • No live process mentioned the directory or the fake agy in its command line when checked afterwards. The lane launches node <dir>\agy.cjs directly (no cmd.exe wrapper).
  • In-run probe at the moment of EPERM: worker cwd was packages/codev (not the dir); the worker still held an active ChildProcess handle for one of the lane's fake agys although kill(pid, 0) reported it dead.
  • The survivor check was blind to one of three fake agys: PIDs were appended to a shared spawns.log and one write was clobbered (8, 35220, 26900).
  • The lane resolves right after proc.kill without waiting for the child's close.
  • After the test-side changes in tests: full suite on native Windows stops the live Tower and fails on main (launchers.windows port 4100, EPERM temp cleanup) #1922 (per-PID files, wait for children to be reaped, async delete) three consecutive full runs were green and the corrected survivor check never fired.

Open questions

  1. What actually held the directory: the un-reaped child, a third fake agy that outlived the kill (the fake is started with --print-timeout 5m), or something else? The cause in tests: full suite on native Windows stops the live Tower and fails on main (launchers.windows port 4100, EPERM temp cleanup) #1922 is inferred, not proven.
  2. Does the production lane leak or leave an un-awaited agy process (resolving after kill without awaiting close, or a speculative auth probe that is not tracked)? If so that is a consult bug, not a test bug.
  3. Is the same pattern behind the other temp-dir EPERM flakes seen under load (e.g. tripwire-wiring)?

Acceptance

  • The cause is demonstrated with a capture, not inferred.
  • If the lane leaks or under-waits, it is fixed with a regression test.
  • agy-auth-cache.test.ts is re-enabled on native Windows and passes 10 consecutive full-suite runs on a developer machine with a live Tower.

Related: #1922, #1923.

Activity

  1. added
    area/consult
    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

    From CMAP review of #1926: an option for re-enabling this file on Windows before the cause is found is for removeFakeCliTempDir (packages/codev/src/commands/consult/__tests__/fake-cli-temp-dir.ts) to tolerate a lingering EPERM on Windows the way it already tolerates EBUSY, i.e. leave the dir to OS temp cleanup with a warning. That would restore the #1077 burst-regression coverage on Windows while this issue looks for the holder. Not done in #1922, by owner ruling (skip, and track here).

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/consult

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions