Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

win32: console window appears for every child process spawned by background service

已关闭 适合新手
#57,907 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
backend

调研方向

首先追踪服务为 Git 快照、shell 工具和 rg 创建进程的过程;issue 没有指出相关文件,因此搜索日志消息 spawning process 以及对应的 spawn 或 execFile 调用。检查这些调用如何处理 Windows 选项,然后验证服务子进程运行时不会显示控制台窗口。完成标准是受影响的进程在 Windows 上不再创建窗口,同时仍能正常工作。

由索引模型根据 Issue 内容生成。

描述

pending close triaging

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 (latest channel, npm global install)
  • OS: Windows 11 Home Single Language, build 26300 (win32 x64)
  • Terminal: Windows Terminal (WT_SESSION set), 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

  1. On Windows 11, install and run opencode so the shared background service is active (opencode service status returns a URL).
  2. Open a workspace that is a git repository and start a session.
  3. 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。