Repository navigation
fix(test): nostr doctor and state-store suites fail Windows teardown with EBUSY - #127236
Conversation
…te dirs 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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 11:33 AM ET / 15:33 UTC. ClawSweeper reviewWhat this changesThis test-only PR releases the Nostr plugin-state store before two temporary state directories are deleted, preventing Windows SQLite EBUSY teardown failures. Regression provenancePossible regression — suspected (reproduction). No predecessor PR is attributed. Merge readinessKeep open: current main still removes both Nostr fixture directories without releasing the cached plugin-state database, while the proposed calls release that exact owner before removal. No blocking patch defect found; likely related people are Peter Steinberger (high confidence) and Vincent Koc (medium confidence). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherNostr tests create temporary OpenClaw state directories and open the shared SQLite-backed plugin-state store through the Nostr runtime or doctor migration context. Teardown must close that cached database before recursive removal so Windows can delete the database and its WAL sidecars. flowchart LR
A[Nostr test fixture] --> B[Temporary state directory]
B --> C[SQLite-backed plugin state]
C --> D[Test and migration operations]
D --> E[Release cached database]
E --> F[Remove temporary directory]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +4. Total +4 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the two teardown releases after rebasing, leaving each temporary fixture directory with no cached SQLite handle at removal time. Do we have a high-confidence way to reproduce the issue? Yes. The PR provides a native Windows command and before/after results, and current main source still omits both required teardown releases. Is this the best way to solve the issue? Yes. The existing reset is the owner-provided way to close the cached plugin and shared state databases; placing it immediately before removal fixes the leaked-handle boundary without retries or new production code. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c4e0c003a406. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Skipping the optional rebase and fresh Windows rerun: this branch is cleanly mergeable, repository policy does not rebase solely for mainline drift, and the current two Nostr fixtures still match the reviewed patch. Existing native Windows before/after proof covers both fixtures, all 279 Nostr tests, and the 1,486-test messaging shard; fresh exact-head isolated proof passes both affected suites (11 tests). |
|
Merged via squash.
|
…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.
Related: #119796
What Problem This Solves
Contributors on Windows cannot run the two
extensions/nostrsuites that write through theplugin state store: they fail in teardown with
EBUSY, so a green local run is impossible evenwhen every assertion in the suite passes. Both fixtures remove a temporary state directory while
the state database 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. The exact file named varies between the
database and its
-wal/-shmcompanions, because the removal walks the directory.Why This Change Was Made
Both fixtures call
resetPluginStateStoreForTests()when they set the fixture up and neveragain, so the store opened during the test is still cached when the directory is removed:
doctor-contract-api.test.tsresets inbeforeEachand removes the directory inafterEach.nostr-state-store.test.tsresets insidewithTempStateDirbefore running the body andremoves the directory in the same helper's
finally.The repair is the ordering the fixtures merged in #126352 now use: reset the plugin state store
immediately before the removal, so the cached handle is released first. Two lines of teardown
plus a comment; tests only, no production file is touched.
User Impact
Contributors on Windows can run both
extensions/nostrsuites to completion instead of reading ateardown failure that has nothing to do with the code under test. Behavior on Linux and macOS is
unchanged.
Evidence
Windows 11, Node 24.18.1,
origin/main3ae7ba31946, both arms on the same tree — the second armis that tree with only these two files patched.
mainextensions/nostr/doctor-contract-api.test.tsextensions/nostr/src/nostr-state-store.test.tsextensions/nostr/extension-messagingshardThe shard has no other failure on this machine, so these two suites are its only Windows
teardown red.
Both added calls are load-bearing: each suite fails on
mainwith its own removal path, and thetwo teardowns are independent.
./node_modules/.bin/tsgo -p test/tsconfig/tsconfig.extensions.test.json --noEmit-> exit 0./node_modules/.bin/oxlint <the two files>-> exit 0./node_modules/.bin/oxfmt --check <the two files>-> exit 0Relationship to the other repairs in this class
Disjoint from every open or merged repair of the same Windows teardown class, so they can land in
any order:
extensions/nostrwas found by sweeping everydoctor-contract-api.test.tsonmainfor afixture that removes its state directory without releasing the store first; the state-store suite
surfaced when the whole
extensions/nostrdirectory was run. Suites that already reset in theirteardown, such as
extensions/voice-call/doctor-contract-api.test.ts, are untouched.