Repository navigation
Description
Summary
On Windows, the snapshot service spawns git.exe hundreds of times per minute against its shadow repository, and every one of those spawns briefly flashes a console window on screen. Because the children are spawned without a hide-window flag, Windows allocates a fresh conhost.exe for each invocation and tears it down immediately, which is the millisecond flicker observed while the agent is working.
Environment
- opencode version: 2.0.21
- OS: Windows 11 Pro, build 26200 (10.0.26200.9550), x64
- Terminal: Windows Terminal (
WT_SESSIONpresent),TERM=xterm-256color - Shell:
C:\Windows\system32\cmd.exe(opencode spawnspwsh.exe7.6.6 for the shell tool) - Git: 2.55.0.windows.5 (
C:\Program Files\Git\cmd\git.EXE) - Install/channel: npm global
@opencode/cli, channellatest - Active plugins: none configured
Reproduction
- On Windows, start opencode in a git repository with snapshots enabled (the default).
- Let the agent work. No interaction is required.
- A console window flashes in the background repeatedly, roughly every few seconds, while the agent is running.
- Confirm the source by counting spawns in the server log:
Select-String -Path "$env:USERPROFILE\.local\share\opencode\log\opencode.log" `
-Pattern 'message="spawning process" command=".*git\.EXE"' | Measure-ObjectExpected Behavior
Helper processes spawned by opencode should not create or steal visible console windows. Short-lived internal Git invocations against opencode's own shadow repository should be invisible to the user.
Actual Behavior
A console window appears and disappears repeatedly, with each flash lasting a few milliseconds. The frequency correlates with agent activity.
Measured on this machine, from opencode.log:
- 935 total
git.exespawns logged in one session - 850 (90.9%) of those targeted the snapshot shadow repository under
~/.local/share/opencode/snapshot/<hash>/<hash>, not the project repository - By subcommand, for the shadow repository alone:
| Subcommand | Count |
|---|---|
write-tree |
540 |
ls-files |
270 |
diff-files |
270 |
add |
19 |
init |
1 |
A representative log line (hashes redacted):
message="spawning process" command="C:\\Program Files\\Git\\cmd\\git.EXE"
args="[\"--git-dir\",\"<USERPROFILE>\\.local\\share\\opencode\\snapshot\\<hash>\\<hash>\",
\"--work-tree\",\"<project>\",\"diff-files\"]" role=server
write-tree running at twice the rate of ls-files suggests the snapshot loop commits a tree on every watcher tick rather than only when the worktree actually changed, which is what keeps the flicker going for the whole turn.
No PTY is involved. The log contains zero opencode-pty / foreground_process events, so this is unrelated to the terminal tool. The flashing process is a direct child conhost.exe created per git.exe spawn.
Additional Context
The shipped opencode.exe binary contains no window-hiding flags anywhere in its own process helper. A string scan of the binary returns:
CREATE_NO_WINDOW: 0 occurrencesSW_HIDE: 0 occurrencesSTARTF_USESHOWWINDOW: 0 occurrencesShowWindow/hwnd: 0 occurrenceswindowsHide: 23 occurrences, all inside the bundled Node/Bun compatibility layer (child_processshim,cluster,node:child_process) and none in the spawn path used here
The spawn is emitted by opencode's own @opencode/AppProcess module, which wraps the effect platform Command. The options it forwards do not include a hide-window flag, so on Windows each console subsystem binary (git.exe) allocates a console window that is destroyed when the process exits. That is the entire flicker mechanism.
The existing silent option in the binary is about stdio and doNotPauseOnExceptionsAndMuteConsole, not window visibility, so there is no configuration setting that suppresses this today.
Workaround used here: setting "snapshots": false in opencode.json. After a service restart the snapshot Git spawns drop to zero and the flicker stops, which also confirms the attribution. This costs the undo/revert feature, so the underlying spawn flag is still worth fixing.
Suggested fix: pass windowsHide: true (equivalently CREATE_NO_WINDOW) for child processes that opencode spawns for its own internal use, at minimum in the snapshot and Git helper paths. If a single default is inappropriate for the terminal tool, which is intended to own a visible PTY, scoping the flag to non-PTY spawns would be reasonable.
Note: the write-tree / ls-files / diff-files repetition looks like a separate efficiency issue, and coalescing snapshot ticks would reduce process churn even where the window does not flash.
Activity
github-actions commentedon Oct 1, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 72 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set #52281: Internal Windows child processes, including git probes, flash visible console windows and steal focus.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Oct 4, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.
Feel free to open a new issue that follows our issue templates.