Repository navigation
fix(test): restore fixture state and await async completion - #164222
Conversation
Restore PATH bootstrap state at its CLI test owner, join plugin capture retirement before removing state, and await scheduler, chat, persistence, and dispatch completion signals. Keep filesystem snapshots order independent and avoid eagerly loading the memory watcher before its controlled fixture. Production behavior and test isolation remain unchanged.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 9:06 AM ET / 13:06 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR repairs test fixture cleanup and environment restoration, waits for asynchronous completion, and makes directory comparisons independent of enumeration order. Merge readiness✅ Ready for maintainer review The PR remains useful and has no identified introduced correctness or security defect. The updated evidence and explicit repository-admin acceptance resolve the previous repetition-completeness blocker. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s test fixtures exercise CLI startup, Gateway operations, workers, and plugins. They must retain temporary resources until owned work completes and restore shared state before subsequent tests. flowchart TD
A[Test scenarios] --> B[Fixture setup]
B --> C[CLI Gateway and plugin operations]
C --> D[Owned completion signals]
D --> E[Existing behavior assertions]
E --> F[Resource retirement and state restoration]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +60. Total +60 across 14 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep fixture lifecycle ownership explicit while preserving the existing behavior assertions, test order, isolation, and operation deadlines. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the fixture lifetime defects, and the captured evidence describes controlled old-fails/new-passes experiments and original-order reproductions. This read-only review did not execute them. Is this the best way to solve the issue? Yes, the patch uses existing cleanup and completion owners, preserves assertions, and fixes shared state at its fixture producer rather than adding isolation or extending operation deadlines. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f965e0ea73ef. 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 (5 earlier review cycles)
|
The registry-only cache fixture could reopen a database while synchronous close had left asynchronous resources retiring. Join the existing close owner before registry handoff and the incognito closed-generation check. Held-resource controls reproduce the closing guard before the fix and pass afterward on Node and Bun. All 26 file cases pass on both Linux runtimes and local Node/Bun. P2 review and changed-file checks pass. Assertions, test counts and production code remain unchanged.
|
@clawsweeper re-review Please review exact head The maintainer has explicitly decided to land without the remaining 53 Bun standalone and 28 original-order repetitions or six combined gateway runs. Repetition completeness is a maintainer judgment; these unrun jobs are optional proof polish, not claimed passes. The PR body retains all investigated sibling failures and both unresolved historical rows. The five Slack failures belong to the separately fixed runtime formatter gap in openclaw/bun#92. Please identify any introduced code/security defect; the previous review found none and raised only unfinished repetition. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* origin/main: fix(test): restore fixture state and await async completion (#164222) refactor(sessions): stage and settle pending inputs in workers (#164284) fix: speech-only replies fail when models include reasoning (#164285) fix(nextcloud-talk): avoid webhook migration for unconfigured channels fix: guide background skill reviews through Workshop proposals (#164292) test(build): reject AI dependencies in retained config repairs refactor(channels): require canonical private-network settings (#163535) fix(memory): migrate embedding cache in bounded batches and record oversized rows (#164303) feat(state): incognito actor memory and Codex history routing (P5c, inactive) (#164224) refactor(synology-chat): remove unused route account ID (#164280) test(ui): await web push preference publications (#164295) perf(scripts): avoid compiler projects for runtime import parsing (#164243) fix(worktrees): create workspaces from nested Windows repositories (#164249) test(agents,channels,cli): remove low-value tests (batch d173) (#164302) perf(workboard): serve cards per board revision and push changes instead of polling (#164301) refactor(sqlite): deslop sqlite stores (#164271) chore(ui): refresh control ui locales (#164299) refactor(events): deslop listener and disposal plumbing (#164221) fix: canonicalize fresh worker reasoning signatures (#164287)
…#164222) * fix(test): restore fixture state and await async completion Restore PATH bootstrap state at its CLI test owner, join plugin capture retirement before removing state, and await scheduler, chat, persistence, and dispatch completion signals. Keep filesystem snapshots order independent and avoid eagerly loading the memory watcher before its controlled fixture. Production behavior and test isolation remain unchanged. * fix(test): await session cache database retirement The registry-only cache fixture could reopen a database while synchronous close had left asynchronous resources retiring. Join the existing close owner before registry handoff and the incognito closed-generation check. Held-resource controls reproduce the closing guard before the fix and pass afterward on Node and Bun. All 26 file cases pass on both Linux runtimes and local Node/Bun. P2 review and changed-file checks pass. Assertions, test counts and production code remain unchanged. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes intermittent Node/Bun test failures when CLI bootstrap state escapes its fixture, cleanup outlives temporary storage, or assertions run before asynchronous work completes.
User Impact
No user-visible production change. Runtime validation keeps its existing assertions, test-case order, file isolation, and operation deadlines while owning fixture setup and cleanup correctly. Production LOC delta: 0.
Why This Change Was Made
The CLI fixture now restores PATH and its bootstrap marker; the cron fixture joins plugin-cache retirement before removing state. A registry/cache fixture now awaits database retirement before re-registering the same path or observing its closed generation. Chat, profile binding, Codex persistence, iMessage dispatch, and config reload tests wait for their actual completion signals. The worker's existing two-second close/replay deadline begins at readiness, with test cancellation still terminating the worker.
Recursive directory snapshots compare exact path membership independent of enumeration order. The FTS fixture removes an eager, redundant cleanup import that captured a real watcher before its controlled observer was installed. Existing test helpers were moved into narrow support files to keep over-cap files from growing; no test cases were added or removed.
Evidence
run-mainfollowed by service-admission reproduces all five Bun failures by selecting the older system Node. Restoring the producer's environment makes the pair and complete 394-file original invocation pass on both runtimes.Receipt audit: every qualified post-fix target run passed. The audit checked 259 raw result/order receipts across the standalone matrix, original-order replays, and cache follow-up, retaining source-hash qualifications. No completed candidate target assertion failed. The two resource-cancelled methods attempts ended before target completion and remain unproven; unrelated sibling failures remain red.
The table reports completed qualified standalone runs, not the originally planned denominator. The original fixture/victim matrix completed 199/252 planned runs, plus 7 additional Node controls. The cache follow-up separately completed 20 Node runs and 1 Bun control.
src/cli/run-main.test.tssrc/cli/daemon-cli/restart-health-client.test.tssrc/worker/worker-connection-closing-window.test.tssrc/cron/trigger-script.preparation.test.tssrc/gateway/config-reload.test.tssrc/gateway/server-methods/chat-send-compaction-handoff.test.tssrc/gateway/server-methods/chat-send-profile-binding.test.tsextensions/codex/src/app-server/run-attempt.test.tsextensions/imessage/src/monitor.last-route.test.tsextensions/memory-core/src/memory/manager.fts-only-reindex.test.tsextensions/msteams/doctor-contract-api.test.tssrc/cli/update-cli/update-command-service-admission.test.tssrc/gateway/server-methods/sessions-read-cache.test.tsThe remaining 53 Bun standalone repetitions and 28 original-order jobs were deliberately not run, nor were the six proposed combined final-source gateway runs. The maintainer has decided that controlled before/after proof, the completed repetitions, green exact-head CI, and scoped-clean P2 review establish the repaired behavior. Additional repetitions are optional proof polish; the degraded lease broker supplies no reason to allocate replacement capacity. No replacement lease was allocated. This is an explicit maintainer judgment about repetition completeness, not a claim that the unrun matrix passed.
Current-head CI run 37120032729 passed at
4df149d8fd1c50b6995d9e9402fb48dabe2a0c73, without rerun or admin exception. P2 review is scoped-clean for both patch stages. The completed exact-head ClawSweeper review (2026-10-03 13:06 UTC, comment 5967919388) found no findings or security issue and no before-merge items. It explicitly accepted the updated evidence and maintainer decision as resolving repetition completeness.A two-case manual-clock diagnostic confirms the config-reload boundary on both runtimes: the old helper returns while the replacement pass is due, and awaiting that pass produces the original final events.
The additional registry-cache repair has a held-resource control on both runtimes: synchronous close reaches the actual closing-resource guard; awaited close retains ownership until retirement finishes. All 26 uninstrumented file cases, including the incognito close-result assertion, pass on Linux Node/Bun and local Node/Bun.
The complete 152-test Codex file passes on macOS Bun after preparing its required built history-worker artifact. Four earlier settled-finalization failures were a local build setup gap. Two separate historical failures (database-preflight artifacts and durable-context history coverage) did not reproduce in original-order or instrumented Node/Bun probes, including four-CPU runs; this PR does not claim to repair them. The five Slack files below are attributed to Bun's stale
Error.prepareStackTraceformatter state after Proxyline deletes/restores the hook. The 175-file original order and reducedrelay-source.test.ts→provider.transport-credentials.test.tspair fail on Bun e167, while Node controls and victim-alone runs pass. Dependency-free formatter witnesses confirm the runtime boundary. The coordinator reports that openclaw/bun#92 already fixes this gap and was verified with the next shared pin bump. No OpenClaw change is included for these five files:extensions/slack/src/monitor/ingress.auth-retry.test.tsextensions/slack/src/monitor/ingress.deferred-stop.test.tsextensions/slack/src/monitor/ingress.relay.test.tsextensions/slack/src/monitor/message-handler.debounce-policy.test.tsextensions/slack/src/monitor/provider.transport-credentials.test.tsThe two unresolved historical rows are
src/state/openclaw-database-preflight.artifacts.test.ts(deadline) andextensions/codex/src/app-server/run-attempt.durable-context.test.ts(history coverage). Their causes remain unresolved and this PR does not claim to fix them.Focused per-file cost (seconds, cold wrapper wall time, maxWorkers=1)
Node 24.21.0 and the release-matched Bun e167 binary on macOS; private home/state/temp directories. These are existing integration files. Several cold runs spend most of their time preparing the worker module graph. No new test cases or per-test process boots were introduced. CI test time sums recorded per-test durations, excluding setup/transform and shard overhead. CI timing below comes from successful exact-head run 37120032729; no rerun or admin exception was used.
src/cli/run-main.test.tssrc/cli/daemon-cli/restart-health-client.test.tssrc/worker/worker-connection-closing-window.test.tssrc/cron/trigger-script.preparation.test.tssrc/gateway/config-reload.test.tssrc/gateway/server-methods/chat-send-compaction-handoff.test.tssrc/gateway/server-methods/chat-send-profile-binding.test.tsextensions/codex/src/app-server/run-attempt.test.tsextensions/imessage/src/monitor.last-route.test.tsextensions/memory-core/src/memory/manager.fts-only-reindex.test.tsextensions/msteams/doctor-contract-api.test.tssrc/gateway/server-methods/sessions-read-cache.test.tsInvestigated historical-source and sibling failures
The Linux order replays keep the original production baseline and apply the reviewed fixture bytes. They are distinct from complete-head hosted CI. Failed full configurations and cancelled resource-limited attempts remain recorded; passing targets do not make those configurations green. The native review retains
tests.result: failwith the repository's structured investigated-local-failure disposition under the repository policy while normal CI and review gates remain in force.Error.prepareStackTrace. Node controls pass. Fixed separately in openclaw/bun#92 and verified on the next shared pin bump per coordinator; no OpenClaw workaround.HeapProfiler.collectGarbagecall. The config-reload target passes.The separately reproduced registry-cache closing-resource error is repaired by the awaited close in this PR. No speculative changes, deadline increases, test reordering, or added isolation address the unresolved rows above.