Skip to content

fix(cli): preserve the first PowerShell completion test failure - #157267

Merged
vincentkoc merged 1 commit into
mainfrom
fix/powershell-completion-first-failure-20260924
Sep 24, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/powershell-completion-first-failure-20260924

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Related: PowerShell CI failure in #157164.

What Problem This Solves

Fixes: PowerShell completion tests report a shutdown error instead of the original failure when the child fails and the caller closes the runner in finally.

User Impact

Developers retain the first useful error while diagnosing completion tests. There is no change to shipped completion generation, test deadlines, or process termination policy.

Why This Change Was Made

The test runner already records the first failure. Its close path now preserves that same Error before validating the child exit and when shutdown itself rejects. Three real-child cases cover an early exit, unexpected output followed by termination, and a child that ignores termination until the existing escalation.

Production: 0 lines changed. Test support: +1 net line; regression tests: +75 net lines.

Evidence

  • The unchanged helper fails all three real-child regression cases (including strengthened existing coverage) at the intended first-error assertion. The repaired helper passes all three, including queued rejection and caller-finally Error identity. Each fixture separately waits for actual child closure and both output streams to end.
  • Focused one-worker file wall times: 8.59 s baseline, 9.08 s candidate, on Node 24.21.0 / pnpm 12.4.2 / Vitest 5.0.1. These are single validation samples.
  • All 21 changed-path checks passed, including formatting, lint, ratchets, declarations, dead exports, and the selected commands and config-cli test type graphs.
  • Fresh read-only autoreview found no actionable issue. The 42 named source, test, install, and guidance entries match current main snapshot 5ad0819f87f9c0c95d7e7200b2af3aaa2be767a7.
  • Hosted exact-head CI remains pending.
Provenance and diagnostic limits

The two close-path error-masking branches were introduced by 6f6d501ccf9a in #118381, authored by @steipete. The later readiness fix in #134099 retained that close logic.

The original negative run retains its wrapper exit 1: its title oracle expected an untruncated Vitest case name. Independent inspection authenticated exactly the three intended assertion failures with no extra hook or unhandled errors. The candidate-only recovery used the actual generated names; it did not replay the baseline. Source remained unchanged, and both remote runs stopped normally.

A separate observation-only run of the original seven-file CI cohort at its tested merge passed 157 tests, with one unrelated fish case skipped. The PowerShell case executed all 20 requests and closed cleanly. Its native workload exited 0; the capture wrapper retained exit 70 because it did not recognize the shard-prefixed journal. Independent inspection authenticated the intact journal and closure without rerunning the cohort.

That diagnostic did not reproduce or explain the original hosted failure. The original cache state and PowerShell executable identity were not established as equivalent; no Windows-runtime or whole-CI qualification is claimed. The narrow warning-only temporary-file report compared an empty base-to-base range; the added test source was inspected separately. Post-stop portal synchronization warnings are retained and do not represent successful portal publication.

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 24, 2026 12:14
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 8:22 AM ET / 12:22 UTC.

ClawSweeper review

What this changes

The branch changes the PowerShell completion test helper to preserve its first failure during shutdown and adds real-child regression cases for early exit, unexpected output, and forced termination.

Merge readiness

✅ Ready for maintainer review

Current main still masks the first completion-test failure during cleanup. This focused PR addresses that defect, and the introduced diff shows no blocking correctness or security issue.

Priority: P3
Reviewed head: 83af3e381a4f9613db88594e9de65e96240b34df

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair and real-child regression cases provide good review signal, with execution results reported in the PR body.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its body reports before-and-after real-child runs through the changed test helper, while this review did not execute them; no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its body reports before-and-after real-child runs through the changed test helper, while this review did not execute them; no stored-data contract changes.
Evidence reviewed 7 items Introduced repair: The pinned PR delta checks the recorded failure before validating child exit and returns that failure if shutdown rejects.
Current-main defect: Current main validates a nonzero child exit before checking the recorded failure, and its catch block throws the shutdown error.
Boundary regression coverage: The changed test starts real child processes and checks queued rejection, caller-finally Error identity, and termination outcomes across three failure scenarios.
Findings None None.
Security None None.

How this fits together

OpenClaw’s CLI completion tests send requests to a PowerShell child process through a shared test helper. The helper queues requests and reports completion results, failures, and shutdown outcomes to the tests.

flowchart LR
A[Completion tests] --> B[Request queue]
B --> C[PowerShell child]
C --> D{Response or failure}
D --> E[Test result]
D --> F[First failure record]
F --> E
F --> G[Shutdown result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +76. Total +76 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 97 21 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 97 21 +76

Review metrics

Metric Value Why it matters
One-worker test wall 8.59 s → 9.08 s (+0.49 s) The PR reports a small measured cost for the added real-child regression cases.

Technical review

Best possible solution:

Keep first-error selection in the shared test helper for both request rejection and cleanup, guarded by the real-child regression cases.

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

Yes. Current-main source shows the recorded failure being displaced by exit or shutdown errors; the PR supplies a direct real-child test path, though this review did not run it.

Is this the best way to solve the issue?

Yes. Correcting first-error selection in the existing helper is narrower than changing completion generation or child termination behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b5346d6dafe6.

Labels

Label changes:

  • add P3: This repairs developer-facing test diagnostics without changing shipped completion behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its body reports before-and-after real-child runs through the changed test helper, while this review did not execute them; no stored-data contract changes.

Label justifications:

  • P3: This repairs developer-facing test diagnostics without changing shipped completion behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its body reports before-and-after real-child runs through the changed test helper, while this review did not execute them; no stored-data contract changes.

Evidence

What I checked:

  • Introduced repair: The pinned PR delta checks the recorded failure before validating child exit and returns that failure if shutdown rejects. (src/cli/completion-cli.test-support.ts:313, 83af3e381a4f)
  • Current-main defect: Current main validates a nonzero child exit before checking the recorded failure, and its catch block throws the shutdown error. (src/cli/completion-cli.test-support.ts:313, b5346d6dafe6)
  • Boundary regression coverage: The changed test starts real child processes and checks queued rejection, caller-finally Error identity, and termination outcomes across three failure scenarios. (src/cli/completion-cli.runner.process.test.ts:30, 83af3e381a4f)
  • Existing test consumers: Completion suites use the shared PowerShell runner and call close from their test lifecycle, so the helper is the appropriate diagnostic owner. (src/cli/completion-cli.test.ts:21, 83af3e381a4f)
  • Reported before-and-after proof: The captured PR body reports that the unchanged helper failed the three intended first-error assertions and the candidate passed them with real children. This read-only review did not execute those runs; the body also states that the original hosted CI failure was not reproduced.
  • Feature history: The raw commit record identifies the commit associated in the supplied GitHub context with the merged persistent-runner PR, improve(tests): reuse PowerShell completion process #118381. Its older source blob was unavailable locally, so exact line introduction is not independently established. (6f6d501ccf9a)

Likely related people:

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

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.

@vincentkoc
vincentkoc merged commit e8b4565 into main Sep 24, 2026
182 of 183 checks passed
@vincentkoc
vincentkoc deleted the fix/powershell-completion-first-failure-20260924 branch September 24, 2026 16:35
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 24, 2026
* commit '9a1a6f7db9783d0b8abaf918bfe12978ea745b57': (26 commits)
  fix(maintainer): restore cold PR worktree provisioning (#157394)
  feat(ios): establish native Cloudflare Access sign-in sessions (#146996)
  fix: restore the Gateway after interrupted Doctor maintenance (#156854)
  refactor(line): retire the Express webhook adapter (#157369)
  refactor(cron): consolidate unavailable delivery targets (#157393)
  ci: apply Go memory defaults to architecture checks
  fix(cli): preserve the first PowerShell completion test failure (#157267)
  refactor(agents): consolidate transcript-tail model selection (#157382)
  fix(release): honor frozen validation contracts (#157034)
  fix(perf): use settled Kova terminal CPU accounting (#157029)
  chore(windows): verify packaged repair worker lifecycle (#157047)
  refactor(logging): share memory pressure threshold selection (#157164)
  fix(release): verify bundled fs-safe native bindings (#157027)
  perf(skills): skip warm prompt search when minimum cannot fit (#157343)
  fix(ui): avoid retaining detached tooltip anchors (#157226)
  perf(ci): reuse compiler state and shorten guard and UI tests (#157265)
  perf(ui): preserve model caches on unrelated metadata updates (#157254)
  chore: remove the tracked PR-body artifact and ignore .artifacts (#157296)
  refactor: consolidate duplicate MCP lifecycle tests (#157360)
  test(qa): consolidate CLI runtime fixtures (#118496)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant