Repository navigation
fix(sidebar): a title that only names an agent reads "No status reported", not "Idle" #24083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brennanb2025
wants to merge
2
commits into
main
Choose a base branch
from
brennanb2025/b9b-title-no-status-reported
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+449
−55
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/renderer/src/components/sidebar/smart-attention-bare-agent-name.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { IDLE, buildAttentionByWorktree, resolveAttention } from './smart-attention' | ||
| import type { TerminalTab } from '../../../../shared/terminal-tab-types' | ||
| import type { Worktree } from '../../../../shared/worktree/types' | ||
|
|
||
| const NOW = new Date('2026-03-27T12:00:00.000Z').getTime() | ||
|
|
||
| const WORKTREE: Worktree = { | ||
| id: 'wt-1', | ||
| repoId: 'repo-1', | ||
| path: '/tmp/wt-1', | ||
| branch: 'refs/heads/wt-1', | ||
| head: 'abc', | ||
| isBare: false, | ||
| isMainWorktree: false, | ||
| linkedIssue: null, | ||
| linkedPR: null, | ||
| linkedLinearIssue: null, | ||
| isArchived: false, | ||
| comment: '', | ||
| isUnread: false, | ||
| isPinned: false, | ||
| displayName: 'wt-1', | ||
| sortOrder: 0, | ||
| lastActivityAt: 0 | ||
| } | ||
|
|
||
| const TAB: TerminalTab = { | ||
| id: 'tab-1', | ||
| ptyId: 'pty', | ||
| worktreeId: WORKTREE.id, | ||
| title: 'bash', | ||
| customTitle: null, | ||
| color: null, | ||
| sortOrder: 0, | ||
| createdAt: 0 | ||
| } | ||
|
|
||
| function attentionForTitle(title: string) { | ||
| return buildAttentionByWorktree( | ||
| [WORKTREE], | ||
| { [WORKTREE.id]: [TAB] }, | ||
| {}, | ||
| { [TAB.id]: { 1: title } }, | ||
| { [TAB.id]: ['pty-1'] }, | ||
| NOW | ||
| ).get(WORKTREE.id) | ||
| } | ||
|
|
||
| // Regression guards, hand-built titles: on main a bare name read idle, which ranked the same. | ||
| describe('smart attention for a title that only names its agent', () => { | ||
| it('ranks the pane with idle, never as attention', () => { | ||
| for (const title of ['agy', 'grok', 'OpenCode']) { | ||
| expect(attentionForTitle(title)).toEqual(IDLE) | ||
| } | ||
| // Positive control: the same pane with a spinner reaches the working class. | ||
| expect(attentionForTitle('⠋ agy')?.cls).toBe(3) | ||
| }) | ||
|
|
||
| it('lets an unreported title pane contribute nothing', () => { | ||
| expect( | ||
| resolveAttention( | ||
| [{ kind: 'title', status: 'unreported', worktreeLastActivityAt: NOW - 1_000 }], | ||
| NOW | ||
| ) | ||
| ).toEqual(IDLE) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/renderer/src/components/sidebar/worktree-card-unreported-agent-row.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import { createElement } from 'react' | ||
| import { renderToStaticMarkup } from 'react-dom/server' | ||
| import { describe, expect, it, vi } from 'vitest' | ||
| import { TooltipProvider } from '@/components/ui/tooltip' | ||
| import { dashboardRowBucketProjection } from '@/components/dashboard/dashboard-row-bucket' | ||
| import type { TerminalTab } from '../../../../shared/terminal-tab-types' | ||
| import { buildWorktreeAgentRows } from './worktree-agent-rows' | ||
| import { CompactAgentRow } from './worktree-card-compact-agent-row' | ||
| import { summarizeAgents } from './worktree-card-agent-summary' | ||
|
|
||
| const LEAF_ID = '77777777-7777-4777-8777-777777777777' | ||
|
|
||
| function makeTab(id: string): TerminalTab { | ||
| return { | ||
| id, | ||
| worktreeId: 'wt-1', | ||
| ptyId: null, | ||
| title: 'Terminal', | ||
| customTitle: null, | ||
| color: null, | ||
| sortOrder: 0, | ||
| createdAt: 0 | ||
| } | ||
| } | ||
|
|
||
| // Hand-built titles: the sidebar row for a pane whose title is `title` and that has no hook row. | ||
| function titleRow(title: string, tabId = 'tab-1') { | ||
| const [row] = buildWorktreeAgentRows({ | ||
| tabs: [makeTab(tabId)], | ||
| entries: [], | ||
| retained: [], | ||
| runtimePaneTitlesByTabId: { [tabId]: { 1: title } }, | ||
| ptyIdsByTabId: { [tabId]: [`pty-${tabId}`] }, | ||
| terminalLayoutsByTabId: { | ||
| [tabId]: { | ||
| root: { type: 'leaf', leafId: LEAF_ID }, | ||
| activeLeafId: LEAF_ID, | ||
| expandedLeafId: null | ||
| } | ||
| }, | ||
| now: 2000 | ||
| }) | ||
| expect(row).toBeDefined() | ||
| return row | ||
| } | ||
|
|
||
| describe('a sidebar row whose title only names the agent', () => { | ||
| it('reads "No status reported" beside a muted dashed ring, not Idle', () => { | ||
| const markup = renderToStaticMarkup( | ||
| createElement( | ||
| TooltipProvider, | ||
| null, | ||
| createElement(CompactAgentRow, { agent: titleRow('agy'), now: 2000, onActivate: vi.fn() }) | ||
| ) | ||
| ) | ||
|
|
||
| expect(markup).toContain('No status reported') | ||
| expect(markup).toContain('aria-label="No status reported"') | ||
| expect(markup).toContain('lucide-circle-dashed') | ||
| expect(markup).toContain('text-muted-foreground') | ||
| expect(markup).not.toContain('text-amber-500') | ||
| expect(markup).not.toContain('>Idle<') | ||
| }) | ||
|
|
||
| it('names the state with the same phrase in the worktree summary, ranked just above idle', () => { | ||
| const unreported = titleRow('grok', 'tab-1') | ||
| const idle = titleRow('agy ready', 'tab-2') | ||
|
|
||
| expect(summarizeAgents([idle, unreported], 'Agents')).toBe( | ||
| 'Agents: 1 no status reported, 1 idle' | ||
| ) | ||
| }) | ||
|
|
||
| it('publishes idle to the dashboard card, whose validator drops unknown states', () => { | ||
| const unreported = dashboardRowBucketProjection(titleRow('aider')) | ||
| const idle = dashboardRowBucketProjection(titleRow('aider ready')) | ||
|
|
||
| expect(unreported.dotState).toBe('idle') | ||
| expect(unreported).toEqual(idle) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!