[Windows] qwen-cli (VS Code Companion) leaks headless conhost.exe ConPTY processes - 347 processes / ~2.8 GB after ~12h uptime
Summary
On Windows, the qwen-cli instance embedded in the Qwen Code Companion VS Code extension leaks headless conhost.exe (ConPTY) processes that are never released. After ~12 h of uptime, a single qwen-cli process had accumulated 347 child processes holding ~2.8 GB of RAM, still growing at roughly one per minute even with no active agent session. The standalone CLI (0.23.0) shows the same pattern on a smaller scale.
This is the same problem family as #5873 / #5892 (process tree not fully released on Windows) and #6067, but it is still reproducible in current versions and now manifests as orphaned conhost.exe --headless (ConPTY host) processes rather than powershell.exe.
Environment
- OS: Windows 11, build 26200
- VS Code: 1.124.2
- Qwen Code Companion extension:
qwenlm.qwen-code-vscode-ide-companionv0.21.11 (bundled qwen-cli) - Standalone Qwen Code CLI: 0.23.0 (also affected)
- PC uptime at time of report: ~11.5 h
Observed behavior
Process tree (measured 2026-09-07, ~14:30 local):
extension-host (VS Code)
└── Code.exe ...\qwen-code-vscode-ide-companion-0.21.11-win32-x64\dist\qwen-cli\cli.js --acp --channel=VSCode (pid 19532)
└── Code.exe ... same cli.js ... (pid 11792)
└── 347 × conhost.exe --headless --width 80 --height 30 --signal 0x... --server 0x...Facts measured on the running system:
- 347
conhost.exe --headlesschildren under the Companion's qwen-cli, summing to ~2.8 GB working set (about 8 MB each). - Oldest child created at 02:55 (VS Code launch at logon), newest at 14:29 — ~5 minutes before the measurement, with no agent session active → the count grows without bound over the day.
- Standalone
qwen-codeCLI 0.23.0 session (running since boot): 34 leakedconhost.exe --headlesschildren (~376 MB) from a single session, plus leftovercmd.exe/powershell.exechildren. - The workspace watched by VS Code had zero file modifications during the observation window, so these are not transient activity.
The processes die only when the whole VS Code window is closed, so over a normal workday they accumulate hundreds of processes and gigabytes of RAM.
Expected vs. actual
- Expected: ConPTY host processes are released when their associated shell/session is terminated.
- Actual:
conhost.exe --headlesschildren of qwen-cli stay alive indefinitely after their client exits; every PTY-backed shell/tool execution leaks one.
Suggested direction
The previous fix (#5892) used aggressive taskkill /f /t tree-kill, which users reported kills unrelated third-party apps (#6067). A targeted fix would track the exact child processes spawned for each PTY/shell session (conhost pair + client) and close/release them when the session ends, instead of whole-tree force kills or leaving them orphaned.
Related issues
- #5873 — "every tool call opens a powershell and never closes until OOM"
- #5892 — fix: tree-kill PTY shell tree on Windows (v0.19.3)
- #6067 — community report: Windows process-management problems (v0.19.x)
- #6246 — qwen_code cannot recognize the process it belongs to
Happy to provide more process dumps or logs if useful.
Source: QwenLM/qwen-code