Skip to content

fix(sidebar): keep the agent name first on monitoring compact rows - #18286

Open
gum798 wants to merge 1 commit into
stablyai:mainfrom
gum798:fix/monitoring-row-name-first
Open

gum798 wants to merge 1 commit into
stablyai:mainfrom
gum798:fix/monitoring-row-name-first

Conversation

@gum798

@gum798 gum798 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

In the sidebar's compact agent list, an agent that is "monitoring background tasks" showed its status label first and its name second. That label is 27 characters long, so at the default sidebar width the row read "Monitoring backgroun…" and the name never appeared. Every other state shows the name first. This PR makes the monitoring row do the same: name first, status after the dash. The yellow heartbeat icon on the row (and its tooltip) still says the agent is monitoring.

What Changed

  • CompactAgentRow (src/renderer/src/components/sidebar/worktree-card-compact-agent-row.tsx): the leading/trailing text no longer swaps places for dotState === 'monitoring'. The row always renders <primary> - <secondary>.
  • The guard that drops the trailing text when it equals the leading text used to live only inside the monitoring branch; it now applies to every state. It fires only when the two strings are identical, so it removes redundant X - X rows and loses no information. Interrupted and unverifiable rows are unaffected because their primary fallback (Interrupted, No recent update) and secondary labels (Interrupted by user, No update in 34m) never match. The no-prompt monitoring row, where both fall back to the state label, still reads Monitoring background tasks exactly once.
  • Tests (worktree-card-agent-summary.test.ts): the existing monitoring-row assertions now expect name-first ordering, a new case checks that a monitoring row without a prompt names the state once, and the prompt-first case also pins that the state dot still carries aria-label="Monitoring background tasks", since that dot is now what names the state when the trailing label truncates.

No change to getCompactAgentSecondary, the dot state, the tooltip, the full-size DashboardAgentRow, or mobile (both were already name-first). The review-notes send menu still lists the state label before the tab title in its secondary line; that is a dropdown, not a truncating sidebar row, and is out of scope here.

Why

Fixes #17546. With two or more monitoring agents in one worktree (a coordinator plus a log monitor, say), their rows were visually identical at default width and could only be told apart by hovering each one.

