Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: opencode is not on PATH on Windows #2183

Mergedadammansfield(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/2183/headmerged by juliusmarminge View on GitHub

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: https://github.com/pingdotgg/t3code/pull/2183#issuecomment-4281104184

Edit(2026-04-28T14:07Z): ssswagatss commented that they were affected by #2163.

What Changed

This fixes #2163.

  1. Fix resolving opencode path on Windows by using where.exe (similar as which on macOS and Linux).
  2. Spawn opencode with shell on Windows.

Why

  1. Fix resolving opencode as it could not be found on Windows.
  2. Spawn opencode with shell on Windows because opencode may be a .cmd shim (e.g. with npm i -g opencode-ai)

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes -- no UI changes
  • I included a video for animation/interaction changes -- no animation/interaction changes

Manual Testing

Tested the two opencode installations from https://opencode.ai/download that are possible for Windows.

npm i -g opencode-ai
where.exe opencode
# C:\Program Files\nodejs\opencode
# C:\Program Files\nodejs\opencode.cmd
bun add -g opencode-ai
where.exe opencode
# C:\Users\adam\.bun\bin\opencode.exe

Before: image

After: image

Tests

Extended "resolves command names through PATH" to handle resolving the opencode on Windows using where.exe.

Validation

  • bun fmt
  • bun lint
  • bun typecheck

Thanks

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 serve process on Windows by enabling shell execution in startOpenCodeServerProcess, 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](https://cursor.com/bugbot) for commit d5b5eaeb607d4a57be4c0628e5583d0157e022d6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

[!NOTE]

Fix opencode not found on PATH when spawning server process on Windows

On Windows, executables resolved via PATH require spawning through a shell. Sets shell: true when calling ChildProcess.make for the serve command on Windows, and explicitly false on other platforms, in opencodeRuntime.ts.

Macroscope summarized d5b5eae. >

Open in Devin Review
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: da8b7faa-cda3-4af3-bc6e-5eb6dbeee391

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved

      Single-line Windows-specific bug fix adding shell: true when spawning child processes, a standard pattern for PATH resolution on Windows. No runtime behavior change on other platforms, clear intent, minimal scope.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. adammansfield(GitHub profile, opens in a new tab)commented

      #2163 is now partially fixed in v0.0.21 for opencode.exe, but it is still broken for opencode.cmd:

      npm i -g opencode-ai
      where.exe opencode
      # C:\Program Files\nodejs\opencode
      # C:\Program Files\nodejs\opencode.cmd
      image

      I have updated this pull request for just the narrow opencode.cmd fix so that shell is used for win32 in startOpenCodeServerProcess: image

    5. gameroman(GitHub profile, opens in a new tab) approved these changes

    6. raulpesilva(GitHub profile, opens in a new tab) approved these changes

    7. juliusmarminge merged this1eb6fce

    8. juliusmarminge closed this

Sign in to join this conversation.