Skip to content

fix: add maxRetries to fs.rm in clean to handle ENOTEMPTY race conditions#4

Merged
pyramation merged 2 commits intomainfrom
feat/clean-retry
Feb 8, 2026
Merged

fix: add maxRetries to fs.rm in clean to handle ENOTEMPTY race conditions#4
pyramation merged 2 commits intomainfrom
feat/clean-retry

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Feb 7, 2026

fix: add maxRetries to fs.rm in clean to handle ENOTEMPTY race conditions

Summary

Adds maxRetries: 3 and retryDelay: 100 to the fs.rm call in clean.ts. This addresses intermittent ENOTEMPTY: directory not empty, rmdir 'dist' failures seen in CI when parallel pnpm builds create race conditions during the dist directory removal step.

Even though recursive: true was already set, fs.rm can still fail with ENOTEMPTY due to a kernel-level race condition — the kernel doesn't always update directory entries synchronously after file deletions, so the final rmdir() can see stale entries. maxRetries and retryDelay are built-in Node.js fs.rm options specifically designed to handle these transient filesystem errors.

Updates since last revision

  • Updated test expectations in clean.test.ts to match the new maxRetries and retryDelay options (all 3 test cases).

Review & Testing Checklist for Human

  • Confirm maxRetries: 3 and retryDelay: 100 are acceptable values — could increase if CI still flakes
  • After publishing, re-run a previously failing CI job in constructive to verify the ENOTEMPTY errors stop

Notes

@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 2faece2 into main Feb 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant