Repository navigation
fix(wsl): say why a silent WSL guest command failed - #34304
Conversation
A guest command that exits non-zero with empty stderr was reported as "WSL <distro>: command failed". When wsl.exe itself fails it writes its error to stdout, so the real cause was dropped. Report stderr, else wsl.exe's own error, else the exit code, for the Claude account pointer, OpenCode reader, WSL CLI install and WSL file operations. Refs STA-12262 (#33917)
|
No actionable comments were generated in the recent review.
|
ELI5
When a command Orca runs inside WSL failed without printing an error, Orca only said "WSL Ubuntu: command failed". That gives no clue what went wrong. Orca now shows WSL's own error message when there is one, or the exit code otherwise.
What Changed
Before: in the Claude account setup for WSL terminals, a guest command that exited non-zero with empty stderr produced
WSL <distro>: command failed. Whenwsl.exeitself fails, it exits0xFFFFFFFFand writes its error (for exampleWsl/Service/0x80072747) to stdout, and that text was thrown away. The OpenCode WSL reader setup did the same.After: the message uses stderr first, then
timed out, thenwsl.exe: <its own error>for the host-failure exit, thenexited with code N.Mechanism: a new
describeWslProcessFailure()insrc/main/wsl/wsl-process-failure.tsis used by:The host-failure exit check and the UTF-16 NUL stripping now live there, and the git runner's existing
wsl.exe host failureannotation reuses them.Why
STA-12262 reports that every new Claude terminal and every session restore in WSL fails with exactly
WSL Ubuntu: command failed. The real cause is not recorded anywhere. WSL itself is healthy (wsl.exe -d Ubuntu --exec /bin/trueworks). This PR doesn't claim a root-cause fix. It makes the next occurrence say why it failed, which is what the reporter asked for, so we can fix the actual cause.Linked Issue
Refs #33917 (STA-12262). This makes the failure diagnosable. It doesn't close the issue.
Thanks @lkg1024 for the thorough report.
Visual Proof
N/A. Only error text changes, and only when stderr was empty.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New case in
claude-profile-wsl-router.test.ts:wsl.exehost failure (exit0xFFFFFFFF, stdoutWsl/Service/0x80072747) reportsWSL Ubuntu: wsl.exe: Wsl/Service/0x80072747;WSL Ubuntu: exited with code 3.Both fail on main, which reports
command failed.Tests for every changed module pass, including
wsl-host-failure, the WSL CLI installer, the OpenCode WSL reader setup and local-worktree-filesystem.Review
Codex review and an independent review against the pinned base.
Agent skill upstream boundary
Notes
wsl.exehost-failure exit, which a Linux guest can't produce.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)