Repository navigation
improve(tests): reuse PowerShell completion process - #118381
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 1:58 AM ET / 05:58 UTC. ClawSweeper reviewWhat this changesThe PR changes CLI completion tests to send serialized requests through one persistent PowerShell process per test file instead of launching PowerShell for every assertion. Merge readinessKeep this PR open for normal maintainer merge handling. Current main still starts a fresh PowerShell process for each completion assertion, while this branch replaces that repeated startup with a per-file queued runner, retains real Priority: P3 Review scores
Verification
How this fits togetherOpenClaw generates shell-completion scripts from each CLI command tree, and the test harness runs those scripts through real PowerShell completion APIs. This PR changes only the test-side process lifecycle between generated completion scripts and assertion results. flowchart LR
A[Completion test cases] --> B[Per-file request queue]
B --> C[Persistent PowerShell process]
C --> D[Generated completion script]
D --> E[Framed completion results]
E --> F[Assertions and clean shutdown]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +261, Tests +28. Total +289 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the generated-script and real Do we have a high-confidence way to reproduce the issue? Not applicable as a user-facing bug: the requested outcome is a faster real-shell test harness. The PR body provides a concrete exact-head PowerShell run and timing comparison for the changed test behavior. Is this the best way to solve the issue? Yes. A single process per isolated test file preserves separate test-file lanes while avoiding the repeated startup cost; the queue and per-request re-registration make this a more maintainable approach than parallel ad hoc shell invocations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d7ab20a72773. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
1a11169 to
337628b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
The completion CLI tests launched a fresh PowerShell process for every live completion assertion. The two owner files made 48 real
pwshstartups even though each case only needed a clean native completer inside the same shell runtime.Why This Change Was Made
Use one explicit PowerShell runner per test file, serialize versioned base64-framed requests, and remove/re-register the
openclawcompleter before and after every case. Every generated script still comes from the production completion owner and every assertion still executes real PowerShellCommandCompletion. The two files remain in their existing isolated lanes; sharding and concurrency are unchanged.User Impact
No runtime or user-visible behavior changes. Real-shell completion coverage finishes much faster with deterministic per-case diagnostics and strict timeout/exit handling.
Evidence
git diff --check, and autoreview are clean.Exact rebased real-shell proof
Exact head
337628b20827a4d83097a31ea0f4ef511b94511f:src/cli/completion-cli.aliases.test.ts: 11 passed, including five real PowerShell alias requests; the persistent runner exited cleanly inafterAll.src/cli/completion-cli.test.ts: 84 passed, including every real PowerShell value, quoting, injection-safety, nested-path, and option-form assertion; the persistent runner exited cleanly inafterAll.pwshprobe:Register-ArgumentCompleter -Native -CommandName openclaw -ScriptBlock $nullprintedOKand exited 0.ScriptBlock[AllowNull]and removes the completer key when the value is null inExtensibleCompletion.csand itsSetKeyValuehelper.