Repository navigation
[Bug][CI]: codex-quota-auto-refresh test cleanup hits EBUSY on a Windows shard #7000
Description
Client or integration
Other
Area
Platform (Windows / macOS / Linux)
Summary
tests/codex-integration/codex-quota-auto-refresh.test.ts failed on a hosted Windows shard. The failure came from its afterEach cleanup, not from an assertion: rmSync(testHome, { recursive: true, force: true }) hit EBUSY on the case's own temporary OPENCODEX_HOME right after regression: inference 401 quarantines a time-valid bearer and stops retries. Something still held a handle under that directory when the case ended.
The cleanup uses a bare rmSync (line 124). The repository already provides tests/helpers/remove-tree.ts (removeTreeWithRetry, which "retries transient EBUSY failures"), and structure/ops/test-sandbox-cleanup.md describes the cleanup contract. Every other assertion in the file passed, and the same case passed on Windows in dev runs 38162375606, 38214884055 and 38250055508. This is an intermittent Windows cleanup race, newly exposed in a different batch position after the Windows shard membership changed in #6994.
Expected: the case's cleanup tolerates Windows' delayed handle release, or the code under test releases whatever it holds under OPENCODEX_HOME before the case resolves. The case should not fail the shard on a transient EBUSY.
Reproduction
- Pull request run https://github.com/lidge-jun/opencodex/actions/runs/38254923548 for ci(test): refresh shard durations from a full dispatch and give Windows its own table (#6982) #6994 (head 682db5c), job
windows 1/9, batch 20/48. - The case passes its assertions; the following
afterEachthrowsEBUSYfromrmSync. - Locally on macOS the file passes; the race needs Windows file-handle semantics.
Version
dev dc45bb2 plus #6994 (CI duration tables only; no change to this test or the quota code)
Operating system
GitHub-hosted windows-latest
Provider and model
Not applicable (test fixtures).
Logs or error output
[codex-quota-auto-refresh] p893430: http_status:401; reauthentication required
124 | if (testHome && existsSync(testHome)) rmSync(testHome, { recursive: true, force: true });
^
error: EBUSY: resource busy or locked, rm 'C:\Users\RUNNER~1\AppData\Local\Temp\opencodex-test-KxMsZi\tmp\ocx-quota-auto-refresh-USnVcb'
at <anonymous> (D:\a\opencodex\opencodex\tests\codex-integration\codex-quota-auto-refresh.test.ts:124:41)
(fail) Codex quota window auto refresh > regression: inference 401 quarantines a time-valid bearer and stops retries [155.91ms]
Test failure in shard 1/9 batch 20/48 (exit 1); not retrying assertion/test failures.
Screenshots and supporting files
No response
Redacted configuration
No response
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
lidge-jun commentedon Oct 12, 2026
Fixed on
devby #7001, landed through #7008 (mergea63267c134). Ships in 2.84.0.test(codex): drain quota fixture owners before home removal (lidge-ju…