Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #44512: fix(desktop): use PATH for WSL probe This appears to be a closely related PR addressing the same issue. Both PRs aim to resolve OpenCode from PATH in WSL environments. PR #44512 is focused on WSL probe detection using PATH, while PR #44514 (current) resolves the WSL OpenCode executable from PATH with a fallback. These are likely addressing related or overlapping aspects of the same issue (#38309). |
There was a problem hiding this comment.
Pull request overview
Fixes WSL OpenCode detection in the Desktop app by resolving the opencode executable from the distro’s PATH (supporting global npm/Nix/Home Manager installs) while keeping the legacy $HOME/.opencode/bin/opencode path as a fallback, addressing the “OpenCode not installed” false-negative in WSL.
Changes:
- Update WSL runtime probing to resolve
opencodeviacommand -v opencodebefore falling back to$HOME/.opencode/bin/opencode. - Add unit tests validating PATH-first resolution and the fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/desktop/src/main/wsl/runtime.ts | Updates resolveWslOpencode to prefer resolving from distro PATH before using the fixed home-bin fallback. |
| packages/desktop/src/main/wsl/runtime.test.ts | Adds tests to validate PATH-first resolution and fallback behavior for WSL OpenCode path discovery. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "sh", | ||
| "-c", | ||
| 'command -v opencode || { [ -x "$HOME/.opencode/bin/opencode" ] && printf "%s\\n" "$HOME/.opencode/bin/opencode"; }', | ||
| ], |
There was a problem hiding this comment.
Updated in d38b26e. The test now asserts the filtered PATH script passed to WSL.
| [ | ||
| "sh", | ||
| "-c", | ||
| 'command -v opencode || { [ -x "$HOME/.opencode/bin/opencode" ] && printf "%s\\n" "$HOME/.opencode/bin/opencode"; }', |
There was a problem hiding this comment.
Addressed in d38b26e: resolveWslOpencode now removes /mnt/* entries before command -v, matching the sidecar PATH policy.
Overall: right fix direction — the old probe only accepted the fixed install path, so distro-managed installs were invisible, and stripping Windows interop entries before
Tests pin the exact argv and both resolution outcomes — good, though asserting on a substring ( |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #38309
Type of change
What does this PR do?
The WSL setup only recognized
$HOME/.opencode/bin/opencode, so installations from global npm, Nix, or Home Manager appeared missing even whenopencodewas available. Resolveopencodefrom the distro PATH first, then retain the existing fixed path as a fallback.How did you verify your code works?
bun test src/main/wsl/runtime.test.tsfrompackages/desktop(2 passed)bun typecheckfrompackages/desktop/etc/profiles/per-user/ming/bin/opencodeon NixOS WSLScreenshots / recordings
N/A (no UI change).
Checklist