Skip to content

fix(agents): reset working status to idle when terminal tab is focused#899

Closed
roberto-fernandino wants to merge 19 commits into
crynta:mainfrom
roberto-fernandino:fix/agents-working-stuck-on-interrupt
Closed

fix(agents): reset working status to idle when terminal tab is focused#899
roberto-fernandino wants to merge 19 commits into
crynta:mainfrom
roberto-fernandino:fix/agents-working-stuck-on-interrupt

Conversation

@roberto-fernandino

@roberto-fernandino roberto-fernandino commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Ctrl+C interrupts Claude Code without firing a finished signal, leaving status stuck on working
  • Tab-focus effect now resets any non-idle status to idle when the user navigates to the terminal; genuine active tasks get promoted back by the next backend working signal

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added an optional Agents sidebar tab with a dedicated panel, session count badge, and agent-to-terminal linking.
    • Added a new Show Agents sidebar tab setting to control sidebar visibility.
    • Introduced new keyboard shortcuts for toggling the AI chat window and opening the Files sidebar.
    • Expanded command palette options for switching between terminals and files/sidebar views.
  • Bug Fixes

    • Improved agent status handling so finished sessions return to idle correctly.
    • Fixed status labels and icons so agent activity is shown more accurately.

Roberto and others added 19 commits June 26, 2026 13:07
feat(tabs): select tabs by index within active space
…dow-shortcut

feat(shortcuts): add ai toggle mini shortcut
…nd-palette

feat: terminals in command-palette
Adds a new keyboard shortcut (Cmd+Shift+G by default) that switches the
sidebar to the Files/explorer view. Pairs naturally with Cmd+G (source
control) so the user can toggle between them without touching the mouse.

The shortcut uses cycleSidebarView("explorer") — same pattern as pane.source
uses for source-control — and is fully configurable in Settings > Shortcuts.
Also exposed as "Show Files sidebar" in the command palette.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tcut

feat(shortcuts): add configurable shortcut to show Files sidebar
Documents and enforces the mandatory workflow: branch → commit →
dual PR (fork + upstream cross-fork) → merge fork → back to main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New "Agents" sidebar tab lists every Claude Code, Codex, Gemini,
  OpenCode and Cursor agent running in terminals, with status badges
  (working / needs input) and one-click navigation to the terminal tab
- Terminal tabs whose agent is detected by the backend now show that
  tool's logo (Claude, Gemini, Codex/OpenCode, or robotic fallback)
  instead of the generic terminal icon
- "Show Agents sidebar tab" toggle in Settings > General (default on);
  disabling it falls back to the Files view
- Merged upstream additions: Codex/Gemini notification hooks,
  per-agent notification bell, jump-to-attention shortcut

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-and-logos

feat(sidebar): Agents tab + agent logos in terminal tabs
When an agent process starts (claude, codex, etc.) it was immediately
shown as "working" even though it was just sitting at its idle prompt.

Added "idle" as a third AgentStatus. The "started" signal now sets idle;
only the explicit "working" signal (fired when the agent begins executing
a task) promotes it to working. The sidebar badge count excludes idle
sessions so the badge only lights up during real activity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(agents): show idle status when agent is at prompt, not working
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…efault

feat(ai): open AI panel by default on startup
- "finished" signal now sets status back to "idle" instead of "waiting"
  so the badge only lights up on genuine attention requests, not routine
  task completions
- Added a useEffect in App.tsx: when the active tab becomes a terminal
  that has a waiting agent, reset it to idle — the user is already
  looking at it so the notification is no longer relevant; covers all
  nav paths (tab click, keyboard shortcut, notification bell, agents panel)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on-focus

fix(agents): clear needs-input when tab focused; finished resets to idle
Ctrl+C interrupts Claude Code without firing a finished signal, leaving
the status permanently stuck on "working". Extend the tab-focus effect
to reset any non-idle status (waiting or working) to idle when the user
navigates to the terminal. If the agent is genuinely still running, the
backend will fire the next working signal and promote it back immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds an "Agents" sidebar panel with a new AgentsPanel component, an "idle" state to AgentStatus, agent icons in TabBar, a showAgentsTab preference, space-aware tab selection via pickTabBySpaceIndex, new ai.toggleMini/sidebar.files shortcuts, terminal tab switching in the command palette, and a pnpm version bump.

