Skip to content

[Bug][CI]: codex-quota-auto-refresh test cleanup hits EBUSY on a Windows shard #7000

Closed

Description

@lidge-jun

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

  1. 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.
  2. The case passes its assertions; the following afterEach throws EBUSY from rmSync.
  3. 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

  1. added
    account-poolOAuth, credentials, Codex pool, quota, failover, plans
    platformOS/service/tray/ACL (Windows-heavy, not Windows-only)
    on Oct 12, 2026
  2. lidge-jun commented on Oct 12, 2026

    @lidge-jun
    OwnerAuthor

    Fixed on dev by #7001, landed through #7008 (merge a63267c134). Ships in 2.84.0.

  3. added a commit that references this issue on Oct 12, 2026
    5f3481b
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

    account-poolOAuth, credentials, Codex pool, quota, failover, plansbugSomething isn't workingplatformOS/service/tray/ACL (Windows-heavy, not Windows-only)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions