terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Taskbar thread in explorer.exe spins at ~100% CPU while OSC 9;4 indeterminate progress is displayed; taskbar becomes sluggish

Open FarnaHerry opened this issue 1 month ago • 2 comments

Windows build number

10.0.26300.0 (Windows 11)

Terminal version

1.24.12741.0 (Store)

Steps to reproduce

  1. Run a long-lived CLI task that reports OSC 9;4 state 3 (indeterminate) for the duration of the task. Observed with Kimi Code CLI v2.3.1 (kimi.exe), which sends \x1b]9;4;3\x07 when a task starts and \x1b]9;4;0\x07 on completion (both constants are present in the binary: TERMINAL_PROGRESS_ACTIVE_SEQUENCE / TERMINAL_PROGRESS_CLEAR_SEQUENCE).
  2. While the task runs (tens of minutes), interact with the taskbar: clicking taskbar icons to switch windows becomes noticeably laggy, while Alt+Tab stays smooth. When the task ends (CLEAR sent), the lag disappears. Restarting explorer.exe also clears it until the next task starts.

Minimal sequence for context:

# run in Windows Terminal; shows indeterminate taskbar progress for 60 s
$e = [char]27; $b = [char]7
[Console]::Out.Write($e + "]9;4;3;0" + $b); Start-Sleep 60
[Console]::Out.Write($e + "]9;4;0;0" + $b)

Measured evidence (thread-level CPU sampling + A/B test)

  • While the CLI task is running, a single thread in explorer.exe spins at ~100% of one core, almost entirely in user mode (delta sampling: 5.97 s of thread CPU over ~5 s wall clock; explorer.exe overall ≈ one full core on a 16-core machine). The spin persists for the entire duration the indeterminate overlay is up.
  • Ruled out as causes: terminal title churn (0 title changes across 4.5 s of 150 ms polling), window creation churn (top-level window count constant at 518), filesystem metadata storms (system-wide per-process IO normal), and TranslucentTB (killing its process changes nothing: 4.78 vs 4.88 core-seconds per 5 s).
  • A/B test: with the first window's indeterminate progress still up and the thread spinning, opening a second terminal window that also reports OSC 9;4 indeterminate made the spinning thread drop to ~0 immediately (0.06–0.59 core-seconds per 5 s). After that second window closed, the spin returned to ~100% within minutes while the first task was still running. This suggests the taskbar gets stuck in an animation/render loop that any new taskbar progress registration temporarily kicks out of.
  • VS Code's integrated terminal (which ignores OSC 9;4) shows no taskbar lag while running the same CLI task — the symptom tracks Windows Terminal's forwarding of progress state to the taskbar, not the CLI's CPU usage (the CLI itself used well under 0.1 core).

Expected behavior

Displaying indeterminate taskbar progress should not consume an entire core in explorer.exe or degrade overall taskbar responsiveness.

Actual behavior

One explorer.exe thread pegs a core for as long as the overlay is displayed; the taskbar feels unresponsive until the progress state is cleared or explorer.exe is restarted.

Additional context

  • Independent report of the same failure class from another CLI: can1357/oh-my-pi#6709 (progressive explorer.exe degradation eventually freezing the taskbar; that report also notes VS Code ignores OSC 9;4 while Windows Terminal implements it).
  • Downstream reports: MoonshotAI/kimi-code#122 (taskbar click lag while a task runs), MoonshotAI/kimi-code#727 (OSC 9;4 prevents the auto-hide taskbar from appearing — possibly the same stuck state).
  • A WT-side escape hatch would already mitigate this: #19121 (option to disable OSC 9 progress in tab and taskbar). Tracking issue: #6700.
  • Happy to collect more data (ETW trace, thread stacks) if that helps routing this to the taskbar/shell team.

FarnaHerry avatar Oct 24 '26 10:10 FarnaHerry

Hey spend your tokens figuring out if any other window displaying indeterminate progress reproduces the same behavior. I'd be shocked to find out that this was something unique to the way Windows Terminal calls the taskbar APIs to set the progress. I'd bet that any window with indeterminate progress would act the same way.

At that point, I'd guess that it's either:

  • some other thing you've got installed hooking your machine. TranslucentTB is a good theory, but that's been historically quite good. I'd bet it's something else.
  • If this repros on a fresh machine with nothing but a debug HWND with indeterminate progress, then I'd bet it's an issue that needs to be filed on Feedback Hub instead of here. This would indicate it's an issue with the Windows Shell itself.

zadjii-msft avatar Oct 26 '26 10:10 zadjii-msft

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.