You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the bot starts the OpenCode server (via /opencode_start\ or \OPENCODE_AUTO_RESTART_ENABLED), a visible console window appears on Windows. The expected behavior is for the server to start silently in the background.
Root cause
\createOpencodeServeSpawnCommand\ spawns \cmd.exe /c opencode serve\ on Windows. The \windowsHide: true\ flag only applies to the \cmd.exe\ process, not to \opencode.exe\ that \cmd.exe\ launches through the .cmd\ npm shim. \opencode.exe\ gets a fresh console.
Fix
Spawn \opencode.exe\ directly instead of going through \cmd.exe /c. The .exe\ path is resolved from the npm prefix. With \windowsHide: true\ applying directly to \opencode.exe, no console window appears.
Changes
\src/opencode/process.ts: added
esolveWindowsOpencodeExe()\ helper, rewrote \createOpencodeServeSpawnCommand\ to spawn .exe\ directly on Windows
\ ests/opencode/process.test.ts: updated Windows test assertion to verify \windowsHide: true\ and that \cmd.exe\ is no longer used
@danieliyahu1 Doesn't work on my windows PC. The fix idea is right, but resolveWindowsOpencodeExe() resolves the wrong directory — path.dirname(process.execPath) is the Node.js folder, not the npm global prefix (on Windows that's usually %APPDATA%\npm). So the candidate path doesn't exist and it falls back to "opencode.exe", which spawn() can't find (only the .cmd shim is on PATH, not the .exe).
Result: spawn opencode.exe ENOENT, and /opencode_start fails on a default global install. Seen it in the logs.
You'll need to resolve the npm prefix correctly (e.g. from the opencode.cmd location on PATH), and keep a safe fallback for when the .exe isn't found. Also, the test only checks command !== "cmd.exe", so it passes even when resolution is broken — worth making it assert a real path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the bot starts the OpenCode server (via /opencode_start\ or \OPENCODE_AUTO_RESTART_ENABLED), a visible console window appears on Windows. The expected behavior is for the server to start silently in the background.
Root cause
\createOpencodeServeSpawnCommand\ spawns \cmd.exe /c opencode serve\ on Windows. The \windowsHide: true\ flag only applies to the \cmd.exe\ process, not to \opencode.exe\ that \cmd.exe\ launches through the .cmd\ npm shim. \opencode.exe\ gets a fresh console.
Fix
Spawn \opencode.exe\ directly instead of going through \cmd.exe /c. The .exe\ path is resolved from the npm prefix. With \windowsHide: true\ applying directly to \opencode.exe, no console window appears.
Changes
esolveWindowsOpencodeExe()\ helper, rewrote \createOpencodeServeSpawnCommand\ to spawn .exe\ directly on Windows
Testing
pm run build\ — pass
pm run lint\ — zero warnings
pm test\ — 999/999 passing (Windows)