Repository navigation
fix(test): retire shared read pools between files - #154206
Conversation
Retire the shared state-read worker singleton with its state database lifecycle after drain. Otherwise a new file can reuse a pool whose cleanup callback belongs to a retired lifecycle and leak a mocked fleet reply into real workspace snapshots. Extend the native ordered lifecycle regression with three reader generations. It reproduces the exact workspace snapshot failure before the mapping and passes afterward; 20 standalone qualification runs pass. Production behavior and persistent state are unchanged. Co-authored-by: steipete <[email protected]> Co-authored-by: fuller-stack-dev <[email protected]>
|
🦞👀 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 20, 2026, 8:39 PM ET / September 21, 2026, 00:39 UTC. ClawSweeper reviewWhat this changesRetires shared database read pools between test files and extends the ordered regression to catch mocked replies leaking into workspace reads. Merge readiness✅ Ready for maintainer review The repair remains necessary on current main. The patch fixes the test lifecycle owner without weakening downstream assertions, and no actionable correctness or security finding was identified. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s shared Vitest workers reuse a process across test files. Their teardown must drain database resources and retire cached owners so each subsequent file receives its own transport and cleanup callbacks. flowchart TD
A[Test file reads shared state] --> B[Shared read pool]
B --> C[Database lifecycle callbacks]
C --> D[Drain resources after file]
D --> E[Retire pool and lifecycle]
E --> F[Next file creates fresh owners]
F --> G[Workspace read receives matching reply]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +64. Total +64 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep read-pool retirement within the existing drain-before-retire lifecycle and preserve the ordered consumer regression. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the three-generation failure path: retire the database lifecycle, reuse the surviving read singleton, then request a workspace snapshot through the preceding mocked pool. The reported failing regression was not rerun here. Is this the best way to solve the issue? Yes. Extending the existing retirement map fixes the owner mismatch without changing production reads, suppressing errors, or adding another cleanup mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2969f4becc06. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Incorporate the owning fix from #154206 before revalidating #154192. Co-authored-by: steipete <[email protected]>
Merge main 5941d99 with the landed shared read-pool retirement fix from PR #154206. Preserve the external rebase ancestry, selected-agent reader behavior, all reader postimages, and the unchanged extraction patch. Qualify the material shared tab-strip integration with 49 focused tests, UI production types, current browser close/reopen flow, fresh P2 review, and the paired startup budget at 364652 gzip bytes without budget changes. Earlier reader-suite proof remains bound to its qualified source revision.
|
Supplemental F50 verification for main run 35546216851, head The original 218-file cohort reproduced all three readiness failures on Linux with the retirement mapping removed: 215 passed files, 1 failed, 2 skipped; 2,838 passed cases, 3 failed, 16 skipped. The readiness file passed alone before the fix. Diagnostic-only logging captured this exact reply for every failed snapshot request: {"ok":true,"type":"fleet.list","sourceAdmitted":true,"cells":[]}The error-mapping fixture reported completion shortly before the readiness failures, as in the original log; the logs do not record per-worker dispatch. The captured reply and the deterministic three-generation regression establish that the surviving read-pool singleton retained a mock whose cleanup callback belonged to a retired state-database lifecycle. The native three-generation regression also failed before the mapping with the same snapshot exception. After restoring the fix:
Proof used Blacksmith Testbox, lease An initial lease expired during local source staging before tests began. An auxiliary ordering probe used an unsupported Vitest CLI sequencer option and ran no tests; the permanent native ordered regression supplied that proof. Neither was counted as a test result. Diagnostic logging was removed, and the production snapshot guard, timeouts, and retry behavior were unchanged. |
Retire the shared state-read worker singleton with its state database lifecycle after drain. Otherwise a new file can reuse a pool whose cleanup callback belongs to a retired lifecycle and leak a mocked fleet reply into real workspace snapshots. Extend the native ordered lifecycle regression with three reader generations. It reproduces the exact workspace snapshot failure before the mapping and passes afterward; 20 standalone qualification runs pass. Production behavior and persistent state are unchanged. Co-authored-by: steipete <[email protected]> Co-authored-by: fuller-stack-dev <[email protected]>
Closes #154205
Related: #154160
What Problem This Solves
Shared Vitest workers could carry a mocked read pool into another test file, causing real workspace snapshot reads to receive
fleet.listreplies.User Impact
No production behavior changes. The fix removes an order-dependent CI failure without weakening workspace validation, authority checks, or test assertions.
Why This Change Was Made
The read pool registers cleanup callbacks only when its global singleton is first created. Test teardown retired its state-database lifecycle but not the pool singleton, so later pools could lose their cleanup owner. Add that existing singleton to the existing drain-before-retire map.
The expanded native regression walks three reader generations and reaches the actual workspace snapshot consumer. It fails with the same CI exception before the mapping and passes afterward. This repairs the owning test infrastructure rather than changing the downstream readiness tests.
A direct main hotfix was attempted after qualification and refused by GH013 (changes must be made through a pull request); no bypass was used.
Evidence
78d6474dad01ff081ae2e5a1b0a687a3b5b4c0b7passed hosted CI 35547821032. Native review, hosted preparation, and merge completed; merge93d69d5a747432362027bbdf71eb06c96aac6eb6is on current main. All three landed files equal the reviewed head, both human coauthors are preserved, issue Shared read mocks survive SQLite test lifecycle retirement #154205 is closed, and the retained native receipt iscomplete.Unexpected workspace state snapshot resultbefore the mapping; all five ordered fixture files pass afterward.tbx_01m30n55w5nbc83bvbvy3vh710: original 218-file failing cohort passes 3/3 runs; each has 216 passed files / 2 skipped, 2,841 passed cases / 16 skipped. Vitest walls: 114.36s, 103.07s, 104.02s. Existing runner/lifecycle siblings also pass (two files, three outer cases; 15.44s command wall). Command exit 0; lease readback confirms completed.check-changedpasses root test types, lint, formatting, dead exports and guards. Fresh isolated P1 review has no actionable findings;git diff --checkpasses.Worked on by
Work sessions
View the OpenClaw team session