Repository navigation
fix(test): drain canonical state fixture directories - #159281
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 26, 2026, 8:34 PM ET / September 27, 2026, 00:34 UTC. ClawSweeper reviewWhat this changesThe branch canonicalizes temporary test state paths before passing them to tests and adds a real-filesystem regression case with a symlinked temporary parent. Merge readiness✅ Ready for maintainer review Keep open. Current main still gives scoped cleanup a lexical state path that can differ from canonical database paths. This focused PR addresses that gap; the merged teardown-order repair addressed a separate race. Priority: P2 Review scores
Verification
How this fits togetherA shared test helper gives OpenClaw tests an isolated state directory. Its teardown drains session and database resources for that directory, restores the environment, and removes the temporary files. flowchart LR
A[Test requests isolated state] --> B[Create temporary directory]
B --> C[Resolve canonical state path]
C --> D[Test uses state directory]
D --> E[Drain scoped resources]
E --> F[Restore environment and remove files]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +26. Total +26 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one canonical state-directory identity throughout fixture use and scoped teardown, with the symlinked-parent case guarding the cleanup contract. Do we have a high-confidence way to reproduce the issue? Yes, as a source-backed path: run the symlinked temporary-parent case against current main's lexical-path helper. The PR reports a pre-fix failure and after-fix pass; this read-only review did not execute the test. Is this the best way to solve the issue? Yes. Resolving the state path where the shared fixture creates it makes the callback, environment, and scoped cleanup agree without adding a second cleanup rule. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 389cee4cb104. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes test fixture cleanup missing database workers when the temporary state directory has a symlinked parent, such as
/varversus/private/varon macOS.User Impact
No user-visible change. This is a test-helper repair; installed state, configuration, ports, SDK, schemas, durability, retention, and permissions are unchanged. No migration is required.
Why This Change Was Made
The fixture supplied a lexical state path, while database owners and some callers used its canonical path. Root-scoped drainage could therefore miss the database resources before the fixture directory was removed. Resolve the new state directory once and use that same canonical root for the environment, callback, and existing ordered cleanup.
The existing helper scenario now covers both ordinary and symlinked temporary parents with real filesystem operations. The symlink case fails on the original helper and passes after this change. It adds no production seam, sleep, retry, timeout increase, or broader cleanup mock.
The related session-group teardown-order repair already landed in #159163 as
d9fd43d6cf4286e1734e4a6ff91b962cb3e35e82; this PR preserves that fixture unchanged and publishes only the remaining helper defect. It is a separate prerequisite discovered while landing the system-job scheduler slice.Evidence
Remote provider: blacksmith-testbox, lease
tbx_01m3fz4ar9ygxxkxh5y2qjc40x, run 36278033418. The job used the original CI class,blacksmith-32vcpu-ubuntu-2404, with 8 actual logical CPUs and 33,229,729,792 bytes RAM. Runtime versions matched the original failure: Node 24.19.0 and the repository's checksum-pinned Bun build. Frozen dependency installs preceded proof.0b0cc375ade9a9e9d6e096b49757a07625599e47pnpm test src/test-helpers/state-dir-env.test.ts --maxWorkers=1pnpm test src/gateway/session-group-mutation-targets.test.ts --maxWorkers=1The shard commands used
node --import tsx scripts/ci-run-node-test-shard.mtswith the original five-group manifest, worker intersections, Node/Bun routing, and plan concurrency. These broader results belong to the earlier three-file candidate at treeec2fe5ee7c106dffd66866460765e833215fb603, based on547bb312f4098cd0f28f71cc45a7e351e944b1ff. The two helper files here are byte-identical to that proved candidate. Fresh main independently supplied the Gateway fixture repair, so the final PR does not duplicate it. Exact-head hosted CI owns the refreshed composition.Deslop and formatting/diff checks passed. The initial Codex review identified the canonical-path mismatch; it was corrected, and review was clean through P2. The final two-file follow-up received a fresh scoped Codex review before publication. Exact-head CI run 36282647720 passed on
17e0aaba7266d815374307518a32a316c4a44fd5in 797 s workflow elapsed, including the enforcedopenclaw/ci-gate. Auto-merge landed5e0d86f46d83a0bf81dd4242ccb7ce86d23d0a40, verified onorigin/main.LOC: production +0/−0/net 0; tests/support +41/−15/net +26; docs +0/−0/net 0. The temporary resource-class workflow used for proof is excluded from this PR.