fix: opencode is not on PATH on Windows#2183
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Single-line Windows-specific bug fix adding You can customize Macroscope's approvability policy. Learn more. |
e047e97 to
fc012cd
Compare
Dismissing prior approval to re-evaluate bd398d7
|
#2163 is now partially fixed in v0.0.21 for
I have updated this pull request for just the narrow |


Edit(2026-04-24T15:57Z):
The bug #2163 has been partially fixed in v0.0.21, but the bug still occurs if opencode is a
.cmd.I have updated the pull request and commented below for the latest change at: #2183 (comment)
Edit(2026-04-28T14:07Z):
ssswagatss commented that they were affected by #2163.
What Changed
This fixes #2163.
opencodepath on Windows by usingwhere.exe(similar aswhichon macOS and Linux).opencodewith shell on Windows.Why
opencodeas it could not be found on Windows.opencodewith shell on Windows because opencode may be a .cmd shim (e.g. withnpm i -g opencode-ai)Checklist
I included before/after screenshots for any UI changes-- no UI changesI included a video for animation/interaction changes-- no animation/interaction changesManual Testing
Tested the two
opencodeinstallations from https://opencode.ai/download that are possible for Windows.Before:

After:

Tests
Extended "resolves command names through PATH" to handle resolving the
opencodeon Windows usingwhere.exe.Validation
bun fmtbun lintbun typecheckThanks
Thanks to @timm-u for his suggested fixes and to @IuriGuerreiro for filing the bug.
Note
Low Risk
Small, platform-gated change to process spawning; risk is limited to Windows runtime behavior when launching the OpenCode server.
Overview
Fixes spawning the local OpenCode
serveprocess on Windows by enablingshellexecution instartOpenCodeServerProcess, allowing.cmd/PATH-resolved shims to run correctly.Non-Windows behavior is unchanged (still detached process groups), but Windows now relies on shell spawning to avoid “command not found” issues.
Reviewed by Cursor Bugbot for commit d5b5eae. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
[!NOTE]
Fix
opencodenot found on PATH when spawning server process on WindowsOn Windows, executables resolved via PATH require spawning through a shell. Sets
shell: truewhen callingChildProcess.makefor theservecommand on Windows, and explicitlyfalseon other platforms, in opencodeRuntime.ts.Macroscope summarized d5b5eae.