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
{{ message }}
Repository navigation
Windows: first TUI launch flashes several console windows (detached service and updater probes spawn console children without a hidden window) #56704
On Windows 11, the firstopencode launch after a boot briefly flashes ~6-8 console windows (a few milliseconds each) before the TUI paints. Later launches in the same boot are clean, because the background service and MCP servers are already running.
Reproduced on 2.0.30 (npm global install) with a process trace. This is cosmetic but looks like a crash or malware, and it repeats on every cold start.
Environment
OpenCode 2.0.30 (@opencode/cli, npm global at %APPDATA%\npm)
Windows 11, Node v24.12.0 (only used by the npm shim)
TUI launched from a cmd.exe /c opencode window
Local MCP servers enabled: repomix (resolved through the npm .cmd shim), engram (native .exe), a Python MCP server
Plugins present, but not required to see the flashes
Steps to reproduce
Reboot, or make sure no opencode / MCP process is running (opencode serve --service, engram, repomix).
Open a terminal and run opencode.
Watch the taskbar: several console windows pop up and vanish while the TUI starts.
Observed
Process trace during a cold launch (Get-Process poll + Win32_Process details). Every conhost.exe below is a newly allocated console, i.e. a visible window:
opencode serve --service starts detached, so it has no console. Every console child it spawns (MCP servers such as repomix --mcp, engram mcp) gets a newly allocated console, and Windows shows that console window by default.
The TUI's install/update probes (cmd /d /s /c npm list -g ..., pnpm list -g ...) also get their own consoles instead of inheriting the TUI's.
The MCP servers are duplicated (two repomix, two engram mcp) on cold start, which doubles the number of windows.
Note the Win32 caveat: CREATE_NO_WINDOW is ignored when combined with DETACHED_PROCESS / CREATE_NEW_CONSOLE, and windowsHide in Node/Bun maps to CREATE_NO_WINDOW. So detached: true + windowsHide: true still produces a visible window; the detached children need a hidden STARTUPINFO (STARTF_USESHOWWINDOW + SW_HIDE) or a different spawn strategy.
Expected
Children spawned by the service, by MCP startup, and by the update probes run without a visible console window.
Impact
Cosmetic, but noisy on every boot and looks suspicious to the user (several terminals opening and closing by themselves).
Thanks for the detailed report and the process trace. I couldn't reproduce this myself because the sandbox I test in runs Linux, and these console window flashes only happen on Windows, so a maintainer with a Windows machine will need to check it.
A look at the current code (not a test run) fits your analysis: the background service is still started with detached: true plus windowsHide: true, and Windows ignores the hide flag in that combination. #52594 tried a different approach, giving the service a console with no window, but that PR was closed and its change is not on dev.
A console child of the service therefore gets a new console, and the default terminal application shows it. This fits the process trace in the report above.
The main open thread for this class is #51887. I posted the full data point there. Please follow that thread.
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the detailed report and the process trace. I couldn't reproduce this myself because the sandbox I test in runs Linux, and these console window flashes only happen on Windows, so a maintainer with a Windows machine will need to check it.
A look at the current code (not a test run) fits your analysis: the background service is still started with
detached: truepluswindowsHide: true, and Windows ignores the hide flag in that combination. #52594 tried a different approach, giving the service a console with no window, but that PR was closed and its change is not ondev.Related reports, most likely first:
cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set #52281: console children of the service, including MCP launches, flash windows despitewindowsHideYour report adds two things those don't cover: the cold-start updater probes (
npm/pnpm list -g) and the MCP servers being started twice.stdray commentedon Oct 18, 2026
Same root cause, measured
The background service has no console. I probed it with
AttachConsole(pid):opencode.exe serve --serviceERROR_INVALID_HANDLE)opencode.exe serve --stdio --port 0(--standalone)A console child of the service therefore gets a new console, and the default terminal application shows it. This fits the process trace in the report above.
The main open thread for this class is #51887. I posted the full data point there. Please follow that thread.