fix(sidebar): keep monitoring status visible

(cherry picked from commit fd6b38654d)
This commit is contained in:
Neil
2026-08-23 18:52:11 -07:00
committed by Brennan Benson
parent 151cb5ee3b
commit 04f663e13e
2 changed files with 27 additions and 6 deletions
@@ -1,6 +1,8 @@
import { describe, expect, it } from 'vitest'
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import type { DashboardAgentRow as DashboardAgentRowData } from '@/components/dashboard/useDashboardData'
import { getCompactAgentSecondary } from './worktree-card-compact-agent-row'
import { CompactAgentRow, getCompactAgentSecondary } from './worktree-card-compact-agent-row'
import { getAgentDotState, summarizeAgents } from './worktree-card-agent-summary'
function monitoringAgent(): DashboardAgentRowData {
@@ -39,4 +41,18 @@ describe('worktree card agent summary', () => {
expect(getCompactAgentSecondary(agent)).toBe('Monitoring background tasks')
expect(summarizeAgents([agent], 'Agent')).toBe('Agent monitoring')
})
it('keeps monitoring visible before a compact row prompt', () => {
const agent = monitoringAgent()
agent.entry.prompt = 'Run background checks'
const markup = renderToStaticMarkup(
createElement(CompactAgentRow, { agent, now: 2000, onActivate: vi.fn() })
)
expect(markup).toContain('title="Monitoring background tasks - Run background checks"')
expect(markup).toMatch(
/Monitoring background tasks<\/span><span[^>]*> - Run background checks<\/span>/
)
})
})
@@ -123,6 +123,11 @@ export const CompactAgentRow = React.memo(function CompactAgentRow({
const primary = getCompactAgentPrimary(agent, conversationName)
const isLineageChild = agent.lineage?.depth === 1
const secondary = getCompactAgentSecondary(agent)
// Why: sidebar truncation must preserve the passive-vs-active distinction.
const leadingText = dotState === 'monitoring' ? secondary : primary
const trailingText =
dotState === 'monitoring' ? (primary === secondary ? '' : primary) : secondary
const rowTitle = `${leadingText}${trailingText ? ` - ${trailingText}` : ''}`
const model = agent.entry.model?.trim() ?? ''
const shortTime = getCompactAgentTime(agent, now)
const cacheTimer = usePromptCacheCountdownForPane(agent.paneKey, cacheTimerActive)
@@ -205,12 +210,12 @@ export const CompactAgentRow = React.memo(function CompactAgentRow({
{/* Why: the selected-row fill is strong enough to wash out the dimmed
prompt/secondary text, so lift both toward full foreground when focused. */}
<span className={isFocusedPane ? 'text-foreground' : 'text-muted-foreground/90'}>
{primary}
{leadingText}
</span>
{secondary && (
{trailingText && (
<span className={isFocusedPane ? 'text-foreground/70' : 'text-muted-foreground/65'}>
{' '}
- {secondary}
- {trailingText}
</span>
)}
</span>
@@ -273,7 +278,7 @@ export const CompactAgentRow = React.memo(function CompactAgentRow({
role={agent.lineage ? 'treeitem' : undefined}
aria-level={agent.lineage ? agent.lineage.depth + 1 : undefined}
aria-expanded={hasChildDisclosure ? childAgentsExpanded : undefined}
title={sendTargetDisabledReason ?? `${primary}${secondary ? ` - ${secondary}` : ''}`}
title={sendTargetDisabledReason ?? rowTitle}
>
{rowBody}
</div>