Skip to content

refactor(test): simplify Vitest launch and project ownership - #139377

Merged
steipete merged 2 commits into
mainfrom
codex/vitest5-simplify
Sep 5, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/vitest5-simplify

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #139360
Related: #138264

What Problem This Solves

Focused Vitest runs started another Node/tsx orchestration process before reaching the existing project runner. Plugin selection duplicated the canonical routing chain and kept a stale option table that rewrote valid Vitest 5 operands from plugin directories—for example, --tagsFilter slow became --tagsFilter browser/slow, and --max-workers 2 became --max-workers browser/2.

Root discovery also omitted the isolated UI project even though the shared UI owner excludes all 34 of its files. Native root discovery returned no result for an isolated UI test that its dedicated project correctly found.

Why This Change Was Made

Call the existing project execution owner directly with explicit arguments and environment. It continues to own native children, bounded generations, report completion, and cancellation; public entrypoints retain final outcome reporting. Invocation owners prepare thread-budget settings and pass them to the minimal compiler owner. Remove the obsolete child entry, delegation helper, duplicate plugin predicates, and stale option table; reuse the existing CLI classifier and plugin resolver. Report utilities now use the same Node launcher instead of requiring pnpm on PATH.

Register the existing isolated UI owner in the root aggregate and extend its ownership regression. The dependency patch, worker limits, ordering, isolation, and preparation/report contracts remain intact.

User Impact

Developers get faster focused launches, correct Vitest 5 option forwarding, and complete root UI discovery. Existing plugin assignments remain identical across all 149 registered roots. Production runtime code is unchanged.

Evidence

Final candidate: b38bcbfda3fd15ef1e1901e6c327080fb554e6d7; frozen baseline: ae8f9b612aaa241beb26c76bf58706d0d6f29715.

Controlled Linux proof: Node 24.19.0, pnpm 12.3.4, four fixed CPU affinities, two Vitest workers, one warmup and seven alternating measured pairs per workload.

Real CLI workload Baseline median Candidate median Paired result
Focused file, 192 tests 1.09984 s 0.94420 s 14.11% lower wall time; 7/7 pairs improved
Mixed projects, 201 tests across 3 files 6.73623 s 6.72808 s Effectively unchanged; ratio 0.997565

All 32 invocations passed with identical native test/status inventories. All 38,136 tracked source entries, including modes, symlinks, and deletions, matched before/after measurement and final local verification. The committed tree matches the measured tree. Downloaded evidence archive SHA256: bd440939c7037e2997f261956301ba2588c106a4431a36f9902bbbc33dcc8653. The lease is completed. The earlier shared-Mac timings were too noisy to support a speed claim and remain retained; no full-suite speedup is claimed.

  • 531 focused tooling/routing/native-lifecycle tests passed, including public .mjs and direct .mts entrypoints, success/failure/startup/help/signals, final trailer ordering, and temporary/generation cleanup.
  • Native root UI run: all 34 files passed, 634 tests passed and one intentionally skipped.
  • Full compiled-worker suite: all 36 tests passed after the final environment-owner correction, including copied-source/private-dependency/build-error/mutation/disposal cases and the actual compiler thread-budget receipt.
  • Report helper: all seven tests passed, including native JSON generation and report reuse with an empty package-manager PATH.
  • Red-before/green-after evidence covers eight native operand/tail cases, plugin-cwd empty-inline exclusion, missing root UI registration, compiler thread limits, and the legacy report launcher's pnpm requirement.
  • Final changed-scope checks, Knip production and all-exports audits, and independent Codex review through P2 passed. No dependency ignores, baselines, or checks were weakened.
  • Direct dependency source inspection completed against the installed pinned Vitest 5 distribution: dist/chunks/cac.D805sv8h.js (SHA256 f37acc539be54a668448c9ae1faeacc4b37df68f81952a21001c377a775da55e), MRI operand handling at lines 13–108, CAC separator handling at 559–575, option declarations at 938/1161/1196/1225, and parseCLI at 2316–2338. Regressions additionally exercise the actual native parser.
  • LOC: tooling +42/-231 (net -189); tests/config +163/-93 (net +70); total net -119. Two deleted tests only asserted the removed helper's spawn shape; native lifecycle coverage remains.

Initial CI exposed a new scheduling import outside the copied compiler closure on both Windows and Linux, plus the legacy raw Vitest binary in the dependency scan. The repair keeps environment preparation in the invocation owner and routes the report helper through the canonical launcher. Both failed contracts pass locally and in final exact-head CI. The final run needed one exact-job retry for an unchanged authorization-fixture early-exit assertion; all three local authorization cases and the retried full job passed. Authorization checks were not changed. Captured subprocess output should be added to that fixture's assertion diagnostics in a follow-up.

The broader audit identified a separate project-sequencing opportunity that needs shared-state and mixed-worker-limit proof. This PR preserves the existing scheduling policy.

ClawSweeper follow-through: the requested controlled Linux comparison and native identity checks are complete above. Maintainer inspection of the pinned dependency source and native parser tests addresses the reviewer's source-access limitation. A refreshed review was requested for the final head; the existing completed review is under 12 hours old and its stated proof items are resolved.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@steipete steipete self-assigned this Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 4:47 PM ET / 20:47 UTC.

ClawSweeper review

What this changes

Simplifies focused test launches, preserves Vitest option operands, centralizes plugin test routing, and restores isolated UI tests to root discovery.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains useful: current main still contains the operand-rewriting defect and omits isolated UI tests from root discovery. No actionable introduced defect was found, and the maintainer-owned PR is not eligible for cleanup closure.

