Skip to content
Source
Sign inSign up
pingdotgg/t3code

Show pulsing terminal activity icon in thread sidebar #21

Mergedjuliusmarmingemerged 1 commit intomain fromcodething/696df84fmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Summary

  • add a dedicated terminal activity indicator in Sidebar when a thread has running terminal processes
  • switch from a text/dot terminal pill to a pulsing TerminalIcon with accessible aria-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

Open with Devin

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. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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

      Cohort / File(s)Summary
      Terminal Status Indicator Refactoring
      apps/web/src/components/Sidebar.tsx
      Added TerminalIcon import; introduced TerminalStatusIndicator type replacing Terminal from ThreadStatusPill union; refactored terminalStatusPill logic to terminalStatusIndicator returning structured indicator object; updated rendering to display TerminalIcon with color and pulse animation instead of inline pill when terminal status exists.

      Estimated code review effort

      🎯 2 (Simple) | ⏱️ ~12 minutes

      ✨ Finishing touches
      • 📝 Generate docstrings
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `codething/696df84f`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Show a pulsing TerminalIcon in the thread sidebar when terminalStatusIndicator reports a running terminal in Sidebar.tsx

      Replace the text pill with a right-aligned pulsing TerminalIcon driven by terminalStatusIndicator, adjust the ThreadStatusPill type to remove Terminal, and move the timestamp next to the icon in Sidebar.tsx.

      📍Where to Start

      Start with the terminalStatusIndicator usage and icon rendering in Sidebar.tsx.


      Macroscope summarized fea186c.
    3. juliusmarminge merged this5da67c4

    4. juliusmarminge closed this

    5. 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/ps on POSIX, PowerShell on Windows), emits new activity events to the client, and updates the UI to display a teal pulsing TerminalIcon alongside the timestamp.

      • Server polls running terminals for subprocess activity and emits activity events with hasRunningSubprocess flag
      • Client tracks runningTerminalIds array 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}.log to 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

      FilenameOverview
      apps/server/src/terminalManager.tsAdded subprocess polling mechanism to detect running child processes in terminals, with platform-specific implementations for Windows and POSIX systems
      packages/contracts/src/terminal.tsAdded terminalActivityEventSchema to define the activity event contract with hasRunningSubprocess field
      apps/web/src/store.tsAdded APPLY_TERMINAL_EVENT action to track runningTerminalIds based on activity events from server
      apps/web/src/App.tsxAdded EventRouter effect to subscribe to terminal events via WebSocket and dispatch APPLY_TERMINAL_EVENT actions
      apps/web/src/components/Sidebar.tsxAdded pulsing TerminalIcon indicator in thread rows when runningTerminalIds is non-empty, moved timestamp to right-aligned metadata group
      apps/web/src/components/ChatView.tsxUpdated terminal close handlers to call api.terminal.close without deleteHistory flag when hiding terminal panel

      Sequence Diagram

      sequenceDiagram
          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
      Last reviewed commit: fea186c
    6. Update: added a second commit fixing the MCP discovery bug.

      Root cause

      The Claude Agent SDK defaults to isolation mode when settingSources is 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.