fix(display): show spinners and tool progress during streaming mode#2161
Merged
fix(display): show spinners and tool progress during streaming mode#2161
Conversation
When streaming was enabled, two visual feedback mechanisms were completely suppressed: 1. The thinking spinner (TUI toolbar) was skipped because the entire spinner block was gated on 'not self._has_stream_consumers()'. Now the thinking_callback fires in streaming mode too — the raw KawaiiSpinner is still skipped (would conflict with streamed tokens) but the TUI toolbar widget works fine alongside streaming. 2. Tool progress lines (the ┊ feed) were invisible because _vprint was blanket-suppressed when stream consumers existed. But during tool execution, no tokens are actively streaming, so printing is safe. Added an _executing_tools flag that _vprint respects to allow output during tool execution even with stream consumers registered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When streaming is enabled (
display.streaming: true), the CLI was completely silent during API calls and tool execution — no thinking spinner in the TUI toolbar, no ┊ tool progress lines. Only the reasoning box and streamed response text appeared.Root cause
Two blanket suppressions:
Thinking spinner skipped — the spinner block was gated on
not self._has_stream_consumers(), so in streaming mode no spinner ever appeared in the TUI toolbar. The rawKawaiiSpinner(stdout-based) genuinely conflicts with streamed tokens, but thethinking_callback(TUI toolbar widget) works fine alongside streaming._vprintblanket-suppressed —_vprintreturned immediately when stream consumers existed, killing all tool progress output. But during tool execution, no tokens are actively streaming — printing is safe.Fix
Fire
thinking_callbackin streaming mode — theelif not self._has_stream_consumers()gate now only applies to the rawKawaiiSpinner. Thethinking_callbackfires regardless, so the TUI toolbar shows the kawaii spinner during API calls._executing_toolsflag —_execute_tool_callssetsself._executing_tools = True(reset infinally)._vprintchecks this flag and allows output when tools are running, even with stream consumers registered.Test plan
python -m pytest tests/ -n0 -q # 5524 passedVisual verification: enable streaming (
display.streaming: true), send a message that triggers tool calls — TUI toolbar should show spinner during API calls, and ┊ tool progress lines should appear during tool execution.