Priority: P2
Reviewed head: 420119901f27fbb3166dcfe397f329518f1d0177

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful native regression evidence and no supported blocking code finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports native launcher lifecycle runs, repaired compiler thread limits, and successful isolated-UI execution; those runs were not independently repeated here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports native launcher lifecycle runs, repaired compiler thread limits, and successful isolated-UI execution; those runs were not independently repeated here.
Evidence reviewed 9 items Current-main operand defect remains: Current main retains the separate option table without --tagsFilter or --max-workers; their operands fall through to plugin-path rewriting.
Current-main discovery omission remains: The root project list registers shared UI but not isolated UI. The inspected shared UI config excludes the isolated inventory, while the dedicated isolated config includes it.
Execution and cleanup ownership: The launcher now invokes the existing project runner directly. That runner still joins admitted shards, disposes compiled workers, finishes reports, removes signal listeners, and propagates termination.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test launcher converts developer and CI test selections into Vitest projects and child processes. It owns worker preparation, cancellation, cleanup, and final test reports.

flowchart TD
  A[Developer or CI test request] --> B[Test launcher]
  B --> C[Argument and project routing]
  C --> D[Project execution owner]
  D --> E[Compiled worker preparation]
  D --> F[Native Vitest processes]
  E --> F
  F --> G[Cleanup and final reports]
Loading

Before merge

  • Resolve merge risk (P1) - Independent inspection of Vitest 5 parser source remains incomplete because the dependency source was unavailable locally and upstream retrieval failed; this is a reviewer limitation, not missing contributor proof.
  • Resolve merge risk (P1) - Controlled Linux measurements remain pending in the captured evidence, so no wall-time improvement is established.
  • Complete next step (P2) - Record the controlled Linux comparison promised before landing, preserving test identities and outcomes.
Agent review details

Security

None.

PR surface

Tests -42, Other -92. Total -134 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 7 114 156 -42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 8 32 124 -92
Total 15 146 280 -134

Review metrics

Metric Value Why it matters
Implementation versus regression coverage Application runtime +0/-0; tooling +37/-222; tests/config +109/-58 The refactor reduces executable tooling while extending operand, compiler-budget, and project-ownership coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #139360
Summary: This PR is the explicit candidate fix for the paired focused-launch and test-ownership issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one project-execution owner and canonical argument routing while preserving native worker budgets, cancellation, reports, and complete UI discovery.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one project-execution owner and canonical argument routing while preserving native worker budgets, cancellation, reports, and complete UI discovery.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: plugin-directory operands fall through to path rewriting, and root discovery omits the owner of explicitly excluded UI tests. No tests were executed during this read-only review.

Is this the best way to solve the issue?

The consolidation addresses the owning boundaries without another routing table or wrapper. Full native-operand compatibility remains independently unverified because Vitest dependency source could not be inspected.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ea94f24ebb21.

Labels

Label justifications:

  • P2: Fixes concrete developer test-selection and discovery defects with a limited tooling blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured evidence reports native launcher lifecycle runs, repaired compiler thread limits, and successful isolated-UI execution; those runs were not independently repeated here.

Evidence

What I checked:

  • Current-main operand defect remains: Current main retains the separate option table without --tagsFilter or --max-workers; their operands fall through to plugin-path rewriting. (scripts/lib/extension-vitest-paths.mts:63, ea94f24ebb21)
  • Current-main discovery omission remains: The root project list registers shared UI but not isolated UI. The inspected shared UI config excludes the isolated inventory, while the dedicated isolated config includes it. (test/vitest/vitest.config.ts:58, ea94f24ebb21)
  • Execution and cleanup ownership: The launcher now invokes the existing project runner directly. That runner still joins admitted shards, disposes compiled workers, finishes reports, removes signal listeners, and propagates termination. (scripts/test-projects-run.mts:277, 420119901f27)
  • Dependency contract and regression coverage: The changed operand tests directly import parseCLI from vitest/node and compare native parsing after translation. This establishes a Vitest dependency signal; Codex-named paths are routing fixtures, not a Codex runtime contract. Installed Vitest sources were absent and the attempted upstream source read failed, so independent parser inspection remains incomplete. (test/scripts/test-extension.test.ts:834, 420119901f27)
  • Native compiler budget coverage: The extended subprocess test observes the actual compiler process environment, asserts native thread limits of 2/2, and retains checks for one shared generation and cleanup after completion. (test/scripts/vitest-worker-artifacts.test.ts:807, 420119901f27)
  • Captured proof and review continuity: The supplied body reports frozen baseline/candidate installs, 531 tooling and lifecycle tests, a native isolated-UI run with 634 passing tests, failing baseline operand cases, and observed compiler budgets changing to 2/2. It explicitly promises controlled Linux measurements before landing. The previous review used this same head, had no findings, and requested those measurements; no completion is present in the captured context. Source revision: ea4c361aa4c895dfc3114320e1fc93eb11d0e307da3f2595402a61d1c742c78d. (420119901f27)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the promised controlled Linux comparison with identical test identities and outcomes.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-05T20:41:32.287Z sha 4201199 :: blocked before merge. :: none

@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR body now includes the completed final-source controlled Linux comparison and direct pinned Vitest parser inspection. The pushed CI repair keeps compiler environment preparation in the invocation owner and routes report generation through the canonical launcher; full native worker/report suites and dependency audits pass locally.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 7190241 into main Sep 5, 2026
243 of 245 checks passed
@steipete
steipete deleted the codex/vitest5-simplify branch September 5, 2026 21:40
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…w#139377)

* refactor(test): simplify Vitest launch and project ownership

* fix(test): preserve compiler and report execution boundaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify focused Vitest launches and preserve test ownership

1 participant