MSBuild floods terminal with raw VT mouse tracking escape sequences, can crash host
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
### 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.
Contributor guide
Assessment
This issue has not been assessed yet.