Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): distinguish queued agent runs from running in background banner (#985)

Call White33fc7015b35c
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 2c5d70895..d6b5c1235 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -21,6 +21,7 @@ import {
activityItemKind,
activityKindI18nKey,
harnessNavPath,
+ isQueuedRun,
resolveActivityLabel,
sortBackgroundActivities,
} from '../../lib/backgroundActivity';
@@ -2054,6 +2055,9 @@ const ActivityRow: React.FC<{
const label = resolveActivityLabel(item, kindLabel);
const relative = formatRelativeTime(item.since ?? item.started_at, t);
const isHarness = kind !== 'backend_activity';
+ // A queued delegated run is waiting, not executing — mute its icon box so it
+ // cannot read as in-progress (its kind label already says "Queued message").
+ const queued = isQueuedRun(item);
const subtitle =
kind === 'backend_activity' && item.backend ? `${item.backend} · ${relative}` : relative;
const body = (
@@ -2061,7 +2065,7 @@ const ActivityRow: React.FC<{
<span
className={clsx(
'flex size-8 shrink-0 items-center justify-center rounded-lg',
- ACTIVITY_ITEM_TINT[kind],
+ queued ? 'bg-surface-2 text-muted' : ACTIVITY_ITEM_TINT[kind],
)}
>
<Icon className="size-4" aria-hidden="true" />
@@ -2122,6 +2126,12 @@ const ActivityStrip: React.FC<{
const firstLabel = first
? resolveActivityLabel(first, t(`chat.activities.kind.${activityKindI18nKey(first)}`))
: '';
+ // Mute the pill only when the banner consists SOLELY of queued delegated
+ // runs — a waiting message must not glow like live work. Any running item,
+ // watch, or task in the union keeps today's active treatment (pending items
+ // tie on rank and order by time, so checking only the headline row would
+ // mute a banner that still contains an enabled watch or scheduled task).
+ const queuedOnly = active.length > 0 && active.every(isQueuedRun);
const expandable = active.length > 0;
const navigateTo = (path: string) => {
setOpen(false);
@@ -2130,16 +2140,20 @@ const ActivityStrip: React.FC<{
const pill = (
<StatusPill
- tone="running"
+ tone={queuedOnly ? 'idle' : 'running'}
role="status"
aria-live="polite"
className={clsx(
- 'min-h-7 min-w-0 max-w-full gap-2 px-3 py-1 text-[11px] font-normal shadow-sm shadow-mint/5',
+ 'min-h-7 min-w-0 max-w-full gap-2 px-3 py-1 text-[11px] font-normal',
+ !queuedOnly && 'shadow-sm shadow-mint/5',
expandable && 'cursor-pointer select-none',
)}
indicator={
active.length > 0 ? (
- <Activity className="size-3.5 shrink-0 text-mint" aria-hidden="true" />
+ <Activity
+ className={clsx('size-3.5 shrink-0', queuedOnly ? 'text-muted' : 'text-mint')}
+ aria-hidden="true"
+ />
) : (
<Loader2 className="size-3.5 shrink-0 animate-spin text-mint" aria-hidden="true" />
)
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 4299e1213..ba3c23d3c 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -2739,7 +2739,8 @@
"task": "Task",
"taskOneShot": "One-time",
"taskRecurring": "Recurring",
- "agentRun": "Agent run"
+ "agentRun": "Agent run",
+ "agentRunQueued": "Queued message"
}
},
"agentActivity": {
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 11188ecb3..dad4a36da 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -2739,7 +2739,8 @@
"task": "任务",
"taskOneShot": "一次性",
"taskRecurring": "周期性",
- "agentRun": "Agent 运行"
+ "agentRun": "Agent 运行",
+ "agentRunQueued": "排队消息"
}
},
"agentActivity": {
diff --git a/ui/src/lib/backgroundActivity.test.ts b/ui/src/lib/backgroundActivity.test.ts
index 07a61710e..1fe2eb8e1 100644
--- a/ui/src/lib/backgroundActivity.test.ts
+++ b/ui/src/lib/backgroundActivity.test.ts
@@ -7,6 +7,7 @@ import {
harnessItemNativeId,
harnessNavPath,
isHarnessActivity,
+ isQueuedRun,
resolveActivityLabel,
sortBackgroundActivities,
} from './backgroundActivity';
@@ -46,17 +47,55 @@ describe('activityItemKind', () => {
describe('activityKindI18nKey', () => {
it('classifies one-shot and recurring tasks from schedule_type', () => {
- expect(activityKindI18nKey({ item_kind: 'task', schedule_type: 'at' })).toBe('taskOneShot');
- expect(activityKindI18nKey({ item_kind: 'task', schedule_type: 'cron' })).toBe(
+ expect(activityKindI18nKey(item({ item_kind: 'task', schedule_type: 'at' }))).toBe(
+ 'taskOneShot',
+ );
+ expect(activityKindI18nKey(item({ item_kind: 'task', schedule_type: 'cron' }))).toBe(
'taskRecurring',
);
});
it('does not infer recurrence from labels or other activity kinds', () => {
- expect(activityKindI18nKey({ item_kind: 'task', schedule_type: null })).toBe('task');
- expect(activityKindI18nKey({ item_kind: 'watch' })).toBe('watch');
- expect(activityKindI18nKey({ item_kind: 'agent_run' })).toBe('agentRun');
- expect(activityKindI18nKey({ item_kind: 'backend_activity' })).toBe('backendActivity');
+ expect(activityKindI18nKey(item({ item_kind: 'task', schedule_type: null }))).toBe('task');
+ expect(activityKindI18nKey(item({ item_kind: 'watch', status: 'enabled' }))).toBe('watch');
+ expect(activityKindI18nKey(item({ item_kind: 'agent_run' }))).toBe('agentRun');
+ expect(activityKindI18nKey(item({ item_kind: 'backend_activity' }))).toBe('backendActivity');
+ });
+
+ it('maps a queued delegated run to its own key, not "agentRun"', () => {
+ expect(activityKindI18nKey(item({ item_kind: 'agent_run', status: 'queued' }))).toBe(
+ 'agentRunQueued',
+ );
+ // The raw/legacy alias the durable store may still carry (normalized to
+ // public "queued" by storage/background.RUN_STATUS_ALIASES).
+ expect(activityKindI18nKey(item({ item_kind: 'agent_run', status: 'pending' }))).toBe(
+ 'agentRunQueued',
+ );
+ // Executing forms keep the plain kind key.
+ expect(activityKindI18nKey(item({ item_kind: 'agent_run', status: 'running' }))).toBe(
+ 'agentRun',
+ );
+ expect(activityKindI18nKey(item({ item_kind: 'agent_run', status: 'processing' }))).toBe(
+ 'agentRun',
+ );
+ });
+
+ it('leaves non-run kinds untouched by a queued-looking status', () => {
+ expect(activityKindI18nKey(item({ item_kind: 'watch', status: 'queued' }))).toBe('watch');
+ expect(activityKindI18nKey(item({ item_kind: 'task', status: 'queued' }))).toBe('task');
+ expect(activityKindI18nKey(item({ status: 'queued' }))).toBe('backendActivity');
+ });
+});
+
+describe('isQueuedRun', () => {
+ it('is true only for a delegated run with a waiting status', () => {
+ expect(isQueuedRun(item({ item_kind: 'agent_run', status: 'queued' }))).toBe(true);
+ // Raw/legacy alias of "queued" (storage/background.RUN_STATUS_ALIASES).
+ expect(isQueuedRun(item({ item_kind: 'agent_run', status: 'pending' }))).toBe(true);
+ expect(isQueuedRun(item({ item_kind: 'agent_run', status: 'running' }))).toBe(false);
+ expect(isQueuedRun(item({ item_kind: 'agent_run', status: 'processing' }))).toBe(false);
+ expect(isQueuedRun(item({ item_kind: 'watch', status: 'queued' }))).toBe(false);
+ expect(isQueuedRun(item({ status: 'queued' }))).toBe(false);
});
});
diff --git a/ui/src/lib/backgroundActivity.ts b/ui/src/lib/backgroundActivity.ts
index 779c8905f..1a1571732 100644
--- a/ui/src/lib/backgroundActivity.ts
+++ b/ui/src/lib/backgroundActivity.ts
@@ -15,11 +15,28 @@ export function activityItemKind(
return kind && HARNESS_ITEM_KINDS.includes(kind) ? kind : 'backend_activity';
}
+// Waiting-run statuses. ``queued`` is the normalized public form; ``pending``
+// is the raw/legacy alias the durable store may still carry (see
+// storage/background.RUN_STATUS_ALIASES) — same parity rule as
+// RUNNING_STATUSES below, or an aliased row would keep the running treatment.
+const QUEUED_RUN_STATUSES = new Set(['queued', 'pending']);
+
+// A delegated run that is waiting behind the target session's active turn.
+// Only agent runs carry ``queued``/``pending``; watches/tasks have their own
+// pending statuses (``enabled`` / ``scheduled``) and keep their kind labels.
+export function isQueuedRun(
+ item: Pick<SessionActivityState, 'item_kind' | 'status'>,
+): boolean {
+ return activityItemKind(item) === 'agent_run' && QUEUED_RUN_STATUSES.has(item.status);
+}
+
// Task recurrence is an explicit durable field (`at` / `cron`). Keep this
// mapping independent of task names so display text can never misclassify a
-// user-authored label that happens to mention scheduling words.
+// user-authored label that happens to mention scheduling words. A queued
+// delegated run maps to its own key ("Queued message") — labeling it "Agent
+// run" reads as still-executing and misled users about unfinished work.
export function activityKindI18nKey(
- item: Pick<SessionActivityState, 'item_kind' | 'schedule_type'>,
+ item: Pick<SessionActivityState, 'item_kind' | 'schedule_type' | 'status'>,
): string {
const kind = activityItemKind(item);
if (kind === 'task') {
@@ -27,7 +44,7 @@ export function activityKindI18nKey(
if (item.schedule_type === 'cron') return 'taskRecurring';
}
if (kind === 'backend_activity') return 'backendActivity';
- if (kind === 'agent_run') return 'agentRun';
+ if (kind === 'agent_run') return isQueuedRun(item) ? 'agentRunQueued' : 'agentRun';
return kind;
}