Repository navigation
fix(test): prevent SQLite pathname failures in shared Gateway shards - #160838
Conversation
Track the shared-state singleton at its creator module rather than the operation adapter. A direct owner import otherwise survives the database lifecycle reset and leaves later worker resources outside canonical close. Extend the existing non-isolated runner proof with two file generations that verify current-generation resource retirement. The regression fails on the old mapping; a real worker probe reproduces the pathname conflict before the change and reopens successfully afterward. Native admission guards and test deadlines are unchanged. Co-authored-by: jalehman <[email protected]>
Worked on by: - @jalehman Co-authored-by: jalehman <[email protected]> OpenClaw-Publication: 966bf246-cd75-46a2-86de-ca62772a236b
|
🦞👀 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 28, 2026, 9:50 PM ET / September 29, 2026, 01:50 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch updates Gateway test cleanup to retire the shared SQLite worker between files and adds ordered fixtures that check retirement across two file generations. Merge readiness✅ Ready for maintainer review Current main retains the test-isolation defect. The focused repair has relevant before-and-after evidence, and the previous completed review recorded no actionable finding. Priority: P2 Review scores
Verification
How this fits togetherGateway tests can share a Vitest worker. After each file, the shared runner drains SQLite resources and resets module singletons before another file uses temporary database paths. flowchart LR
A[Gateway test file] --> B[Shared test runner]
B --> C[File finishes]
C --> D[SQLite lifecycle drain]
D --> E[Worker owner retired]
E --> F[Next test file]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +64. Total +64 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep worker retirement with the shared runner's existing lifecycle owner and retain the ordered regression to catch future owner-module moves. Do we have a high-confidence way to reproduce the issue? Yes. The old mapping and ordered cross-file path are clear in source, and the PR reports before-and-after real-worker and original-shard results; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Correcting the existing runner's owner mapping and checking cross-file retirement is a narrow repair for the reported fixture leak. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fbc0d118683c. LabelsLabel changes: No label 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)
|
…penclaw#160838) * fix(test): retire shared-state workers between test files Track the shared-state singleton at its creator module rather than the operation adapter. A direct owner import otherwise survives the database lifecycle reset and leaves later worker resources outside canonical close. Extend the existing non-isolated runner proof with two file generations that verify current-generation resource retirement. The regression fails on the old mapping; a real worker probe reproduces the pathname conflict before the change and reopens successfully afterward. Native admission guards and test deadlines are unchanged. Co-authored-by: jalehman <[email protected]> * fix(test): prevent SQLite pathname failures in shared Gateway shards Worked on by: - @jalehman Co-authored-by: jalehman <[email protected]> OpenClaw-Publication: 966bf246-cd75-46a2-86de-ca62772a236b --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: jalehman <[email protected]>
Related: #153340
What Problem This Solves
Fixes intermittent SQLite pathname-changed failures in shared Gateway test shards when a preceding file imports the shared-state worker owner without its operation adapter.
User Impact
No product runtime behavior changes. Gateway CI fixtures now retire their worker resources before later tests reuse temporary database paths. SQLite admission guards, permissions, assertions, and deadlines are unchanged; no migration or operator action is required.
Why This Change Was Made
The worker owner moved into
openclaw-state-worker-owner.ts, but the non-isolated runner still associated its singleton with the old adapter module. The surviving owner kept cleanup callbacks attached to a retired database lifecycle, so even an awaited canonical close could miss a live worker.Track the actual owner module and extend the existing cross-file lifecycle proof to verify that canonical close reaches the next file's resource. No new process boot or serial test configuration was added.
Evidence
Verified against pinned main
3da238d5e385, with Node 24.19.0 and pnpm 12.5.1 on secretless AWS m7a.large runners (2 vCPU, approximately 8 GB RAM):check-changedplan passed, including all four root TypeScript partitions, formatting, lint, dead-export scans, and applicable guards (678.82 s wall). No check was skipped or waived.1ddd228f8f43exactly matches signed commit16b08d69020d4.Separate catalog limitation: the public catalog-startup case passed in 71.502 s on untouched main, but a peer worker was OOM-killed, leaving that wider replay incomplete. That does not establish a clean comparison or attribute the original 90-second timeout. No startup-performance repair is included here. Hosted CI for this new PR is not claimed complete.
Worked on by
Work sessions
View the OpenClaw team session