Avoid Windows in-process test teardown deadlock#1997
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Do not retry removal of the in-process runtime's session home while its Vitest worker still owns a locked session database. Retrying until the hook timeout prevents the worker from exiting and releasing the lock. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e902b9a-5527-4a32-a5a3-e0bf5bfef3f7
There was a problem hiding this comment.
Pull request overview
This PR adjusts Node.js E2E harness teardown behavior to avoid a Windows-specific deadlock in Vitest workers when using the in-process (FFI) transport and the runtime keeps session.db locked until worker exit.
Changes:
- Limit
COPILOT_HOMEtemp directory deletion to a single attempt for Windows + in-process tests to avoid afterAll retry deadlock. - Extend the
rmDirhelper to accept a configurablemaxTries, preserving existing retry behavior for other platforms/transports.
Show a summary per file
| File | Description |
|---|---|
| nodejs/test/e2e/harness/sdkTestContext.ts | Make teardown cleanup retries configurable and cap retries for Windows in-process COPILOT_HOME deletion to avoid Vitest afterAll deadlock. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
| // Use longer retries to tolerate Windows holding SQLite session-store.db | ||
| // open briefly after the CLI subprocess exits. If the temp dir still can't | ||
| // be removed (e.g. CLI background writer racing with cleanup), warn and | ||
| // continue rather than failing the whole test run — the OS / CI runner | ||
| // will reclaim the temp dir on shutdown. |
Cross-SDK Consistency Review ✅This PR modifies only No cross-SDK consistency issues found. This is test infrastructure specific to the Node.js test runner (Vitest) and doesn't affect any public SDK API surface. No equivalent changes are needed in other language SDKs.
|
Windows in-process E2E workers can retain the runtime's
session.dblock until the Vitest worker exits. The existing 30-second cleanup retry runs from that worker'safterAllhook, so it prevents the exit needed to release the lock and eventually hits the hook timeout.Limit the
COPILOT_HOMEdeletion to one attempt specifically for Windows in-process tests. If the database is still locked, the existing warning and OS-cleanup path handles it, while other platforms and subprocess transports retain their retries because those locks can be released independently.Validation:
Generated by Copilot