win32: console window appears for every child process spawned by background service
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- backend
调研方向
首先追踪服务为 Git 快照、shell 工具和 rg 创建进程的过程;issue 没有指出相关文件,因此搜索日志消息 spawning process 以及对应的 spawn 或 execFile 调用。检查这些调用如何处理 Windows 选项,然后验证服务子进程运行时不会显示控制台窗口。完成标准是受影响的进程在 Windows 上不再创建窗口,同时仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Summary
On Windows, the background service spawns every child process (git, powershell, rg) with a new visible console window. Because the service runs console-less, Windows allocates a fresh console per spawn, so windows appear continuously during normal work.
Environment
- opencode version: 2.1.2 (
latestchannel, npm global install) - OS: Windows 11 Home Single Language, build 26300 (win32 x64)
- Terminal: Windows Terminal (
WT_SESSIONset),TERM=xterm-256color - Shell:
C:\WINDOWS\system32\cmd.exe(ComSpec) - Install/channel: npm global (
%APPDATA%\npm\opencode.cmd), not dev/beta - Active plugins: opencode-supervisor, opencode-auto-model, opencode-idle-compaction, github:steverova/kiro-provider, @xberg-io/opencode-liter-llm, @xberg-io/opencode-xberg, kibi-opencode
Reproduction
- On Windows 11, install and run opencode so the shared background service is active (
opencode service statusreturns a URL). - Open a workspace that is a git repository and start a session.
- Observe the desktop while the session runs, without invoking any tool manually.
Expected Behavior
Child processes spawned by the service run hidden. On Windows this means passing windowsHide: true (or CREATE_NO_WINDOW) to the spawn call, so no console window is allocated.
Actual Behavior
Each spawned process allocates its own console window, which appears on the desktop and steals focus. Windows are visible for git, powershell, and rg invocations. With continuous snapshot/diff activity this produces a near-constant stream of windows.
Evidence from %USERPROFILE%\.local\share\opencode\log\opencode.log — total spawning process records and breakdown by executable:
6887 total spawns
5190 git.EXE
1300 powershell.EXE
222 rg.exe
125 opencode.exe
Sample log line:
level=INFO msg="spawning process" command="C:\\Program Files\\Git\\cmd\\git.EXE" \
args="[\"--git-dir\",\"...snapshot...\",\"--work-tree\",\"E:\\...\",\"ls-files\",...]" role=server
Additional Context
Why this happens: the service is started detached and owns no console. Per Windows process creation semantics, a child created without CREATE_NO_WINDOW/DETACHED_PROCESS from a console-less parent gets a new console allocated, which is shown to the user.
Workaround applied: no user-side config disables the spawns. Setting Windows Terminal as the default terminal application (HKCU:\Console\%%Startup → DelegationConsole/DelegationTerminal = {E12CFF52-A866-4C77-9A90-F570A7AA2C6B}) consolidates the windows into tabs of one window, which reduces visual noise but does not stop the consoles from being created.
Suggested fix: set windowsHide: true on the spawn/execFile calls used by the service for git snapshotting, the shell tool, and rg. Node's child_process defaults this to false, which is what produces the visible window here.
Frequency: consistent, every session; scales with git snapshot activity.
- 主要语言
- TypeScript
- 星标
- 215k
- 派生
- 28.9k
- 平均合并
- 4 小时 21 分钟
- 30 天内合并 PR
- 476
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
reproduced
难度 2/5 1-3 小时 新手友好度 74/100
anomalyco/opencode#58247 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
anomalyco/opencode#58216 · 1 条评论 ·
维护者通常 1 天内回复
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 65/100
anomalyco/opencode#58181 · 1 条评论 ·
维护者通常 1 天内回复
-
Opencde Github Actions Bot Cannot Install可能已有人在做 @zzz-creator 今天认领。 未关闭reproduced
难度 2/5 1-3 小时 新手友好度 65/100
anomalyco/opencode#57911 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#57855 · 1 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 82/100
source-cooperative/docs.source.coop#41 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
Nimblesite/SharpLsp#468 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
solidjs-community/solid-primitives#1082 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复