Repository navigation
Description
Summary
On Windows 11 with Windows Terminal as the default terminal application, opening or creating a project in the OpenCode desktop app (v2.2.0) makes exactly one console window flash. It is caused by the core repository detector spawning git without hiding the console: git rev-parse --git-dir --git-common-dir --show-toplevel.
Environment
- opencode version: 2.2.0 (desktop, bundled CLI
2.2.0-x64) 鈥?opencode v2.2.0 - OS: Windows 11,
Microsoft Windows NT 10.0.26300.0(win32 x64) - Terminal: Windows Terminal 1.24.12741 as the default terminal application (
CASCADIA_HOSTING_WINDOW_CLASS) - Shell:
C:\WINDOWS\system32\cmd.exe - Install/channel: release desktop app (
%LOCALAPPDATA%\Programs\ai.opencode.desktop) - Active plugins: local
context-modedevelopment build +cbm-augment(both already spawn withwindowsHide: true; see Additional Context)
Reproduction
- Use Windows 11 with Windows Terminal set as "Default terminal application".
- Start the OpenCode desktop app (v2.2.0) and let the server start.
- Open an existing project or create a new one, or trigger a location reload (
POST /api/location/reload). - A single console/Windows Terminal window appears and disappears immediately, once per opened location.
Expected Behavior
No visible console window is created for background subprocesses such as the Git repository probe.
Actual Behavior
One visible console window per project open. Window capture (Win32 EnumWindows + IsWindowVisible, sampled every 20 ms) during a location load shows:
19:47:11.350 git parent=13648 [opencode-cli.exe] cmd=git -C C:\Users\DELL rev-parse --show-toplevel
19:47:28.994 hwnd=3868748 pid=4528 proc=git class=ConsoleWindowClass (visible)
The corresponding server log line for the same flow:
level=INFO message="spawning process" command="C:\Program Files\Git\cmd\git.EXE"
args="[\"rev-parse\",\"--git-dir\",\"--git-common-dir\",\"--show-toplevel\"]"
Root cause is the well-known one: opencode-cli.exe runs without a console, and the child console process is created without CREATE_NO_WINDOW (i.e. without windowsHide: true). Windows then allocates a new console, which the configured default terminal (Windows Terminal) hosts as a visible window for a moment.
Additional Context
- This is the only remaining flash after the user patched every plugin-side spawn. The same setup originally produced ~23 flashes per location load (
where python,"python" --version,where sh/pwsh/powershell/ruby/go/rustc/php/perl/Rscript/elixir/bun, ...) from a plugin callingexecSyncwithoutwindowsHide. After addingwindowsHide: trueto those calls, zero visible windows appear for them 鈥?sowindowsHidedoes work in the Bunnode:child_processcompatibility layer, and the remaining window is purely the core Git probe. - Git repositories get an additional probe. A non-repository location still triggers
git rev-parse --show-toplevel, so the flash happens for every project, repository or not. - A plugin cannot work around this: per the plugin docs, "Repository discovery continues to use OpenCode's built-in Git and Mercurial detectors", and a custom
ctx.worktree.transformstrategy only replaces worktree create/remove/list, not the discovery spawn. - No configuration option disables repository detection or sets console hiding, so there is no user-side mitigation.
- Related but closed reports: Windows: subprocess spawn (git, codegraph, etc.) flashes console window #31629, Desktop app: Console window flashes repeatedly even while idle (CREATE_NO_WINDOW missing) #22414, Windows: every spawned console process flashes a black window (git.exe ~1/sec on v2.0.20) — re-report of #22414, #31629 #52266, Windows: every child
cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set #52281. This report adds a v2.2.0 (2026-10-27) reproduction with the exact command, parent process, and window handle, plus evidence that the issue is isolated to core rather than plugins.
Suggested fix: pass windowsHide: true (or CREATE_NO_WINDOW) to every Bun.spawn/child_process invocation of git, or attach a hidden console to the server process so inherited console children never create a new window.
Activity
opencode-agent commentedon Oct 27, 2026
Thanks for the detailed capture with the exact command lines and window handle!
I think this is a duplicate of #52266, the open issue tracking console windows flashing on Windows when the background service starts
gitand other console programs.Some things I found in the code that may help narrow it down:
v2.2.0, core runs its discovery call (git rev-parse --git-dir --git-common-dir --show-toplevel) through the shared spawner inpackages/util/src/cross-spawn-spawner.ts. That spawner already passeswindowsHide: trueon Windows, so the suggested fix is already in place for that call.git -C C:\Users\DELL rev-parse --show-toplevel. Core doesn't run git in that form: it doesn't use-Cand doesn't make a bare--show-toplevelcall. Core also only runs git after it finds a.gitentry, so folders that aren't repositories shouldn't trigger a core git call at all. One of your plugins (context-modeorcbm-augment) may still be runninggit -C … rev-parse --show-toplevelwithoutwindowsHide. Could you check whether the flash still happens with both plugins disabled?git -Ccapture (19:47:11) and the visible window (19:47:28) are 17 seconds apart, so they may not be the same process.Possible duplicates and closely related issues, ordered from most to least likely:
rg), closed as a duplicate of Windows: every spawned console process flashes a black window (git.exe ~1/sec on v2.0.20) — re-report of #22414, #31629 #52266.cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set #52281: git probes and MCP spawns flashing visible windows, closed as a duplicate. One commenter there traced their remaining flashes to a plugin.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. If the flash still appears with plugins disabled, please add that result to #52266 (or reply here), since it would show the window really comes from core.