Show pulsing terminal activity icon in thread sidebar #21
main fromcodething/696df84f·merged by juliusmarminge View on GitHubSummary#
- add a dedicated terminal activity indicator in
Sidebarwhen a thread has running terminal processes - switch from a text/dot terminal pill to a pulsing
TerminalIconwith accessiblearia-label/title - keep existing thread status pills (working/connecting/completed/awaiting response) focused on agent turn state
- move timestamp into a right-aligned metadata group alongside terminal activity
Testing#
- Not run (PR content generated from provided commits and diff)
- UI check to perform: thread row shows a pulsing terminal icon only when
runningTerminalIds.length > 0 - UI check to perform: terminal icon exposes tooltip/accessible label "Terminal process running"
- UI check to perform: existing thread status pills and relative timestamps still render correctly across sidebar breakpoints
Summary by CodeRabbit#
Style
- Terminal status indicator redesigned: now displays as an animated icon with dynamic color coding positioned next to thread timestamps for improved visibility.
- 1
Show a pulsing
TerminalIconin the thread sidebar whenterminalStatusIndicatorreports a running terminal in Sidebar.tsx#Replace the text pill with a right-aligned pulsing
TerminalIcondriven byterminalStatusIndicator, adjust theThreadStatusPilltype to removeTerminal, and move the timestamp next to the icon in Sidebar.tsx.📍Where to Start#
Start with the
terminalStatusIndicatorusage and icon rendering in Sidebar.tsx.
Macroscope summarized fea186c.juliusmarminge merged this5da67c4
juliusmarminge closed this
Greptile Overview
Greptile Summary
Introduced terminal subprocess activity tracking to show a dedicated pulsing terminal icon in the thread sidebar when terminals have running child processes. The implementation adds server-side polling that checks for subprocess activity every second using platform-specific commands (
pgrep/pson POSIX, PowerShell on Windows), emits newactivityevents to the client, and updates the UI to display a teal pulsingTerminalIconalongside the timestamp.- Server polls running terminals for subprocess activity and emits
activityevents withhasRunningSubprocessflag - Client tracks
runningTerminalIdsarray in thread state based on activity events - Sidebar displays pulsing terminal icon when
runningTerminalIds.length > 0 - Legacy terminal history files are now migrated from
thread-{id}.logto terminal-scoped paths on open - Terminal close behavior updated to not delete history when hiding the terminal panel
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The implementation is well-architected with comprehensive test coverage, proper error handling, and clean separation of concerns. The subprocess polling logic includes safeguards (in-flight checks, timeouts, graceful fallbacks), platform-specific implementations are robust, and the client-side state management correctly handles all terminal lifecycle events. The code follows project conventions and maintains backward compatibility.
- No files require special attention
Important Files Changed
Filename Overview apps/server/src/terminalManager.ts Added subprocess polling mechanism to detect running child processes in terminals, with platform-specific implementations for Windows and POSIX systems packages/contracts/src/terminal.ts Added terminalActivityEventSchema to define the activity event contract with hasRunningSubprocess field apps/web/src/store.ts Added APPLY_TERMINAL_EVENT action to track runningTerminalIds based on activity events from server apps/web/src/App.tsx Added EventRouter effect to subscribe to terminal events via WebSocket and dispatch APPLY_TERMINAL_EVENT actions apps/web/src/components/Sidebar.tsx Added pulsing TerminalIcon indicator in thread rows when runningTerminalIds is non-empty, moved timestamp to right-aligned metadata group apps/web/src/components/ChatView.tsx Updated terminal close handlers to call api.terminal.close without deleteHistory flag when hiding terminal panel Sequence Diagram
Last reviewed commit: fea186csequenceDiagram participant Terminal as Terminal Session participant TM as TerminalManager participant Poller as Subprocess Poller participant Server as WebSocket Server participant Client as Web Client participant Store as React Store participant UI as Sidebar UI Terminal->>TM: Terminal started TM->>TM: Set hasRunningSubprocess = false TM->>TM: updateSubprocessPollingState() TM->>Poller: Start polling (1s interval) TM->>Server: Emit "started" event Server->>Client: Push terminal event Client->>Store: APPLY_TERMINAL_EVENT (started) Store->>Store: Remove from runningTerminalIds loop Every 1 second Poller->>Poller: Check if sessions exist Poller->>TM: Call subprocessChecker(terminalPid) TM->>TM: Run pgrep/ps (POSIX) or PowerShell (Windows) TM-->>Poller: hasRunningSubprocess = true Poller->>TM: Update session.hasRunningSubprocess TM->>Server: Emit "activity" event (hasRunningSubprocess: true) Server->>Client: Push terminal event Client->>Store: APPLY_TERMINAL_EVENT (activity) Store->>Store: Add to runningTerminalIds Store->>UI: Re-render UI->>UI: Show pulsing TerminalIcon end Terminal->>TM: Subprocess completes Poller->>TM: subprocessChecker returns false TM->>Server: Emit "activity" event (hasRunningSubprocess: false) Server->>Client: Push terminal event Client->>Store: APPLY_TERMINAL_EVENT (activity) Store->>Store: Remove from runningTerminalIds Store->>UI: Re-render UI->>UI: Hide TerminalIcon Terminal->>TM: Terminal exited TM->>TM: Set hasRunningSubprocess = false TM->>TM: updateSubprocessPollingState() TM->>Poller: Stop polling (no running sessions) TM->>Server: Emit "exited" event Server->>Client: Push terminal event Client->>Store: APPLY_TERMINAL_EVENT (exited) Store->>Store: Remove from runningTerminalIds- Server polls running terminals for subprocess activity and emits
Update: added a second commit fixing the MCP discovery bug.
Root cause#
The Claude Agent SDK defaults to isolation mode when
settingSourcesis omitted — no filesystem settings are loaded. This means MCP servers configured in~/.claude/settings.json(like Chrome MCP) were never available to Claude sessions started through T3 Code.Fix#
Pass
settingSources: ['user', 'project', 'local']in the query options so the SDK loads all three settings layers, matching standalone Claude Code behavior.All 26 tests pass, lint clean, typecheck clean.
Sign in to join this conversation.
Caution
Review failed#
The pull request is closed.
Walkthrough#
The Sidebar component was refactored to replace inline terminal status pill handling with a dedicated icon-based indicator. A new TerminalStatusIndicator type was introduced to encapsulate terminal state, terminalStatusPill was renamed to terminalStatusIndicator, and UI rendering now displays a TerminalIcon with dynamic styling instead of the previous pill-based block.
Changes#
apps/web/src/components/Sidebar.tsxEstimated code review effort#
🎯 2 (Simple) | ⏱️ ~12 minutes
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.