From a29fe7b32fcab064952f44fd428bc74bd928eefb Mon Sep 17 00:00:00 2001 From: HeavyGee <133152184+heavygee@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:58:25 +0000 Subject: [PATCH] feat(web): fade non-resident session rows alongside the presence badge (#2362) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 832c5922f moved liveness onto the agent icon and dropped the row fade; #2296 then gave every state its own mark, so stopped is no longer shown by an absence. That fixes identity. It doesn't fix scale. The badge answers "what state is this row in?" once you look at it. It can't answer "which of these sessions is still held in memory?" across a long list, because that's a whole-list scan and a 10px mark doesn't survive one. At a handful of sessions the badge covers both jobs. At ~30 active, a stopped row and a resident idle row are the same shape of row until you inspect each badge. So restore the fade on `!active` — the same predicate the stopped badge uses, rendered at the other scale. Shape carries which state; dimming carries which rows. The fade covers the title line only. The presence badge and the attached-job meter sit outside it deliberately: a job outliving its agent is exactly the case where the row is non-resident but the work is live, and both facts have to stay readable at once. #2296 already marks that session's badge as working; this keeps the row dim underneath it. via [HAPI](https://hapi.run) Co-authored-by: HAPI --- web/src/components/SessionRowSummary.test.tsx | 34 +++++++++++++++++-- web/src/components/SessionRowSummary.tsx | 16 ++++++--- 2 files changed, 43 insertions(+), 7 deletions(-) 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. */} +