Changes

Agents Panel & Status Lifecycle

Layer / File(s) Summary
AgentStatus idle state and agent metadata
src/modules/agents/lib/types.ts, src/modules/agents/store/agentStore.ts, src/modules/agents/components/AgentNotificationsBridge.tsx, src/modules/agents/lib/format.ts, src/modules/agents/lib/agentIcon.tsx, src/modules/agents/components/NotificationBell.tsx
AgentStatus gains "idle", new sessions initialize as "idle" instead of "working", the "finished" branch sets "idle" after routing, NotificationBell renders "idle" label correctly, and "opencode"/"cursor" agent identifiers are mapped.
AgentsPanel component
src/modules/agents-panel/AgentsPanel.tsx, src/modules/agents-panel/index.ts
New AgentsPanel renders an empty state or scrollable session list with StatusBadge pills, tab title resolution via tabTitleFor, PanelHeader with optional count bubble, and a barrel re-export.
Sidebar agents view type, rail, and panel hook
src/modules/sidebar/types.ts, src/modules/sidebar/SidebarRail.tsx, src/modules/sidebar/useSidebarPanel.ts
SidebarViewId adds "agents", SidebarRail conditionally appends an Agents item with RoboticIcon badge, and useSidebarPanel gates "agents" restore from localStorage behind showAgentsTab, auto-falling back to "explorer" when the tab is hidden.
showAgentsTab preference persistence and settings UI
src/modules/settings/store.ts, src/settings/sections/GeneralSection.tsx
Adds showAgentsTab: boolean to Preferences (default true), a KEY_SHOW_AGENTS_TAB storage key, setShowAgentsTab setter with cross-window propagation, and a Switch toggle in the General settings section.
Agent icons in TabBar via agentsByTabId
src/modules/header/Header.tsx, src/modules/tabs/TabBar.tsx
Header and TabBar accept an optional agentsByTabId: Map<number, string>; TabIcon renders AgentIcon for terminal tabs when the map contains a matching entry.
Space-aware tab selection
src/modules/tabs/lib/useTabs.ts, src/modules/tabs/lib/pickTabBySpaceIndex.test.ts
Exports pickTabBySpaceIndex(tabs, idx, spaceId) and updates selectByIndex to accept an optional spaceId, selecting within that space's tab pool; five Vitest assertions cover indexing and out-of-range cases.
New shortcuts and command palette terminal/sidebar commands
src/modules/shortcuts/shortcuts.ts, src/modules/command-palette/commands.ts, src/modules/ai/components/AiStatusBarControls.tsx, src/modules/ai/store/chatStore.ts
Adds ai.toggleMini (Mod+Shift+I) and sidebar.files (Mod+Shift+G) shortcut IDs; extends CommandPaletteActionContext with terminalTabs/switchTab/toggleFilesExplorer; adds a "Terminals" group and "sidebar.files" command; removes disabled from the mini chat toggle; defaults panelOpen to true.
App.tsx wiring
src/app/App.tsx
Derives agentSessions/agentsByTabId from the agent store, passes showAgentsTab into useSidebarPanel, adds an effect resetting non-idle sessions to "idle" on terminal navigation, updates shortcut handlers for space-aware index selection and composer-gated toggleMini, extends the command palette with terminal tab switching, and renders AgentsPanel in the sidebar.

Infra and tooling

Layer / File(s) Summary
pnpm version bump and Terax PR workflow skill
package.json, .claude/skills/terax-pr-workflow/SKILL.md
Updates packageManager to pnpm@11.9.0 and adds a skill document defining the mandatory fork+upstream dual-PR workflow with step-by-step commands and rules.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • crynta/terax-ai#885: Modifies AgentNotificationsBridge.tsx and NotificationBell.tsx for agent notification handling and status display, directly overlapping with the idle-status lifecycle changes here.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the main fix to agent status handling on terminal focus.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@roberto-fernandino

Copy link
Copy Markdown
Contributor Author

Duplicate — this fix is already included in #891 (feat/agents-sidebar-tab-and-logos) via the feat/agents-sidebar-tab-and-logos branch.

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