Skip to content

fix(desktop): use PATH for WSL probe - #44512

Closed
zjm54321 wants to merge 1 commit into
anomalyco:devfrom
zjm54321:wsl-path-probe
Closed

zjm54321 wants to merge 1 commit into
anomalyco:devfrom
zjm54321:wsl-path-probe

Conversation

@zjm54321

@zjm54321 zjm54321 commented Aug 23, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #44508

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The WSL probe assumes every distro has /bin/true. NixOS does not, so Desktop reports that the distro still needs first-run setup. This uses true from the distro PATH instead and adds a test for the exact WSL arguments.

How did you verify your code works?

  • Ran bun test src/main/wsl/runtime.test.ts and bun typecheck from packages/desktop.
  • Ran the repository pre-push typecheck (30 tasks passed).
  • Confirmed wsl.exe -d nixos -- true exits 0 on the affected system.

Screenshots / recordings

Not applicable; this is a WSL probe fix with no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI lite review requested due to automatic review settings August 23, 2026 19:18
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the Desktop WSL distro probe so it verifies command execution using the distro’s PATH (running true) instead of hardcoding /bin/true, which breaks on non-FHS distros like NixOS WSL.

Changes:

  • Update probeWslDistro() to run true via PATH rather than /bin/true.
  • Add a regression test asserting the probe invokes wsl -d <distro> -- true.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/desktop/src/main/wsl/runtime.ts Switches the execution probe from /bin/true to true resolved via distro PATH.
packages/desktop/src/main/wsl/runtime.test.ts Adds a mocked-child-process test ensuring the probe uses true (not an absolute path).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference, author can ignore or act on any point.

Overall: correct and worthwhile — hardcoding /bin/true breaks on distros without a traditional /bin (notably NixOS and other exotic layouts), while relying on PATH matches how everything else in this file invokes commands inside the distro. Two small notes:

  1. packages/desktop/src/main/wsl/runtime.ts:280 — this now depends on the non-login WSL exec environment having a sane PATH. That's true for essentially all mainstream distros today, but it does couple the probe to the distro's default env rather than an absolute location. If a future report ever shows canExecute: false on a healthy distro, this is the first place to look; a one-line comment noting why bare true is preferred over /bin/true would preserve that context for reviewers of the inevitable blame.

  2. If you want belt-and-suspenders portability without PATH assumptions at all, ["/bin/sh", "-c", "exit 0"] covers both worlds (POSIX shells are more universally present than coreutils true) — though arguably true is clearer as an intent statement, and the current choice is fine.

The mocked-spawn test asserting the exact argv (["-d", "Alpine", "--", "true"]) plus the pty guard throwing on interactive use is a tidy regression net for a one-word change. Good to merge.

@github-actions

Copy link
Copy Markdown
Contributor

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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop WSL probe hardcodes /bin/true and misreports NixOS as needing first-run setup

3 participants