Repository navigation
fix(test): drain session fixtures before removing state - #144087
Conversation
Wait for each session fixture's native transcript reconciliation and state cleanup before deleting its temporary directory. Attempt all owned roots, retain failed cleanup state, and preserve the existing test assertions. Related: #144034 Preserves the session regression coverage from #137381 by @jalehman.
|
🦞👀 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 10, 2026, 10:05 AM ET / 14:05 UTC. ClawSweeper reviewWhat this changesThe session regression tests now drain their background work before deleting temporary state, retaining directories and reporting errors when cleanup fails. Merge readiness✅ Ready for maintainer review This remains a useful, focused fixture-lifecycle repair: current main still removes these directories without draining reconciliation. No introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherSession regression tests exercise OpenClaw’s SQLite transcript storage, which can schedule background reconciliation. Their teardown must finish that work before removing fixture files so later tests do not inherit active database work. flowchart TD
A[Session regression tests] --> B[Tracked fixture directories]
B --> C[Drain writers and reconciliation]
C --> D[Close fixture databases]
D --> E{Cleanup succeeded?}
E -->|Yes| F[Remove temporary directories]
E -->|No| G[Retain directories and report errors]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +21. Total +21 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep fixture disposal behind the existing session-state drain while preserving the regression assertions and failed-cleanup evidence. Do we have a high-confidence way to reproduce the issue? Yes for the fixture-lifetime defect: current main deletes directories without awaiting their reconciliation owner. Tests were not run here, and the precise causal link to the observed TaskFlow failure remains unproven. Is this the best way to solve the issue? Yes. Calling the established cleanup helper before directory removal repairs ownership at the fixture boundary without changing production coordination, assertions, or timeouts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 03628385d332. 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.
|
) Wait for each session fixture's native transcript reconciliation and state cleanup before deleting its temporary directory. Attempt all owned roots, retain failed cleanup state, and preserve the existing test assertions. Related: openclaw#144034 Preserves the session regression coverage from openclaw#137381 by @jalehman.
Related: #144034
Related: #137381
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Resolves a problem where session regression tests leave native transcript-reconcile workers running after their fixture directories are deleted. In shared
unit-fastworkers, that work can overlap later TaskFlow teardown and contend on the shared-state lifecycle lock.The investigation started with the TaskFlow teardown failures in CI. The unchanged CI base reproduced the failures, so the model-defaults change in #144034 is not required to trigger them.
Why This Change Was Made
The fixture now drains each owned root through the existing
cleanupSessionStateForTesthelper before removing its directories. Teardown attempts every root sequentially, preserves the directories and tracker if any drain fails, and reports one original error or aggregates multiple failures.The change is confined to one test file: +23 / -2 lines, with every test body unchanged. It retains the session rewrite regression coverage contributed by @jalehman in #137381.
User Impact
Developers get complete fixture cleanup in shared-worker test runs. Production behavior, database coordination, and runtime APIs are unchanged.
Evidence
pnpm check:changed: passed (exit 0) on the frozen final source. The earlier lint failure remains in the local evidence; this is a completed whole-gate rerun after its correction.Attribution limit: the earlier baseline run reproduced TaskFlow failures, while later instrumented runs identified escaped native owners and same-path contention separately. Those instrumented runs did not capture a failing TaskFlow stack with the native holder fully correlated. The repair is supported by the fixture ownership defect and direct cleanup-boundary proof.