Repository navigation
fix(test): doctor and auth fixtures fail Windows teardown with EBUSY - #126352
Conversation
…e state dirs Doctor migrations and auth-profile writes open per-agent and shared state databases under the fixture's temporary directory. Clearing the plugin state store or the runtime auth snapshots does not release those handles, so Windows fails the directory removal with EBUSY while Linux unlinks the open files and stays green. Close the cached databases before each removal, matching the ordering the zalouser and zalo fixtures already use.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 4:21 PM ET / 20:21 UTC. ClawSweeper reviewWhat this changesThis PR updates eight extension test teardowns to close cached SQLite state before removing temporary fixture directories, preventing Windows EBUSY failures. Merge readinessKeep open: current main still lacks this teardown cleanup, while the patch follows the existing SQLite-close ordering and has strong native-Windows before/after proof. No blocking patch defect found; land only from a green current merge result because the branch is behind main. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherDoctor-migration and provider-auth tests create temporary OpenClaw state, which can open shared or per-agent SQLite caches. Their teardown must release the relevant cache before deleting the temporary directory on Windows. flowchart LR
A[Extension test fixture] --> B[Doctor migration or auth write]
B --> C[Shared or agent SQLite cache]
C --> D[Test teardown]
D --> E[Temporary directory removal]
E --> F[Windows test result]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +22. Total +22 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the explicit, fixture-owned cache release immediately before directory removal, preserving agent-before-shared ordering where both caches are involved. Do we have a high-confidence way to reproduce the issue? Yes—source establishes the cached-handle path, and the PR provides native Windows before/after runs for all eight fixtures. This review did not rerun the Windows-only failure locally. Is this the best way to solve the issue? Yes—the patch closes the state owner each fixture actually opens before deletion, rather than masking the live-handle problem with filesystem retries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f68503084b7a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…e state dirs (openclaw#126352) Doctor migrations and auth-profile writes open per-agent and shared state databases under the fixture's temporary directory. Clearing the plugin state store or the runtime auth snapshots does not release those handles, so Windows fails the directory removal with EBUSY while Linux unlinks the open files and stays green. Close the cached databases before each removal, matching the ordering the zalouser and zalo fixtures already use.
…te dirs (#127236) The doctor migration fixture and the temporary-state-dir helper both open the plugin state store under the fixture's directory and reset it only during setup, so Windows fails the removal with EBUSY while Linux unlinks the open files and stays green. Reset the store immediately before each removal, matching the ordering the fixtures repaired in #126352 already use.
…te dirs (openclaw#127236) The doctor migration fixture and the temporary-state-dir helper both open the plugin state store under the fixture's directory and reset it only during setup, so Windows fails the removal with EBUSY while Linux unlinks the open files and stays green. Reset the store immediately before each removal, matching the ordering the fixtures repaired in openclaw#126352 already use.
What Problem This Solves
Contributors on Windows cannot run eight extension test suites: they fail in teardown with
EBUSY, so a green local run is impossible even when every assertion in the suite passes.Each fixture removes a temporary state directory while a SQLite handle opened underneath it
is still cached. On Linux unlinking an open file succeeds, so CI never sees it.
Every failure is in teardown, never in an assertion.
Why This Change Was Made
Two entry points open a database under the fixture directory and neither existing cleanup call
releases it:
resetPluginStateStoreForTests()releases plugin state and shared state only, so theper-agent handles stay cached.
saveAuthProfileStore(..., agentDir, ...)opens the per-agent database under the temporaryagent dir.
clearRuntimeAuthProfileStoreSnapshots()drops the in-memory snapshots but does notclose it.
The repair is the ordering the zalo and zalouser fixtures already use:
closeOpenClawAgentDatabasesForTest()before the removal, and beforeresetPluginStateStoreForTests()where both apply — the agent close releases leases throughshared state, so the reverse order can reopen it.
Tests only; no production file is touched.
User Impact
Contributors on Windows can run these eight suites to completion instead of reading a teardown
failure that has nothing to do with the code under test. Behavior on Linux and macOS is unchanged.
Evidence
Windows 11, Node 22.23.2, one suite per run, both arms on the same tree —
origin/mainb24430fd042and that tree with only these eight files patched.mainextensions/acpx/doctor-contract-api.test.tsextensions/active-memory/doctor-contract-api.test.tsextensions/codex/doctor-contract-api.test.tsextensions/device-pair/doctor-contract-api.test.tsextensions/memory-core/doctor-contract-api.test.tsextensions/msteams/doctor-contract-api.test.tsextensions/alibaba/video-generation-provider.test.tsextensions/openai/video-generation-provider.test.ts79 failing cases on
main, none after. Each row'smainarm was measured by checking outorigin/main's copy of that single file into the patched tree, so nothing else in the run differsbetween arms.
./node_modules/.bin/tsgo -p test/tsconfig/tsconfig.extensions.test.json --noEmit-> exit 0./node_modules/.bin/oxlint <the eight files>-> exit 0./node_modules/.bin/oxfmt --check <the eight files>-> exit 0Relationship to #119964
This does not overlap the open repair. #119964 owns exactly three files, all under
extensions/zalouser/:The eight files here are disjoint from those three. I wrote on #119796 on 6 August that the issue
was "fully covered once #119964 lands"; that was measured against the
extension-zaloshard and istoo narrow for the defect class — these eight fixtures reproduce the same teardown failure on
current
maintoday, outside that shard. Both branches can land in either order.Linked issue: #119796.