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
Binary file added screens/status-dot-tooltip-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/components/StatusDot.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { renderToString } from 'solid-js/web';
import { describe, expect, it } from 'vitest';

import { StatusDot, getDotTooltip } from './StatusDot';

describe('getDotTooltip', () => {
it('describes review status', () => {
expect(getDotTooltip('review')).toBe('Ready for review');
});

it('describes busy status', () => {
expect(getDotTooltip('busy')).toBe('Busy — agent recently active');
});

it('uses attention state before dot status', () => {
expect(getDotTooltip('ready', 'needs_input')).toBe('Waiting for input');
});
});

describe('StatusDot', () => {
it('attaches the tooltip to the dot element', () => {
const html = renderToString(() => StatusDot({ status: 'review' }));

expect(html).toContain('title="Ready for review"');
});
});
14 changes: 14 additions & 0 deletions src/components/StatusDot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ function getDotShadow(attention?: TaskAttentionState): string | undefined {
return `0 0 0 2px color-mix(in srgb, ${color} 22%, transparent)`;
}

export function getDotTooltip(status: TaskDotStatus, attention?: TaskAttentionState): string {
if (attention === 'active') return 'Active — agent is working';
if (attention === 'needs_input') return 'Waiting for input';
if (attention === 'error') return 'Error — agent exited with an error';
if (attention === 'ready') return 'Ready to merge';
return {
busy: 'Busy — agent recently active',
waiting: 'Waiting — no changes yet',
ready: 'Ready to merge',
review: 'Ready for review',
}[status];
}

export function StatusDot(props: {
status: TaskDotStatus;
size?: 'sm' | 'md';
Expand All @@ -34,6 +47,7 @@ export function StatusDot(props: {
return (
<span
class={isPulsing() ? 'status-dot-pulse' : undefined}
title={getDotTooltip(props.status, props.attention)}
style={{
display: 'inline-block',
width: `${px()}px`,
Expand Down
13 changes: 13 additions & 0 deletions src/store/taskStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,19 @@ describe('task attention state', () => {
expect(taskNeedsAttention('task-1')).toBe(true);
});

it('shows review before busy when the latest step is awaiting review', () => {
setMockTask('task-1', {
agentIds: ['agent-1'],
stepsContent: [{ id: 'step-1', status: 'awaiting_review' }],
});
setMockAgent('agent-1', { status: 'running' });

markAgentSpawned('agent-1');

expect(getTaskAttentionState('task-1')).toBe('active');
expect(getTaskDotStatus('task-1')).toBe('review');
});

it('returns error when a task agent exits non-zero', () => {
setMockTask('task-1', { agentIds: ['agent-1'] });
setMockAgent('agent-1', { status: 'exited', exitCode: 1, signal: null });
Expand Down
7 changes: 4 additions & 3 deletions src/store/taskStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,16 +839,17 @@ export function taskNeedsAttention(taskId: string): boolean {
export function getTaskDotStatus(taskId: string): TaskDotStatus {
const task = store.tasks[taskId];
if (!task) return 'waiting';
const active = activeAgents(); // reactive read
const hasActive = hasRunningTaskActivity(taskId, (id) => active.has(id));
if (hasActive) return 'busy';

const steps = task.stepsContent;
if (steps && steps.length > 0) {
const latest = steps[steps.length - 1];
if (latest.status === 'awaiting_review') return 'review';
}

const active = activeAgents(); // reactive read
const hasActive = hasRunningTaskActivity(taskId, (id) => active.has(id));
if (hasActive) return 'busy';

if (task.gitIsolation === 'none') return 'waiting';
if (isTaskReady(taskId)) return 'ready';
return 'waiting';
Expand Down
3 changes: 3 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { defineConfig } from 'vitest/config';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
plugins: [solidPlugin({ ssr: true })],
test: {
environment: 'node',
include: ['src/**/*.test.ts', 'electron/**/*.test.ts'],
coverage: {
provider: 'v8',
Expand Down
Loading