github / github/copilot-cli

[Windows] Every shell command spawns a visible PowerShell console window (new console, not hidden) that stays open for the command's lifetime

オープン
#4,549 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

triage
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

Summary

On Windows, Copilot CLI briefly flashes an empty PowerShell / conhost console
window every time the agent executes a shell command. During normal agent
activity (many commands per task) this produces near-constant window flashing
that momentarily steals focus and is very distracting.

This appears to be the same class of bug as the already-fixed git / hook /
path-resolution flashes (PRs #10235 and #11037) and the open MCP-startup flash
(#3171), but on the general agent shell-command execution path, which is
still affected.

Environment
  • Copilot CLI: 1.0.80 (latest at time of report)
  • OS: Windows 11 24H2, build 26100.9106
    (registry ProductName cosmetically reads "Windows 10 Enterprise" on this build)
  • Shell: PowerShell (default on Windows)
  • Terminal: Windows Terminal
Steps to reproduce
  1. Launch copilot in Windows Terminal on Windows 11.
  2. Ask the agent to run essentially any shell command (e.g. a simple
    Get-ChildItem, or any node -e "..." invocation).
  3. Watch the screen while the command executes.
Expected

Shell commands run without any visible console window appearing — as already
happens for git commands and for hook / path-resolution after #10235 / #11037.

Actual

A blank PowerShell / conhost window flashes on screen for each spawned
command, briefly stealing focus.

Real-world example that triggers it

This is an actual command a session spawned (a mermaid-diagram validation step).
Every command shaped like this flashes a window:

$node = "C:\ProgramData\global-npm\node_modules\node\bin\node.exe"
$script = @'
const fs = require("fs");
const files = process.argv.slice(2);
let idx = 0;
for (const f of files) {
  const txt = fs.readFileSync(f, "utf8").split(/\r?\n/);
  let inBlock = false, buf = [], start = 0;
  for (let i = 0; i < txt.length; i++) {
    const line = txt[i];
    if (!inBlock && /^\s*```mermaid\s*$/.test(line)) { inBlock = true; buf = []; start = i + 1; continue; }
    if (inBlock && /^\s*```\s*$/.test(line)) {
      inBlock = false; idx++;
      const base = f.replace(/^.*[\\/]/, "");
      const out = `${process.env.TEMP}\\mmvalidate\\block_${idx}_${base}_L${start+1}.mmd`;
      fs.writeFileSync(out, buf.join("\n"));
      continue;
    }
    if (inBlock) buf.push(line);
  }
}
'@
Set-Content -Path "$env:TEMP\mmvalidate\extract.js" -Value $script -Encoding utf8
& $node "$env:TEMP\mmvalidate\extract.js" "$env:TEMP\brga.md" "$env:TEMP\rad.md" "$env:TEMP\rrd.md"

Note: the window that flashes is the outer powershell.exe host the CLI
spawns
to run the command — not node.exe. node is a console app and
inherits the parent console, so it does not create a window on its own. The
content of the command is irrelevant; any shell command triggers the flash.

Likely root cause

The CLI runs shell commands on Windows via node-pty / ConPTY (conpty.node).
The pseudo-console host (conhost.exe) for the spawned command is not being
suppressed on this path, so its window briefly appears. The earlier fixes added
window suppression (windowsHide / CREATE_NO_WINDOW) only to specific paths:

  • #10235 — "Git commands no longer flash a console window on Windows"
  • #11037 — "Prevent brief console windows from flashing on Windows when the
    agent runs hook commands or resolves command paths"

The main agent command-execution path appears not to have the equivalent
suppression.

Related
  • #3171 — [Windows] CMD windows flash on screen when MCP servers start
    (same class of bug, different trigger)
Suggested fix

Apply the same window-suppression used in #10235 / #11037 to the agent's
shell-command execution path — i.e. ensure the ConPTY / child-process spawn
passes windowsHide: true (or creates the console host without a visible
window / uses a headless OpenConsole host consistently) for every command the
agent runs, not just git, hooks, and path resolution.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

エージェントの一般的なシェルコマンド実行経路をたどり、node-pty/ConPTY 経由でコマンドを起動する方法を調査します。プロセスオプションを、PRs #10235 と #11037 におけるウィンドウ抑制の変更と比較してから、Windows で再現します。完了の条件は、シェルコマンドを繰り返し実行しても PowerShell または conhost のウィンドウが一瞬表示されたり、フォーカスを奪ったりしなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
node.js, powershell
領域
cli, operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。