fix: opencode is not on PATH on Windows (#2163)#2183
fix: opencode is not on PATH on Windows (#2163)#2183adammansfield wants to merge 1 commit intopingdotgg:mainfrom
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 This is a straightforward Windows platform bug fix that adds proper PATH resolution using You can customize Macroscope's approvability policy. Learn more. |
e047e97 to
fc012cd
Compare
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 typecheckcd apps/server && bun run test -- src/provider/opencodeRuntime.test.ts -t "resolves command names through PATH"Thanks
Thanks to @timm-u for his suggested fixes and to @IuriGuerreiro for filing the bug.
Note
Medium Risk
Touches process execution and binary resolution logic; mistakes could prevent the OpenCode server from starting on Windows or change which executable is invoked.
Overview
Fixes Windows support for launching
opencode.resolveOpenCodeBinaryPathnow useswhere.exeonwin32(parsing CRLF/LF output and returning the first non-empty hit) instead of relying onwhich.startOpenCodeServerProcessenablesspawn(..., { shell: true })on Windows so.cmdshims can be executed.Updates
opencodeRuntime.test.tsto cover the Windows-specificwhere.exeresolution path.Reviewed by Cursor Bugbot for commit fc012cd. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
opencodebinary not found on PATH on WindowsopencodeRuntime.ts,resolveOpenCodeBinaryPathnow useswhere.exeon Windows instead ofwhich, splitting output on CRLF/LF and returning the first non-empty path.startOpenCodeServerProcessnow setsshell: trueon Windows to correctly resolve theopencode.cmdshim.opencodeRuntime.test.tsare extended to cover Windows-specificwhere.exebehavior.Macroscope summarized fc012cd.