Skip to content

fix: run opencode server through shell on Windows#2400

Open
Loues000 wants to merge 1 commit intopingdotgg:mainfrom
Loues000:fix/opencode-windows-server-spawn
Open

fix: run opencode server through shell on Windows#2400
Loues000 wants to merge 1 commit intopingdotgg:mainfrom
Loues000:fix/opencode-windows-server-spawn

Conversation

@Loues000
Copy link
Copy Markdown

@Loues000 Loues000 commented Apr 29, 2026

Summary

Fix OpenCode server startup on Windows when the resolved OpenCode binary is a .cmd shim.

Node cannot spawn .cmd files directly with shell: false, which can make the opencode serve process fail with EINVAL on Windows. The existing OpenCode healthcheck already uses shell: process.platform === win32 for this reason.

This PR applies the same Windows-only spawn behavior to the long-running OpenCode server process. Linux and macOS behavior is unchanged.

Fix

  • Add shell: process.platform === win32 to the opencode serve spawn options in opencodeRuntime.ts
  • Keep the change scoped to the OpenCode server startup path
  • No UI changes

Test plan

  • bun fmt
  • bun lint
  • bun typecheck

Note

Low Risk
Small, Windows-only process spawn option change; behavior on macOS/Linux is unchanged and impact is limited to OpenCode server startup.

Overview
Fixes OpenCode server startup on Windows by spawning the long-running opencode serve process with shell: process.platform === "win32", matching the behavior already used for other command executions.

Non-Windows platforms keep the existing spawn behavior; only the server startup path in opencodeRuntime.ts is affected.

Reviewed by Cursor Bugbot for commit b81aacc. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix OpenCode server process spawn on Windows by running through a shell

On Windows, spawning a child process without a shell can fail for certain executables. The fix sets shell: process.platform === "win32" in the options passed to ChildProcess.make in opencodeRuntime.ts. Non-Windows behavior is unchanged.

Macroscope summarized b81aacc.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

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: bbcdc7d7-44fd-4be3-bf86-ec1e5c33bc64

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.

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 29, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 29, 2026

Approvability

Verdict: Approved

Single-line fix adding standard Windows shell spawning pattern for child process execution. This is a common, well-understood platform compatibility fix with minimal risk.

You can customize Macroscope's approvability policy. Learn more.

@gameroman
Copy link
Copy Markdown
Contributor

Duplicate of #2183

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants