github / github/copilot-cli

MSBuild floods terminal with raw VT mouse tracking escape sequences, can crash host

未关闭
#1,937 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:tools
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

Running MSBuild (via `Enter-VsDevShell` or directly) through the Copilot CLI's `powershell` tool causes raw ANSI/VT100 mouse tracking escape sequences to flood the terminal. Every mouse movement or click generates additional output, creating a runaway feedback loop that can freeze and crash the host machine.

MSBuild (or the VS Developer Shell) enables VT mouse tracking (`\e[?1003h`) and focus reporting (`\e[?1004h`) on the console. The CLI's PTY doesn't filter these, so the hosting terminal starts sending mouse position reports which get echoed as visible text, creating a feedback loop. Workarounds like `cmd /c`, `Start-Process -WindowStyle Hidden`, and file redirection all failed since the ConPTY still propagates VT mode changes.

### Affected version

GitHub Copilot CLI 1.0.3-2

### Steps to reproduce the behavior

1. Launch `copilot` on Windows in a directory with an MSBuild project
2. Run these commands (or ask the agent to build):
```powershell
$vsPath = "C:\Program Files\Microsoft Visual Studio\18\Enterprise"
Import-Module "$vsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation
msbuild /nr:false /m /clp:ErrorsOnly SomeProject.proj
```
3. Once the build starts, move the mouse over the terminal or click anywhere in it
4. Raw escape sequences flood the output:
```
[50;76M[I[50;76m[75;69M[75;69m[75;69M[75;69m[75;69M[75;69m[...
```
5. Each mouse movement appends more. In my testing, this eventually crashed the host machine.

### Expected behavior

MSBuild should run without raw escape sequences leaking into the terminal. The CLI's PTY layer should handle or suppress VT mouse tracking sequences from child processes. Possible approaches:

- Filter `\e[?1003h`, `\e[?1004h`, `\e[?1006h` from PTY output before rendering
- Disable `ENABLE_MOUSE_INPUT` on the ConPTY when creating shell sessions
- Reset terminal modes (`\e[?1003l\e[?1004l\e[?1006l`) after each command completes

### Additional context

- **OS:** Windows 11
- **CPU architecture:** x86_64
- **Terminal emulator:** Windows Terminal
- **Shell:** PowerShell 7
- **Visual Studio:** 2026 Enterprise (v18.2.2), MSBuild 18.0.5
- **Impact:** Completely blocks using the CLI for C++ and .NET MSBuild projects. The feedback loop can crash the host machine, making it a data-loss risk.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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