Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,27 @@ describe('worktree card agent summary', () => {
expect(summarizeAgents([agent], 'Agent')).toBe('Agent monitoring')
})

it('keeps monitoring visible before a compact row prompt', () => {
it('keeps the prompt first on a monitoring compact row', () => {
const agent = monitoringAgent()
agent.entry.prompt = 'Run background checks'

const markup = renderCompactAgentRow({ agent, now: 2000, onActivate: vi.fn() })

expect(markup).toContain('title="Monitoring background tasks - Run background checks"')
expect(markup).toContain('title="Run background checks - Monitoring background tasks"')
expect(markup).toMatch(
/Monitoring background tasks<\/span><span[^>]*> - Run background checks<\/span>/
/Run background checks<\/span><span[^>]*> - Monitoring background tasks<\/span>/
)
// The trailing label is what truncates away, so the dot must still name the state.
expect(markup).toContain('aria-label="Monitoring background tasks"')
})

it('names the monitoring state once when the row has no prompt', () => {
const agent = monitoringAgent()

const markup = renderCompactAgentRow({ agent, now: 2000, onActivate: vi.fn() })

expect(markup).toContain('title="Monitoring background tasks"')
expect(markup).not.toContain(' - Monitoring background tasks')
})

it('hands the whole row to the send-target reason, and only then', () => {
Expand All @@ -84,7 +95,7 @@ describe('worktree card agent summary', () => {

expect(orderedTitles(eligible)).toEqual([
'Claude',
'Monitoring background tasks - Run background checks'
'Run background checks - Monitoring background tasks'
])
expect(eligible).toContain('data-slot="tooltip-trigger"')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ export const CompactAgentRow = React.memo(function CompactAgentRow({
const stableMessage =
turnHoldable && !currentMessage && held?.turn === turn ? held.message : undefined
const secondary = getCompactAgentSecondary(agent, now, stableMessage)
// 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}` : ''}`
// Why: the name must survive default-width truncation; the state dot already names monitoring.
const trailingText = primary === secondary ? '' : secondary
const rowTitle = `${primary}${trailingText ? ` - ${trailingText}` : ''}`
const model = agent.entry.model?.trim() ?? ''
const shortTime = getCompactAgentTime(agent, now)
const cacheTimer = usePromptCacheCountdownForPane(agent.paneKey, cacheTimerActive)
Expand Down Expand Up @@ -234,7 +232,7 @@ 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'}>
{leadingText}
{primary}
</span>
{trailingText && (
<span className={isFocusedPane ? 'text-foreground/70' : 'text-muted-foreground/65'}>
Expand Down