The status-first ordering came from ec4687c (#16201), whose comment named the invariant it protected: sidebar truncation must preserve the passive-vs-active distinction. That was the right call under the conditions it shipped in. At that point AgentStateDot set only an aria-label on the monitoring glyph and rendered no hover tooltip, as #16981 later documented, so the leading text was the only place a mouse user could read the state from. #16981 changed that premise: every state glyph now carries a labelled tooltip, and monitoring moved from Radio to a static Activity heartbeat chosen because it reads as "still running". The distinction therefore now rides on a glyph that cannot be truncated, while the ordering that used to protect it costs the row the one piece of information nothing else on the row carries: the agent's name. Ordering the row like every other state keeps the distinction (yellow Activity glyph plus tooltip, and the label after the dash when there is room) and lets the name survive truncation.

Two edge cases worth naming rather than leaving for review to find:

  • Under prefers-reduced-motion the working spinner freezes into a complete yellow ring, so for those users working and monitoring separate on glyph shape and size (6px ring vs 10px heartbeat) plus the tooltip and aria-label, not on motion. That was already the case before this PR.
  • In send-target picker mode the row intentionally suppresses the dot's tooltip so the disabled reason wins on hover (pinned by the existing test). The glyph and aria-label remain.

Linked Issue

Fixes #17546

Visual Proof

pnpm dev on macOS, default sidebar width, two Claude sessions in one worktree that each left a sleep 900 background shell running and ended their turn.

Before (status label first; the two rows are indistinguishable):
before-sidebar-monitoring-rows

After (name first; the yellow heartbeat glyph and its tooltip still show the monitoring state):
after-sidebar-monitoring-rows

Testing

  • pnpm test src/renderer/src/components/sidebar/worktree-card-agent-summary.test.ts

  • pnpm test (full suite: 7465 files passed, 48 skipped)

  • pnpm tc

  • pnpm run check:code-quality:changed, oxlint, oxfmt --check on the changed files

  • Manually verified in pnpm dev on macOS (Apple Silicon): started a Claude Code session in a worktree terminal, had it leave a background shell task running and end its turn, and confirmed the sidebar row reads <name> - Monitoring background tasks with the yellow heartbeat glyph, then reverted the component to capture the before state from the same session.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Implemented with Claude Code (Claude Fable 5.1) under the author's direction; the author reviewed the diff, ran the checks, and captured the screenshots.

Review

AI code review summary (Claude Code, four independent review passes with adversarial verification of each finding):

  • Cross-platform (macOS / Linux / Windows): renderer-only string ordering; no platform APIs, paths, or shortcuts touched.
  • SSH / remote / local: the row renders from the same DashboardAgentRow data regardless of execution host; no RPC or wire shape changes.
  • Agents / integrations / git providers: workingMode: 'monitoring' is the only input and is unchanged; the change applies uniformly to whichever agent reports it.
  • Performance: two ternaries replaced with one equality check inside an already-memoized component; no new work per render.
  • UI quality: consistent with the other states in the same row and with DashboardAgentRow and mobile; the tooltip text follows the same order as the visible text because both derive from the same pair. No color or layout change, so light/dark are unaffected.
  • Security: no user input handling, IPC, or filesystem involvement.
  • Backwards compatibility: no persisted state or wire protocol involved.
  • Regression search: no other production code, test, snapshot, or doc depends on the old ordering or the removed leadingText/trailingText names.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Mobile's worktree row already renders name-first and is untouched.

Author

X: @gum79

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

https://claude.ai/code/session_01WwSFoun5enrK3iiFrbFWRz

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 3920f666-3969-40ff-bbdc-34cd9edf640f

📥 Commits

Reviewing files that changed from the base of the PR and between 36e139e and 272a7dd.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/worktree-card-agent-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-card-compact-agent-row.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/sidebar/worktree-card-agent-summary.test.ts
  • src/renderer/src/components/sidebar/worktree-card-compact-agent-row.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The compact agent row now always renders the primary text first. It appends secondary text only when the secondary text differs from the primary text. Monitoring rows show the prompt before the monitoring label. Rows without a prompt show the monitoring state once. Tests update expected titles, markup, and accessibility labels for these cases.

Merge Risk: ⚪ Minimal · up to 272a7

This change keeps agent names visible in compact monitoring rows while preserving the monitoring indicator and accessibility label; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: keeping the agent name first on monitoring compact rows.
Description check ✅ Passed The description is complete and follows the repository template. It explains the change, rationale, linked issue, visual proof, testing, AI disclosure, compatibility considerations, and checklist stat…
Linked Issues check ✅ Passed The implementation satisfies issue [#17546] by rendering the agent name before the monitoring status while preserving the monitoring icon, tooltip, and accessibility label.
Out of Scope Changes check ✅ Passed The component and test changes are directly related to issue [#17546]. No unrelated production, platform, protocol, or documentation changes are included.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the change, rationale, linked issue, visual proof, testing, AI disclosure, compatibility considerations, and checklist status.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.


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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • CompactAgentRow name-first ordering — the dotState === 'monitoring' branch that swapped primary/secondary is removed; the row now always renders <primary> - <secondary>, so the agent name survives default-width truncation while the monitoring state stays visible via the AgentStateDot glyph, aria-label, and tooltip.
  • Universal passive/active dedup — the primary === secondary ? '' : secondary guard that previously lived only in the monitoring branch now applies to all states, collapsing redundant X - X rows without losing information.
  • Tests updated and extended — monitoring assertions now expect name-first ordering, a new case pins the no-prompt row naming the state exactly once, and the prompt-first case additionally asserts the state dot still carries aria-label="Monitoring background tasks".

I traced the ordering/truncation invariants (the passive-vs-active distinction now rides on the untruncatable dot + tooltip), the interrupted/unverifiable fallbacks that stay distinct, and the no-prompt monitoring case that correctly collapses to a single state label, and ran the affected test file (5 passing). The change is renderer-only and consistent with how DashboardAgentRow and mobile already order the row.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

The compact agent row led with the 27-char "Monitoring background tasks"
label and put the agent name after the dash, so at default sidebar width
the name truncated out of view and two monitoring agents looked identical.
Every other state renders name first; do the same for monitoring and drop
the trailing text only when it would repeat the leading text. The state
dot and its tooltip still show the monitoring state.

Fixes stablyai#17546

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WwSFoun5enrK3iiFrbFWRz
@gum798
gum798 force-pushed the fix/monitoring-row-name-first branch from 96ca0c3 to 272a7dd Compare September 3, 2026 00:06
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Rebase onto main — the single commit was force-pushed and re-applied onto a newer main; its patch body is byte-identical to the previously reviewed version (same two files, same 19 + / 10 −), so the name-first ordering and the universal passive/active dedup are unchanged.
  • Base drift in getCompactAgentSecondary — the new base now calls getCompactAgentSecondary(agent, now, stableMessage) with an added lastAssistantMessageOverride. I traced that the monitoring branch (working + workingMode: 'monitoring') short-circuits to the state label before that override is consulted, so the name-first monitoring row is unaffected.

I re-ran worktree-card-agent-summary.test.ts against the new base (5 passing) and confirmed no interaction between the rebased signature and the dedup logic.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@alanmarcell

Copy link
Copy Markdown

Still reproducible on 1.4.206 (Linux, orca-ide-bin). When several Claude Code agents are monitoring background tasks, every sidebar row reads "Monitoring background tasks - ", so you can't tell the agents apart at a glance, and the state dot already shows the monitoring state. The cause is still in WorktreeCard: e.state==='working'&&e.entry.workingMode==='monitoring'?ct('monitoring'): runs before the agent's own title or summary. Removing that branch locally fixes it for us. +1 to merging this; happy to rebase it if that helps.

This branch has not been deployed

No deployments
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.

[Feature]: Keep agent name first in sidebar rows for the monitoring state

2 participants