Repository navigation
fix(sqlite): unblock Windows cleanup after state shutdown - #146160
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 1:31 PM ET / 17:31 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR closes pooled SQLite coordinator handles after explicit state shutdown while preserving active locks, and strengthens callback and process-exit regression tests. Merge readiness✅ Ready for maintainer review This repair remains necessary on current main. The prior callback-ordering finding is resolved, and this review found no remaining actionable correctness defects. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s shared-state lifecycle uses SQLite coordinator connections to serialize database operations across processes. Their release policy determines when locks end and when Windows can remove the surrounding files. flowchart TD
A[State writes or shutdown] --> B[State lifecycle coordinator]
B --> C[Acquire existing or fresh connection]
C --> D[Perform protected operation]
D --> E{Last active owner released?}
E -->|No| F[Preserve active lock]
E -->|Yes| G{Retirement requested?}
G -->|Yes| H[Close native connection]
G -->|No| C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +24, Tests +85. Total +109 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep ordinary coordinator reuse while making explicit retirement release native handles through the existing lifecycle owner after its final active reference. Do we have a high-confidence way to reproduce the issue? Yes, from source: warm a default coordinator, explicitly close its state database, and inspect the retained native handle before removing its Windows home. The PR reports matching Windows validation; this review did not execute it. Is this the best way to solve the issue? Yes. The patch repairs release policy in the existing coordinator owner, preserves reference-counted exclusion, and adds no schema, persisted setting, or parallel cleanup mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e16fc3c97374. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review Addressed the callback-ordering finding in The exposed CI listener-order assumption is also fixed: the package lease test now uses an actual child exit (code 23), then requires immediate lease reacquisition. Omitting exit registration makes that proof fail. Fixture cleanup closes SQLite before deleting its directory. Local affected suites, three type graphs, scoped lint, and independent delta review pass. The unchanged Windows Gateway archive-race case passes in 11.129 seconds under its original 120-second budget. Current-head CI is running. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…46160) * fix(sqlite): unblock Windows cleanup after state shutdown * fix(sqlite): preserve callback-time coordinator cleanup
Related: #145634
What Problem This Solves
Resolves a problem where Windows cleanup can fail after explicit state shutdown because a pooled coordinator handle remains open. In the Gateway archive-race fixture, removing its temporary home stalls on the coordinator lock file and times out after 120 seconds.
Why This Change Was Made
Explicit state retirement now consumes and closes its idle coordinator through the existing acquisition and release owner. Active same-process owners retain their lock until the final normal release, and pooling eligibility is recalculated after an authority callback can select a caller-owned path.
The package-exit regression now exercises an actual child process exit and required lease reacquisition, replacing a test-order-dependent choice of process exit listener. Its fixture closes state before deleting the directory.
User Impact
Explicit retirement releases idle coordinator resources; caller-owned runtime locations and temporary or relocated homes can be removed once all active owners release. Ordinary writes retain their existing idle coordinator reuse, and active same-path or unrelated owners keep their locks.
Evidence
runtimeDirectory,coordinatorPath, andkeepAlive. They now extend the existing idle-eligibility test; its final suite passed 15 tests with three existing platform skips.retries Gateway visitation when a peer archives after async restoration, passed on Windows with Node 26.8.2 in 11.129 seconds under its existing 120-second budget, including all body assertions and fixture cleanup.Exact-head hosted CI remains the landing gate. No schema, config, data migration, or transaction-boundary change is involved.