Problem
The Windows CI job Test Node 22 (windows-latest) intermittently fails with:
Error: EBUSY: resource busy or locked, unlink 'C:\Users\RUNNER~1\AppData\Local\Temp\codegraph-embed-regression-NBNEYq\.codegraph\graph.db'
Observed in run 27049716531 triggered by PR #1338 (docs-only change). This is unrelated to the PR contents — it's a pre-existing Windows file-locking race in the test cleanup.
Root cause
tests/search/embedding-regression.test.ts creates a temp directory with a SQLite DB (graph.db) and tries to unlink it on cleanup. On Windows, SQLite holds an exclusive file lock via the WAL journal until the connection is fully closed. If better-sqlite3 hasn't fully flushed/closed the DB handle before the temp-dir cleanup runs, the unlink fails with EBUSY.
Main branch CI passes (all three recent runs green), so this is a non-deterministic race in the test teardown.
Fix
Add an explicit db.close() call before the temp directory cleanup in the test's afterAll / afterEach hook, or add a short retry loop on the unlink with exponential backoff (Windows-specific workaround pattern).
References
Problem
The Windows CI job
Test Node 22 (windows-latest)intermittently fails with:Observed in run 27049716531 triggered by PR #1338 (docs-only change). This is unrelated to the PR contents — it's a pre-existing Windows file-locking race in the test cleanup.
Root cause
tests/search/embedding-regression.test.tscreates a temp directory with a SQLite DB (graph.db) and tries tounlinkit on cleanup. On Windows, SQLite holds an exclusive file lock via the WAL journal until the connection is fully closed. Ifbetter-sqlite3hasn't fully flushed/closed the DB handle before the temp-dir cleanup runs, theunlinkfails with EBUSY.Main branch CI passes (all three recent runs green), so this is a non-deterministic race in the test teardown.
Fix
Add an explicit
db.close()call before the temp directory cleanup in the test'safterAll/afterEachhook, or add a short retry loop on the unlink with exponential backoff (Windows-specific workaround pattern).References
tests/search/embedding-regression.test.ts