diff --git a/web/src/components/SessionRowSummary.test.tsx b/web/src/components/SessionRowSummary.test.tsx index 87567b9c..5dd09f0a 100644 --- a/web/src/components/SessionRowSummary.test.tsx +++ b/web/src/components/SessionRowSummary.test.tsx @@ -81,17 +81,31 @@ describe('SessionRowSummary background status', () => { expect(idleBadge).not.toHaveClass('bg-[var(--app-badge-success-text)]') }) - it('does not dim disconnected rows and gives them a stopped badge instead of nothing', () => { + it('dims disconnected rows and gives them a stopped badge instead of nothing', () => { const { container } = render( ) - expect(container.querySelector('.opacity-50')).toBeNull() + // Two scales of the same fact: the badge names the state on inspection, + // the row fade makes it legible while scanning a long list. + const faded = container.querySelector('.opacity-50') + expect(faded).not.toBeNull() const badge = container.querySelector('[data-testid="session-presence"]') expect(badge).toHaveAttribute('data-presence', 'stopped') expect(badge).not.toHaveClass('animate-pulse') expect(badge?.querySelector('svg')).not.toBeNull() + // The mark must not be dimmed along with the title line. + expect(faded!.contains(badge)).toBe(false) + }) + + it('keeps resident rows at full strength', () => { + const { container } = render( + + + + ) + expect(container.querySelector('.opacity-50')).toBeNull() }) it('shows a detailed background tooltip on the agent icon in Extended mode', () => { @@ -271,7 +285,7 @@ describe('SessionRowSummary attached job progress', () => { vi.useRealTimers() }) - it('keeps a pulsing working badge for a running attached job after the agent stops', () => { + it('fades the row but keeps a pulsing working badge and job meter after the agent stops', () => { const { container } = render( { key: 'import', label: 'beets import', status: 'running', + remaining: 3_600, + total: 172_800, + unit: 's', heartbeatAt: 1_000_000, startedAt: 1_000_000 - 60_000, updatedAt: 1_000_000, @@ -292,9 +309,20 @@ describe('SessionRowSummary attached job progress', () => { ) + // A job outliving its agent is the case where the two signals must say + // different things at once: nothing holds this session in memory, and + // the work is still running. const badge = container.querySelector('[data-testid="session-presence"]') expect(badge).toHaveAttribute('data-presence', 'working') expect(badge).toHaveClass('animate-pulse') + + const faded = container.querySelector('.opacity-50') + expect(faded).not.toBeNull() + // The job's own affordances stay outside the faded subtree. + const jobLabel = screen.getByText('beets import') + expect(faded!.contains(jobLabel)).toBe(false) + expect(screen.getByTestId('attached-job-progress-bar')).toBeInTheDocument() + expect(faded!.contains(badge)).toBe(false) }) it('renders a subtle indeterminate striped bar (no %) when fraction is unknown', () => { diff --git a/web/src/components/SessionRowSummary.tsx b/web/src/components/SessionRowSummary.tsx index 55c80100..2219c7f1 100644 --- a/web/src/components/SessionRowSummary.tsx +++ b/web/src/components/SessionRowSummary.tsx @@ -85,9 +85,9 @@ const PRESENCE_BADGE_CLASS = { * Presentational session row — same chrome as the sidebar SessionItem body * (flavor icon with presence badge, title, request/schedule symbols, todos, * relative time, path, optional attached-job meter). Visual language matches - * the native apps: no dimmed rows or spinners; unread sessions have a - * separate accent dot. Used by the session list and by rich-composer - * mention chip tooltips. + * the native apps: no row spinners, and unread sessions have a separate accent + * dot. The title line dims when the session is not resident. Used by the + * session list and by rich-composer mention chip tooltips. */ export function SessionRowSummary(props: { session: SessionSummary @@ -184,6 +184,9 @@ export function SessionRowSummary(props: { // connected and waiting, power mark = stopped or archived. Blue is the // existing background-work state. An outliving attached job counts as // working even when the agent itself is idle or disconnected. + // The badge carries *which* state on inspection; the row-level residency + // fade below carries *which rows* at a glance. Same predicate (!active), + // two scales — a 10px mark doesn't survive a long-list scan on its own. const isRunning = s.active && s.thinking const isBackgroundOnly = s.active && !s.thinking && (s.backgroundTaskCount ?? 0) > 0 const presence: 'working' | 'background' | 'waiting' | 'stopped' = isBackgroundOnly @@ -227,7 +230,12 @@ export function SessionRowSummary(props: { /> ) : agentIcon}
-
+ {/* Residency fade: a non-resident session reads as a dimmer row, so + "who is still in memory" survives a whole-list scan. It covers the + title line only — the presence badge and the attached-job meter sit + outside it and stay at full strength, because a job outliving its + agent is exactly the case where the row is dim but the work is live. */} +