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
[Bug] OpenCode2 CLI Endlessly Pops Up Windows on Windows #51887
After installing with bun install -g --trust @opencode/cli, run opencode2 in cmd or PowerShell. When opencode2 starts the background server, a foreground window keeps popping up and immediately closing (the window constantly steals focus, making it almost impossible to use).
Even if you exit the foreground CLI, it cannot be stopped. By inspecting with Process Explorer, I found that the background opencode.exe server process continuously launches tasklist.exe, and tasklist.exe creates a foreground console window that steals focus.
Plugins
No plugins that can run on V2 (none are compatible)
Could you try temporarily removing any V1 plugins to help us rule out plugin loading? Back up or move the contents of your global ~/.config/opencode/plugins/ and any project .opencode/plugins/ directories, and remove third-party entries from the plugins arrays in your global and project opencode.json(c) files. Then run opencode service restart, launch opencode2 again, and let us know whether the window/tasklist loop still happens. You can restore the plugins and config afterward. This is a diagnostic, not yet a confirmed cause.
Also - what do you mean by "No plugins that can run on V2 (none are compatible)"
Hi, my version of Bun I am using is v1.4.2. I tried adding the --standalone parameter to start opencode2 and found that windows no longer pop up repeatedly. I had installed the omo (oh-my-openagent) plugin, which is incompatible with V2. After removing it, this issue appears to stop occurring even without the --standalone parameter.
≈100 git.exe per minute, ≈1.7 spawns/second. Same order as the 60–68/min in #52266, and consistent with #52433 (snapshot service, closed administratively).
2. Local plugin spawn path without windowsHide
~/.config/opencode/plugins/ponytail.ts ran this on every session.hook("context") — once per model call, 3 git invocations per hook:
execFileSync("git",argv,{ cwd,stdio: "pipe",timeout: TIMEOUT_MS})// no windowsHide
Adding windowsHide: true removes it. rtk.ts in the same directory already passes windowsHide: true, so this is the whack-a-mole described in #53730, just inside a local file I control.
3. opencode-gemini-auth spawns a detached console program without windowsHide
dist/index.js:
constchild=spawn(command,args,{stdio: "ignore",detached: true});// command = rundll32 on win32
rundll32 is console-subsystem; detached: true with no windowsHide allocates a visible console. Only on the OAuth login path, so a one-off flash rather than a recurring one.
4. #52594 is closed unmerged, and no release carries the service-level fix
#52594 "fix(cli): give the Windows service a hidden console": created 2026-10-01, closed 2026-10-12, draft: true, merged: false.
grep -c hidden-console in the 2.0.28 bundle (bin/opencode.exe, 212,916,616 bytes) returns 0, so the fix is not in this release.
On win32 that hides spawned children unless the caller passes detached: true, which flips windowsHide to false. Both the service start and the gemini-auth call above have that shape.
Open questions
Does the snapshot git runner pass through that spawner (making the ~100/min already hidden), or does it spawn directly? I could not confirm this from the minified bundle.
Should windowsHide: true (or CREATE_NO_WINDOW) be forced for every child of the service regardless of caller options, rather than only defaulted? The current default is what makes plugin detached: true and execFileSync calls visible.
Symptom changes
Flashes stopped on my machine after two changes applied together: windowsHide: true in the local plugin, and "snapshots": false in opencode.jsonc.
I did not isolate them, so I cannot say which one accounts for it. The snapshot path is 89% of the spawn volume, so it is the one I would test first — restoring "snapshots": true while keeping the plugin fix would separate them.
--standalone, as @TGSAN found, avoids it entirely — consistent with the shared service being the console-less parent.
Data point on 2.0.32: the background service has no console, measured
I reproduce this on @opencode/cli 2.0.32 (npm global, latest). Windows 11, Windows Terminal set as the default terminal application, TUI running in a Windows Terminal tab.
The --standalone result from @TGSAN and @gammarinaldi holds on 2.0.32. I probed both server types with AttachConsole(pid) on the live machine:
process
has a console?
opencode.exe serve --service (background service)
no — AttachConsole fails with error 6 (ERROR_INVALID_HANDLE)
So the background service is a console-less parent. This is measured directly, not inferred from the code. Windows gives a new console to every console child that does not set CREATE_NO_WINDOW. The default terminal application shows that console. In my setup it becomes a new Windows Terminal tab, and the tab takes focus.
Test method: I ran the usual command bursts (git probes, parallel cmd and pwsh children, as reported on #52281). With --standalone: no flash, no focus steal. With the background service: new tabs appeared, titled with the path of a child exe (C:\Program Files\...), and they took focus. I have a 22 s screen recording; I can attach it on request.
One trap for other users: the background service stays alive after the TUI exits. If you start opencode again without --standalone, the client connects to that console-less service, and the flashing returns. Run opencode service stop to remove it.
Thanks for the detailed report, and for tracking the windows down to tasklist.exe with Process Explorer.
I think this is a duplicate of #52266. That is the issue tracking this problem: on Windows, OpenCode 2's background service (opencode serve --service) runs detached with no console of its own. So every console program it starts without the "no window" flag opens a visible window that takes focus, which is why it continues after you exit the CLI.
Possible duplicates and closely related issues, ordered from most to least likely:
As far as I can tell, OpenCode itself does not run tasklist, so this is most likely coming from a plugin. Even if you think none of your plugins work on v2, one listed in your config may still be loading. Removing it from your config should stop the windows. Starting with --standalone reportedly avoids the problem too, because the server then runs inside your terminal's console.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
We haven't heard back in the past day, so I'm closing this as a duplicate of #52266. That issue tracks the same problem: on Windows, console programs (like the tasklist.exe you found) started by OpenCode 2's background service each open a visible window that takes focus.
Please follow #52266 for updates, and add a comment there if you have more details, such as which plugin turns out to be running tasklist. If your problem is actually different, reply here and we can reopen this issue. Thanks again for the Process Explorer investigation!
Still reproducing on v2.2.5 (as of 2026-11-05), Windows 11 build 22000 x64 — adding independent instrumentation data from a third-party manager (oc-manager #17):
WMI process-creation capture + 60 ms new-visible-window polling while a subagent task runs: pairs of visible ConsoleWindowClass windows (git.exe, python.exe) flash every ~5 s; parents resolve to the detached opencode serve --service.
Focus steal measured: foreground sampling during the child's lifetime hits the child PID — each spawn steals foreground focus, it is not just visual flashing.
Not the manager: oc-manager sets windowsHide/CREATE_NO_WINDOW on every spawn it controls; none of those flash. Only opencode's own in-process spawns (snapshot git / shell-tool children) do.
Root cause and proposed fix: #60471 (windowless console for the detached service). Note that PR is currently scoped to builds ≥ 26100 — build 22000 (21H2) would remain affected; see my comment there about a < 26100 fallback.
Activity
github-actions commentedon Sep 28, 2026
This issue might be a duplicate of an existing issue. Please check:
neriousy commentedon Sep 28, 2026
Hey! Can you tell me what kind of bun version are you running?
neriousy commentedon Sep 28, 2026
Also - what do you mean by "No plugins that can run on V2 (none are compatible)"
opencode-agent commentedon Sep 28, 2026
Could you try temporarily removing any V1 plugins to help us rule out plugin loading? Back up or move the contents of your global
~/.config/opencode/plugins/and any project.opencode/plugins/directories, and remove third-party entries from thepluginsarrays in your global and projectopencode.json(c)files. Then runopencode service restart, launchopencode2again, and let us know whether the window/tasklist loop still happens. You can restore the plugins and config afterward. This is a diagnostic, not yet a confirmed cause.TGSAN commentedon Sep 28, 2026
Hi, my version of Bun I am using is v1.4.2. I tried adding the --standalone parameter to start opencode2 and found that windows no longer pop up repeatedly. I had installed the omo (oh-my-openagent) plugin, which is incompatible with V2. After removing it, this issue appears to stop occurring even without the --standalone parameter.
gammarinaldi commentedon Oct 14, 2026
Another data point on 2.0.28: spawn volume, plus two un-hidden local spawn paths
Measured on 2.0.28, after
#52594was closed. Environment:@opencode/cli, npm global,latest)WT_SESSIONset),TERM=xterm-256colorcmd.exe(%ComSpec%); opencodeshellconfig is bashlatestopencode-gemini-auth@latest(config), local~/.config/opencode/plugins/ponytail.tsandrtk.ts1. Spawn volume in
opencode.logPer minute on 2026-10-14 while a session was active:
≈100
git.exeper minute, ≈1.7 spawns/second. Same order as the 60–68/min in #52266, and consistent with #52433 (snapshot service, closed administratively).2. Local plugin spawn path without
windowsHide~/.config/opencode/plugins/ponytail.tsran this on everysession.hook("context")— once per model call, 3 git invocations per hook:Adding
windowsHide: trueremoves it.rtk.tsin the same directory already passeswindowsHide: true, so this is the whack-a-mole described in #53730, just inside a local file I control.3.
opencode-gemini-authspawns a detached console program withoutwindowsHidedist/index.js:rundll32is console-subsystem;detached: truewith nowindowsHideallocates a visible console. Only on the OAuth login path, so a one-off flash rather than a recurring one.4.
#52594is closed unmerged, and no release carries the service-level fix#52594"fix(cli): give the Windows service a hidden console": created 2026-10-01, closed 2026-10-12,draft: true,merged: false.grep -c hidden-consolein the 2.0.28 bundle (bin/opencode.exe, 212,916,616 bytes) returns 0, so the fix is not in this release.On win32 that hides spawned children unless the caller passes
detached: true, which flipswindowsHideto false. Both the service start and the gemini-auth call above have that shape.Open questions
windowsHide: true(orCREATE_NO_WINDOW) be forced for every child of the service regardless of caller options, rather than only defaulted? The current default is what makes plugindetached: trueandexecFileSynccalls visible.Symptom changes
windowsHide: truein the local plugin, and"snapshots": falseinopencode.jsonc."snapshots": truewhile keeping the plugin fix would separate them.--standalone, as @TGSAN found, avoids it entirely — consistent with the shared service being the console-less parent.stdray commentedon Oct 18, 2026
Data point on 2.0.32: the background service has no console, measured
I reproduce this on
@opencode/cli2.0.32 (npm global,latest). Windows 11, Windows Terminal set as the default terminal application, TUI running in a Windows Terminal tab.The
--standaloneresult from @TGSAN and @gammarinaldi holds on 2.0.32. I probed both server types withAttachConsole(pid)on the live machine:opencode.exe serve --service(background service)AttachConsolefails with error 6 (ERROR_INVALID_HANDLE)opencode.exe serve --stdio --port 0(private server,--standalone)So the background service is a console-less parent. This is measured directly, not inferred from the code. Windows gives a new console to every console child that does not set
CREATE_NO_WINDOW. The default terminal application shows that console. In my setup it becomes a new Windows Terminal tab, and the tab takes focus.Test method: I ran the usual command bursts (git probes, parallel
cmdandpwshchildren, as reported on #52281). With--standalone: no flash, no focus steal. With the background service: new tabs appeared, titled with the path of a child exe (C:\Program Files\...), and they took focus. I have a 22 s screen recording; I can attach it on request.One trap for other users: the background service stays alive after the TUI exits. If you start opencode again without
--standalone, the client connects to that console-less service, and the flashing returns. Runopencode service stopto remove it.opencodejr commentedon Oct 28, 2026
Thanks for the detailed report, and for tracking the windows down to
tasklist.exewith Process Explorer.I think this is a duplicate of #52266. That is the issue tracking this problem: on Windows, OpenCode 2's background service (
opencode serve --service) runs detached with no console of its own. So every console program it starts without the "no window" flag opens a visible window that takes focus, which is why it continues after you exit the CLI.Possible duplicates and closely related issues, ordered from most to least likely:
cmd.exe(git probes, MCP spawns) flashes a visible console window and steals focus despitewindowsHidebeing set #52281: the same symptom, withcmd.exe/gitwindows taking focus in bursts. Commenters there traced part of it to a plugin.tasklistcalls here come from plugin code (omo), not from OpenCode itself.As far as I can tell, OpenCode itself does not run
tasklist, so this is most likely coming from a plugin. Even if you think none of your plugins work on v2, one listed in your config may still be loading. Removing it from your config should stop the windows. Starting with--standalonereportedly avoids the problem too, because the server then runs inside your terminal's console.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencodejr commentedon Oct 29, 2026
We haven't heard back in the past day, so I'm closing this as a duplicate of #52266. That issue tracks the same problem: on Windows, console programs (like the
tasklist.exeyou found) started by OpenCode 2's background service each open a visible window that takes focus.Please follow #52266 for updates, and add a comment there if you have more details, such as which plugin turns out to be running
tasklist. If your problem is actually different, reply here and we can reopen this issue. Thanks again for the Process Explorer investigation!Zh1uyan commentedon Nov 5, 2026
Still reproducing on v2.2.5 (as of 2026-11-05), Windows 11 build 22000 x64 — adding independent instrumentation data from a third-party manager (oc-manager #17):
ConsoleWindowClasswindows (git.exe,python.exe) flash every ~5 s; parents resolve to the detachedopencode serve --service.git.EXE --git-dir <agentdatas>/snapshot/...(ls-files/diff),git status --porcelain,git branch --show-current,python <project>/.trellis/scripts/get_context.py,pwsh -NoProfile -Command "python ./.trellis/scripts/task.py list".windowsHide/CREATE_NO_WINDOWon every spawn it controls; none of those flash. Only opencode's own in-process spawns (snapshot git / shell-tool children) do.Root cause and proposed fix: #60471 (windowless console for the detached service). Note that PR is currently scoped to builds ≥ 26100 — build 22000 (21H2) would remain affected; see my comment there about a
< 26100fallback.