Summary
On Windows, the plugin's git-discovery helpers in src/services/tags.ts call execSync("git ...") without windowsHide: true. Because the plugin runs inside OpenCode's console-less background service process (opencode-cli serve --service), each call allocates a new visible console window (cmd.exe) that flashes and steals focus from the app.
Environment
- opencode-supermemory: 2.0.15 (current
latest on npm)
- OpenCode: Desktop 2.0.24 (bundled
opencode-cli 2.0.24)
- OS: Windows 10 Pro, build 19045 (win32 x64)
- Shell / default terminal:
cmd.exe / Windows Console Host
Reproduction
- Windows + OpenCode Desktop with this plugin enabled, in a git working copy.
- Use sessions normally (the flashes also happen when project "location services" boot).
- Observe bursts of
cmd.exe windows flashing and stealing focus.
Evidence
Process monitor (parent chain + command lines) captured during a single ~17 s burst:
- 53 ×
cmd.exe with parent opencode-cli.exe serve --service
- 46 of them were
cmd.exe /d /s /c "git ..."
- 56 ×
git.exe children
Command lines captured (they match the helpers in src/services/tags.ts exactly):
cmd.exe /d /s /c "git rev-parse --git-common-dir"
cmd.exe /d /s /c "git rev-parse --show-toplevel"
cmd.exe /d /s /c "git config user.email"
cmd.exe /d /s /c "git remote get-url origin"
Root cause
On Windows, a child process spawned by a console-less parent gets a new visible console unless it is created with CREATE_NO_WINDOW. Node maps windowsHide: true to CREATE_NO_WINDOW. execSync runs through a shell, so on Windows it spawns cmd.exe /d /s /c, and without windowsHide that cmd.exe gets a visible console window.
Relevant call sites (dist/index.js, source src/services/tags.ts):
execSync("git rev-parse --git-common-dir", { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git rev-parse --show-toplevel", { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git config user.email", { cwd: base, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git remote get-url origin", { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
Note: dist/cli.js already passes { windowsHide: true } in one execFile call, so the option is known in the codebase but missing on these git helpers.
Suggested fix
Add windowsHide: true to every execSync / child_process call that spawns a process (the git helpers above, plus any other spawn sites). Optionally, avoid execSync for git since it is a native .exe and needs no shell. This removes the flashing on Windows without affecting macOS/Linux.
Related
Summary
On Windows, the plugin's git-discovery helpers in
src/services/tags.tscallexecSync("git ...")withoutwindowsHide: true. Because the plugin runs inside OpenCode's console-less background service process (opencode-cli serve --service), each call allocates a new visible console window (cmd.exe) that flashes and steals focus from the app.Environment
lateston npm)opencode-cli2.0.24)cmd.exe/ Windows Console HostReproduction
cmd.exewindows flashing and stealing focus.Evidence
Process monitor (parent chain + command lines) captured during a single ~17 s burst:
cmd.exewith parentopencode-cli.exe serve --servicecmd.exe /d /s /c "git ..."git.exechildrenCommand lines captured (they match the helpers in
src/services/tags.tsexactly):Root cause
On Windows, a child process spawned by a console-less parent gets a new visible console unless it is created with
CREATE_NO_WINDOW. Node mapswindowsHide: truetoCREATE_NO_WINDOW.execSyncruns through a shell, so on Windows it spawnscmd.exe /d /s /c, and withoutwindowsHidethatcmd.exegets a visible console window.Relevant call sites (
dist/index.js, sourcesrc/services/tags.ts):Note:
dist/cli.jsalready passes{ windowsHide: true }in oneexecFilecall, so the option is known in the codebase but missing on these git helpers.Suggested fix
Add
windowsHide: trueto everyexecSync/child_processcall that spawns a process (the git helpers above, plus any other spawn sites). Optionally, avoidexecSyncforgitsince it is a native.exeand needs no shell. This removes the flashing on Windows without affecting macOS/Linux.Related
cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set anomalyco/opencode#52281 —cmd.exespawns flash a visible console on Windows