claude-code - 💡(How to fix) Fix [BUG] OSC 9;4 progress bar clears during tool execution instead of staying visible across the full turn [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55111Fetched 2026-05-01 05:45:59
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

Error Messages/Logs

case "error": emit OSC 9;4 state=2

Root Cause

Root cause (from reversed binary)

Fix Action

Fix / Workaround

When terminalProgressBarEnabled: true, the OSC 9;4 progress indicator is only emitted while the model is generating tokens. As soon as the model pauses to dispatch a tool call, Claude Code emits OSC 9;4 CLEAR and the terminal indicator disappears. It reappears when the model resumes generation, then disappears again for the next tool call. This causes a flickering indicator on terminals that render OSC 9;4 (Ghostty, Windows Terminal, recent iTerm2, ConEmu).

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When terminalProgressBarEnabled: true, the OSC 9;4 progress indicator is only emitted while the model is generating tokens. As soon as the model pauses to dispatch a tool call, Claude Code emits OSC 9;4 CLEAR and the terminal indicator disappears. It reappears when the model resumes generation, then disappears again for the next tool call. This causes a flickering indicator on terminals that render OSC 9;4 (Ghostty, Windows Terminal, recent iTerm2, ConEmu).

What Should Happen?

The progress indicator stays visible for the entire turn — ideally indeterminate (OSC 9;4 state 3) during tool execution, and running with a percent during model generation (or indeterminate throughout is fine).

Error Messages/Logs

Steps to Reproduce

  1. Run Claude Code inside a terminal that renders OSC 9;4 (Ghostty, Windows Terminal, iTerm2 3.5+).
  2. Ensure terminalProgressBarEnabled is true.
  3. Send a prompt that triggers several tool calls (e.g. "read these 5 files and summarize").
  4. Watch the terminal's tab / title bar progress indicator.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.123

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Other

Additional Information

Root cause (from reversed binary)

The progress emitter maps Claude's internal completed / null state to OSC 9;4 state 0 (CLEAR):

case "running": emit OSC 9;4 state=1 percent // model generating case "indeterminate": emit OSC 9;4 state=3 case "error": emit OSC 9;4 state=2 case "completed": emit OSC 9;4 state=0 // CLEAR <-- fires between tool calls null/empty: emit OSC 9;4 state=0 // CLEAR

The transition to completed happens when a model turn ends, including the intermediate stops used to hand off to tools within a single user turn.

Proposed fix (either works)

  1. Preferred: switch to indeterminate state while a tool call is in flight instead of completed / CLEAR. Progress semantics at the user level are "the agent is still working," which remains true during tool execution.
  2. Alternative: add a setting, e.g. terminalProgressBarScope: "generation" | "turn" (default "turn"), to keep the indicator alive across tool calls in a single turn and only CLEAR when the full turn completes.

Why it matters

The indicator's whole value is signaling "Claude is still working, don't switch away." Flickering it off during tool calls, which can take many seconds or minutes, defeats the purpose — it looks like Claude is idle when it is actually the busiest

extent analysis

TL;DR

To fix the flickering terminal progress indicator, switch the progress emitter to an indeterminate state while a tool call is in flight instead of clearing it.

Guidance

  • Review the proposed fixes and consider implementing the preferred solution to switch to an indeterminate state during tool calls.
  • Alternatively, add a terminalProgressBarScope setting to control the scope of the progress indicator.
  • Verify the fix by running Claude Code with the modified progress emitter and checking the terminal progress indicator behavior during tool calls.
  • Test the solution with different terminal emulators that support OSC 9;4, such as Ghostty, Windows Terminal, and iTerm2.

Example

// Proposed fix: switch to indeterminate state during tool calls
case "completed": emit OSC 9;4 state=3 // indeterminate instead of CLEAR

Notes

The fix assumes that the progress emitter is the root cause of the issue, and modifying it will resolve the problem. However, additional testing and verification are necessary to ensure the solution works as expected.

Recommendation

Apply the workaround by switching to an indeterminate state during tool calls, as it is the preferred solution and aligns with the progress semantics at the user level.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] OSC 9;4 progress bar clears during tool execution instead of staying visible across the full turn [1 participants]