Skip to content

Add idle thinking spinner to xterm logs#393

Closed
Cheggin wants to merge 3 commits intomainfrom
reagan/tui-spinner
Closed

Add idle thinking spinner to xterm logs#393
Cheggin wants to merge 3 commits intomainfrom
reagan/tui-spinner

Conversation

@Cheggin
Copy link
Copy Markdown
Collaborator

@Cheggin Cheggin commented May 5, 2026

Summary

  • Inline ANSI spinner (cli-spinners dots2, 8 frames @ 80ms) renders in the xterm grid while the agent is running but no bytes have arrived for 250ms — fills the dead time between a user prompt and the first thinking delta, or between a tool_call and the next event
  • Spinner color is per-engine: claude-code → Anthropic orange, codex → blue, browsercode/default → off-white
  • Spinner overwrites its own row via \r\x1b[2K so it never grows scrollback or overlaps content; cleared in place when real bytes arrive or when the session leaves the running state
  • User prompts ( rows) now render with a subtle slate background (#1c2634) extended to end-of-line via \x1b[K, with white text instead of bright cyan so the bg highlight reads as a banded row rather than a colored span

Test plan

  • Start a Claude Code session; confirm orange spinner appears between prompt and first thinking delta
  • Start a Codex session; confirm blue spinner color
  • Start a BrowserCode session; confirm white spinner color
  • Spinner disappears as soon as thinking tokens / tool rows stream in
  • Spinner returns during the gap between a tool_result and the next thinking run
  • Spinner hides when session reaches done or stopped
  • Spinner re-appears on follow-ups (idle gap before the follow-up's first byte)
  • User prompt rows show the slate bg highlight from edge to edge
  • Replay (reopen logs window after the fact) shows highlighted user prompts but no spinner

Summary by cubic

Add an inline “thinking” spinner to xterm logs and a subtle highlight for user prompts to improve feedback during idle gaps. The spinner starts after 250ms of silence, only after the initial replay renders, and clears immediately when bytes stream in or the session stops.

  • New Features
    • Idle spinner renders in-place in the terminal row (dots2, 80ms), paints only at line start, overwrites itself, and never grows scrollback.
    • Per-engine spinner color: claude-code (orange), codex (blue), default/browser (off-white).
    • User prompts now highlight every line of multi-line input with a slate background to end-of-line and white text; continuation lines are indented for alignment.
    • TerminalPane accepts engine and isActive; LogsApp passes session.engine and status so the spinner only shows while running and after replay.
    • Replay view shows prompt highlights but never shows the spinner.

Written for commit 1578673. Summary will update on new commits.

@Cheggin Cheggin requested a review from sauravpanda as a code owner May 5, 2026 00:11
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/hl/streamToTerm.ts">

<violation number="1" location="app/src/main/hl/streamToTerm.ts:139">
P2: Handle embedded newlines before `\x1b[K`; multi-line prompts only get the full-width background on the last line.</violation>
</file>

<file name="app/src/renderer/hub/TerminalPane.tsx">

<violation number="1" location="app/src/renderer/hub/TerminalPane.tsx:201">
P2: Prevent the idle spinner from starting before terminal replay is applied; otherwise spinner frames can race with replay rendering and overwrite visible replay content.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread app/src/main/hl/streamToTerm.ts Outdated
Comment thread app/src/renderer/hub/TerminalPane.tsx
@sauravpanda sauravpanda removed their request for review May 5, 2026 02:19
@Cheggin Cheggin closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant