Repository navigation
chore: speed up worktree recovery tests with Bun - #157674
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 24, 2026, 9:26 PM ET / September 25, 2026, 01:26 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch reuses a suite-owned SQLite fixture, awaits Doctor test cleanup, and runs exact worktree-recovery CI selections on Bun while retaining Node coverage. Merge readiness✅ Ready for maintainer review The PR remains useful: current main lacks the qualified Bun route, and the merged fixture work covers only part of this change. The reported exact-launcher run and focused review support the patch; no actionable defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s CI launcher receives a test selection and runtime policy, then starts the appropriate Vitest process. The recovery suite checks Git worktree removal using test-owned Git and SQLite state. flowchart LR
A[CI test selection] --> B[Runtime policy]
B --> C{Exact recovery selection?}
C -->|Yes| D[Bun test run]
C -->|No| E[Node test run]
B -->|Dual validation| E
D --> F[Recovery assertions]
E --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +83, Docs +6, Other +33. Total +122 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Preserve a faster, complete recovery test run on the pinned Bun build, with Node validation and case isolation maintained. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR optimizes test execution. The PR records matched before/after runs and an after-change run through the actual shard launcher. Is this the best way to solve the issue? Yes: the selector admits only the measured recovery file to Bun and keeps mixed selections on Node; the fixture changes retain the existing assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ef2dd3235123. 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
History |
b9bf1bf to
0f58357
Compare
0f58357 to
e1e4439
Compare
* commit '05edd36e124dc376f63475256f45e82ec437412c': (30 commits) refactor(matrix): reuse bounded direct-room cache insertion (#157775) fix: preserve channel-owner revocation across recovery (#157709) fix(ci): stop blocking CI during release validation (#157757) refactor(tlon): remove unreachable DM summary branches (#157789) chore: speed up worktree recovery tests with Bun (#157674) fix(sessions): release PR caches when pending viewers leave (#157776) refactor(twitch): reuse setup account selection (#157787) test: skip empty task ledger resets in cron fixtures (#157767) perf: reduce gateway and state test startup (#157711) fix: preserve maintenance leases during slow heartbeat renewal (#157696) fix(channels): match non-TTY setup advice to registered flags (#157551) fix: keep failed update report uploads in the CLI (#156633) fix: preserve rejected settings reason when opening config (#157731) test(update): load real filesystem dependencies in swap fixture fix(ci): prevent Security Review checkout retry collisions (#157652) fix(ci): recover interrupted Security Review response bodies (#157651) test(ui): capture live operator authority in guest question fixture refactor(agents): deslop runners, harness and recovery (#157294) fix(auth): preserve Copilot tenant credentials during Doctor repair (#139131) refactor(msteams): share stored service URL validation (#157706) ...
|
Merged via squash auto-merge.
|
* test: reuse the worktree removal recovery database * test: join database shutdown before reopening migration fixtures * ci: run qualified worktree recovery selections with Bun
What Problem This Solves
Worktree recovery tests repeatedly pay SQLite startup and shutdown costs, and a migration fixture reopens databases before asynchronous shutdown completes.
User Impact
No product behavior changes. All 61 existing fixture cases retain their assertions. Qualified worktree-recovery selections run on Bun for PRs; mixed PR groups retain Node. Dual-runtime validation keeps the complete Node selection and adds the selected qualified Bun coverage.
Why This Change Was Made
Worktree recovery reuses a suite-owned database and deletes each case's exact registry record after operations settle. A teardown assertion detects leaked run leases, and final teardown awaits closure before directory removal. Main's prepared Git template and batched snapshot refs remain intact. The migration fixture now uses the existing scoped cleanup operation before reopening instead of synchronous helpers that start background shutdown.
The runtime selector admits the worktree-recovery file only when it is the entire exact PR selection. It preserves unsupported-argument fallbacks and the original Node coverage in release validation. Both runtimes retain Vitest's assertions, loaders, compiled subprocesses, reporters, and resource budgets.
Evidence
Matched Linux measurements on final tree
0486a62ce59adc200b2949044547d10b0332a766(based9a69464657d), one AWS m7i.xlarge, one worker, unchanged budgets, and separate disk-backed caches:All four cells pass the exact same 58 cases with zero skips. Bun is 21.5% faster than optimized Node; original Node to optimized Bun is 53.5% faster. Bun uses the checksum-pinned OpenClaw fork build.
The actual
ci-run-node-test-shard.mtslauncher, supplied the qualified target andbun-compatiblepolicy without an explicit runtime override, selected Bun and passed all 58 cases in 50.342 s. The test command and final source check completed successfully. The lease expired during subsequent harness cleanup, so the outer Crabbox command returned 7; the paired JSON reports and streamed launcher result were preserved.The migration fixture reproduces three failures under Bun before the repair and passes all three afterward. The same Bun forks diagnostic group replay passes 1,485 files and 19,555 cases, with the same four skipped files and eleven skipped cases. Bun still emits its existing directory-cache and occasional worker-shutdown warnings; no broad pool or native-import change is included.
After rebasing onto
d9a69464657d, all 61 fixture cases and 145 runtime-selection cases pass locally. Independent reviews are clean through P2. The final tree is0486a62ce59adc200b2949044547d10b0332a766. The full Linux changed-file gate passed on the reviewed superset before the conflict-only rebase; focused tests and runtime qualification passed on the final tree. Hosted CI attempt 2 passed both changed-test jobs (147 s and 154 s). The recovery suite ran on the checksum-verified fixed Bun fork: all 58 cases passed in 57.69 s of Vitest time and 61.15 s including its launcher. The three migration cases also passed on Bun in 17.48 s of Vitest time and 20.65 s including the launcher. Both archive and executable checksums were verified; the runtime revision was1.4.3-canary.1+ddfce5d01. Hosted timings include different runner/cache conditions; the matched Linux table above is the runtime comparison.Canonical local single-worker command costs on Node 26.9.0: worktree recovery 100.82 s, migration cleanup 17.02 s, and runtime-selection tests 8.64 s. Compiler preparation varied across local fixture measurements, so the Linux paired results above carry the speed comparison. The new selection cases take about 20 ms. In hosted CI, the routing file passed all 145 cases in 2.330 s of file test time; its containing two-file envelope took 46.54 s including preparation. Full changed-file checks passed for the fixture patches; script/test type checks, lint, formatting, and independent P2 review passed for the routing change.
Earlier CI used a merge base with the
UpdateStepResultimport defect; this branch includes its owning fix, #157659. An overlapping session-fixture improvement landed in #157685, so this PR retains that main implementation and contains no session-recovery fixture delta. The resolved head was deferred by Full Release Validation runner priority. Once its owner cleared priority, CI attempt 2 passed on the same head. Its final aggregate waited 14 m 21 s for a hosted runner, then passed in 4 s; that allocation delay is separate from test execution time. Security Review and the exact-head ClawSweeper review are clean.