win32: console window appears for every child process spawned by background service
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間 37分
- マージ済み PR(30日)
- 512
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
Snapshot capture failure (EPERM spawning git) fails the whole step despite the best-effort contractオープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anomalyco/opencode#58685 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anomalyco/opencode#58664 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anomalyco/opencode#58651 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anomalyco/opencode#58648 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anomalyco/opencode#58636 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
farion1231/cc-switch#8829 ·
メンテナーはふだん 1 日以内に返信
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverオープンdoc-audit enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100