diff --git a/.changeset/session-status-indicators.md b/.changeset/session-status-indicators.md
new file mode 100644
index 0000000000..4898d6d354
--- /dev/null
+++ b/.changeset/session-status-indicators.md
@@ -0,0 +1,5 @@
+---
+'@truefoundry/trueforge-ui': patch
+---
+
+Hide paused status dots after 48 hours of inactivity, and show failed runs with a circle-xmark icon in the agent session list only (no failure chrome in chat history). Session lists poll running and paused rows every 5 seconds, and a poll that sees a new pause also refreshes the activity time so the dot is not stuck hidden.
diff --git a/packages/trueforge-ui/package.json b/packages/trueforge-ui/package.json
index c7746efc71..d30d3830c2 100644
--- a/packages/trueforge-ui/package.json
+++ b/packages/trueforge-ui/package.json
@@ -101,7 +101,7 @@
"@truefoundry/trueforge-sdk": "workspace:*",
"chart.js": "^4.5.1",
"clsx": "^2.1.1",
- "lucide-react": "^0.562.0",
+ "lucide-react": "^1.73.0",
"monaco-editor": "^0.57.0",
"partial-json": "^0.1.7",
"react-chartjs-2": "^5.3.1",
diff --git a/packages/trueforge-ui/src/atoms/ThreadListRow.tsx b/packages/trueforge-ui/src/atoms/ThreadListRow.tsx
index ec9efcab95..6c75a179e1 100644
--- a/packages/trueforge-ui/src/atoms/ThreadListRow.tsx
+++ b/packages/trueforge-ui/src/atoms/ThreadListRow.tsx
@@ -85,12 +85,16 @@ export function ThreadListRow({
className,
}: ThreadListRowProps) {
const isMobile = useIsMobile();
- const statusDotClass = lastTurnStatusDotClass(lastTurnStatus);
- const statusLabel = lastTurnStatusLabel(lastTurnStatus);
+ const statusDotClass = lastTurnStatusDotClass({
+ status: lastTurnStatus,
+ ...(lastMessageAt != null ? { activityAt: lastMessageAt } : {}),
+ });
const running = isRunningTurnStatus(lastTurnStatus);
const paused = isPausedTurnStatus(lastTurnStatus);
+ // Chat history keeps paused chrome; failed runs are session-list only.
+ const statusLabel = running || statusDotClass != null ? lastTurnStatusLabel(lastTurnStatus) : undefined;
const age = lastMessageAt != null ? formatRelativeShort(lastMessageAt) : undefined;
- // Paused/error → status dot; running → jumping dots; otherwise relative age.
+ // Paused → status dot; running → jumping dots; otherwise relative age.
const relative = !running && statusDotClass == null ? age : undefined;
const hasTrailing = running || relative != null || statusDotClass != null || actions != null;
@@ -124,7 +128,7 @@ export function ThreadListRow({
{title}
- {/* Mobile: keep the paused/error dot next to the title when actions own the trailing slot. */}
+ {/* Mobile: keep the paused dot next to the title when actions own the trailing slot. */}
{statusDotClass != null && actions != null ? (
diff --git a/packages/trueforge-ui/src/atoms/agent-details/AgentSessionListRow.tsx b/packages/trueforge-ui/src/atoms/agent-details/AgentSessionListRow.tsx
index 0977a9af40..c7c35da6d9 100644
--- a/packages/trueforge-ui/src/atoms/agent-details/AgentSessionListRow.tsx
+++ b/packages/trueforge-ui/src/atoms/agent-details/AgentSessionListRow.tsx
@@ -56,7 +56,8 @@ export function AgentSessionListRow({
const absolute = formatAbsoluteDateTime(activityAt);
const subjectLabel = createdBySubject != null ? createdByLabel(createdBySubject) : null;
const subjectInitials = subjectLabel != null ? getUserInitials(subjectLabel) || '?' : null;
- const statusDotClass = lastTurnStatusDotClass(lastTurnStatus);
+ const statusDotClass = lastTurnStatusDotClass({ status: lastTurnStatus, activityAt });
+ const failed = lastTurnStatus === 'error';
const statusLabel = lastTurnStatusLabel(lastTurnStatus);
const running = isRunningTurnStatus(lastTurnStatus);
const paused = isPausedTurnStatus(lastTurnStatus);
@@ -78,6 +79,10 @@ export function AgentSessionListRow({
+ ) : failed ? (
+
+
+
) : null}
{statusLabel != null ? {statusLabel} : null}
{scheduleId != null ? (
diff --git a/packages/trueforge-ui/src/atoms/agent-details/AgentSessions.tsx b/packages/trueforge-ui/src/atoms/agent-details/AgentSessions.tsx
index e3de65fe93..73ff771a56 100644
--- a/packages/trueforge-ui/src/atoms/agent-details/AgentSessions.tsx
+++ b/packages/trueforge-ui/src/atoms/agent-details/AgentSessions.tsx
@@ -25,6 +25,7 @@ import { EmptyScreen } from '../EmptyScreen.js';
import { cn } from '../lib/cn.js';
import { sessionIsCreateAgent } from '../lib/sessionCreateAgent.js';
import {
+ mergePolledSessionRow,
mergeSessionListFirstPage,
SESSION_LIST_FIRST_PAGE_LIMIT,
sessionListPollIntervalMs,
@@ -178,14 +179,7 @@ export function AgentSessions({
mergeSessionListFirstPage({
current,
firstPage: page.data,
- mergeItem: (prev, next) => {
- const prevDetails = prev.lastTurnDetails;
- const nextDetails = next.lastTurnDetails;
- if (prevDetails?.id === nextDetails?.id && prevDetails?.state.status === nextDetails?.state.status) {
- return prev;
- }
- return { ...prev, lastTurnDetails: nextDetails };
- },
+ mergeItem: mergePolledSessionRow,
}),
);
} catch {
diff --git a/packages/trueforge-ui/src/atoms/lib/sessionListPoll.ts b/packages/trueforge-ui/src/atoms/lib/sessionListPoll.ts
index 5347724322..c7f3053653 100644
--- a/packages/trueforge-ui/src/atoms/lib/sessionListPoll.ts
+++ b/packages/trueforge-ui/src/atoms/lib/sessionListPoll.ts
@@ -3,23 +3,34 @@ import type { TurnStatus } from '../../server/types.js';
/** Matches thread-list / AgentSessions first-page `limit`. */
export const SESSION_LIST_FIRST_PAGE_LIMIT = 20;
-/** Cadence while any listed row is still running. */
-export const SESSION_LIST_RUNNING_POLL_INTERVAL_MS = 10_000;
+/** Cadence while any listed row is running or paused. */
+export const SESSION_LIST_POLL_INTERVAL_MS = 5_000;
-/** Slower cadence when listed rows are only paused (approvals can wait a long time). */
-export const SESSION_LIST_PAUSED_POLL_INTERVAL_MS = 60_000;
-
-/**
- * Poll interval for live last-turn status, or `null` when nothing needs polling.
- * Running wins over paused so a mixed page stays on the fast cadence.
- */
+/** Poll interval for live last-turn status, or `null` when nothing needs polling. */
export function sessionListPollIntervalMs(statuses: ReadonlyArray): number | null {
- let hasPaused = false;
for (const status of statuses) {
- if (status === 'running') return SESSION_LIST_RUNNING_POLL_INTERVAL_MS;
- if (status === 'paused') hasPaused = true;
+ if (status === 'running' || status === 'paused') return SESSION_LIST_POLL_INTERVAL_MS;
}
- return hasPaused ? SESSION_LIST_PAUSED_POLL_INTERVAL_MS : null;
+ return null;
+}
+
+type PolledTurn = { id: string; state: { status: string } };
+
+/**
+ * Apply a first-page poll onto one row.
+ * Status-only patches used to leave `lastActivityAt` at the original payload, so a
+ * new pause on a row older than 48 hours stayed hidden.
+ */
+export function mergePolledSessionRow(
+ prev: T,
+ next: T,
+): T {
+ const prevDetails = prev.lastTurnDetails;
+ const nextDetails = next.lastTurnDetails;
+ const sameTurn = prevDetails?.id === nextDetails?.id && prevDetails?.state.status === nextDetails?.state.status;
+ if (sameTurn && prev.lastActivityAt === next.lastActivityAt) return prev;
+ if (sameTurn) return { ...prev, lastActivityAt: next.lastActivityAt };
+ return { ...prev, lastActivityAt: next.lastActivityAt, lastTurnDetails: nextDetails };
}
/**
diff --git a/packages/trueforge-ui/src/atoms/lib/threadListMeta.ts b/packages/trueforge-ui/src/atoms/lib/threadListMeta.ts
index 29c7ab5739..1c96224ff7 100644
--- a/packages/trueforge-ui/src/atoms/lib/threadListMeta.ts
+++ b/packages/trueforge-ui/src/atoms/lib/threadListMeta.ts
@@ -9,13 +9,34 @@ function isTurnStatus(value: unknown): value is TurnStatus {
return typeof value === 'string' && TURN_STATUS_VALUES.has(value);
}
+/** Orange paused dots older than this are hidden (AGE-2831). */
+export const PAUSED_STATUS_DOT_MAX_AGE_MS = 48 * 60 * 60 * 1000;
+
+function isValidActivityDate(date: Date): boolean {
+ return !Number.isNaN(date.getTime());
+}
+
/** Tailwind bg class for a last-turn status dot; undefined means hide the dot. */
-export function lastTurnStatusDotClass(status: TurnStatus | undefined | null): string | undefined {
+export function lastTurnStatusDotClass({
+ status,
+ activityAt,
+ now = new Date(),
+}: {
+ status: TurnStatus | undefined | null;
+ activityAt?: Date | null;
+ now?: Date;
+}): string | undefined {
switch (status) {
- case 'paused':
+ case 'paused': {
+ if (
+ activityAt != null &&
+ isValidActivityDate(activityAt) &&
+ now.getTime() - activityAt.getTime() > PAUSED_STATUS_DOT_MAX_AGE_MS
+ ) {
+ return undefined;
+ }
return 'bg-warning-bg';
- case 'error':
- return 'bg-failure-bg';
+ }
default:
return undefined;
}
@@ -101,6 +122,32 @@ export function readThreadIsMutable(custom: unknown): boolean | undefined {
return typeof value === 'boolean' ? value : undefined;
}
+/** Activity time stamped by the status poll. Newer than `lastMessageAt` after a fresh pause. */
+export function readThreadLastActivityAt(custom: unknown): Date | undefined {
+ if (custom == null || typeof custom !== 'object') return undefined;
+ if (!('lastActivityAt' in custom)) return undefined;
+ const value = Reflect.get(custom, 'lastActivityAt');
+ if (typeof value !== 'string') return undefined;
+ const date = new Date(value);
+ return Number.isNaN(date.getTime()) ? undefined : date;
+}
+
+/** True when `nextIso` is a valid time strictly after `prev`. Missing `prev` counts as newer. */
+export function isNewerActivityAt(nextIso: string, prev: Date | undefined): boolean {
+ const next = new Date(nextIso);
+ if (Number.isNaN(next.getTime())) return false;
+ if (prev == null || Number.isNaN(prev.getTime())) return true;
+ return next.getTime() > prev.getTime();
+}
+
+/** Later of the list payload time and a poll stamp. */
+export function laterActivityAt(left: Date | undefined, right: Date | undefined): Date | undefined {
+ if (left == null || Number.isNaN(left.getTime()))
+ return right != null && !Number.isNaN(right.getTime()) ? right : undefined;
+ if (right == null || Number.isNaN(right.getTime())) return left;
+ return right.getTime() > left.getTime() ? right : left;
+}
+
/** Last-turn status stamped on thread-list custom by `sessionToThreadMetadata`. */
export function readThreadLastTurnStatus(custom: unknown): TurnStatus | undefined {
if (custom == null || typeof custom !== 'object') return undefined;
@@ -113,6 +160,7 @@ export function readThreadLastTurnStatus(custom: unknown): TurnStatus | undefine
export function threadCustomWithLastTurnStatus(
custom: unknown,
status: TurnStatus | null | undefined,
+ activityAt?: string,
): Record {
const base =
custom != null && typeof custom === 'object' && !Array.isArray(custom)
@@ -122,6 +170,9 @@ export function threadCustomWithLastTurnStatus(
if (status != null) {
base.lastTurnStatus = status;
}
+ if (activityAt != null) {
+ base.lastActivityAt = activityAt;
+ }
return base;
}
diff --git a/packages/trueforge-ui/src/containers/ThreadListContainer.tsx b/packages/trueforge-ui/src/containers/ThreadListContainer.tsx
index f213ba492a..657e821697 100644
--- a/packages/trueforge-ui/src/containers/ThreadListContainer.tsx
+++ b/packages/trueforge-ui/src/containers/ThreadListContainer.tsx
@@ -21,8 +21,11 @@ import { useCompactLayout } from '../atoms/lib/CompactLayoutContext.js';
import { SESSION_LIST_FIRST_PAGE_LIMIT, sessionListPollIntervalMs } from '../atoms/lib/sessionListPoll.js';
import {
canReuseMutableShell,
+ isNewerActivityAt,
+ laterActivityAt,
readThreadAgentName,
readThreadIsMutable,
+ readThreadLastActivityAt,
readThreadLastTurnStatus,
threadCustomWithLastTurnStatus,
threadListIndicesByRecency,
@@ -216,6 +219,7 @@ function ThreadListItemRow({
const mainThreadId = useAuiState(s => s.threads.mainThreadId);
const agentName = readThreadAgentName(custom);
const lastTurnStatus = readThreadLastTurnStatus(custom);
+ const activityAt = laterActivityAt(lastMessageAt, readThreadLastActivityAt(custom));
const showRename = canRenameSession && remoteId != null;
const showDelete = canDeleteSession && remoteId != null;
const showActions = showRename || showDelete;
@@ -290,7 +294,7 @@ function ThreadListItemRow({
active={id === mainThreadId && !sidebarNavOpen}
agentName={agentName}
{...(lastTurnStatus == null ? {} : { lastTurnStatus })}
- lastMessageAt={lastMessageAt}
+ {...(activityAt == null ? {} : { lastMessageAt: activityAt })}
onSelect={() => {
track(
AnalyticsEvents.Session.SELECTED,
@@ -572,7 +576,10 @@ export function ThreadListContainer({
});
const statusByRemoteId = new Map(
- page.data.map(session => [session.id, session.lastTurnDetails?.state.status] as const),
+ page.data.map(
+ session =>
+ [session.id, { status: session.lastTurnDetails?.state.status, updatedAt: session.updatedAt }] as const,
+ ),
);
const threadsState = auiRef.current.threads().getState();
const mainThreadId = threadsState.mainThreadId;
@@ -583,13 +590,15 @@ export function ThreadListContainer({
continue;
}
if (item.remoteId == null || !statusByRemoteId.has(item.remoteId)) continue;
- const nextStatus = statusByRemoteId.get(item.remoteId);
+ const polled = statusByRemoteId.get(item.remoteId);
+ if (polled == null) continue;
const prevStatus = readThreadLastTurnStatus(item.custom);
- if (nextStatus === prevStatus) continue;
+ const prevActivity = readThreadLastActivityAt(item.custom) ?? item.lastMessageAt;
+ if (polled.status === prevStatus && !isNewerActivityAt(polled.updatedAt, prevActivity)) continue;
void auiRef.current
.threads()
.item({ id: item.id })
- .updateCustom(threadCustomWithLastTurnStatus(item.custom, nextStatus ?? null));
+ .updateCustom(threadCustomWithLastTurnStatus(item.custom, polled.status ?? null, polled.updatedAt));
}
} catch {
// Keep showing the last known status on transient poll failures.
diff --git a/packages/trueforge-ui/src/hooks/useSyncThreadListLastTurnStatus.ts b/packages/trueforge-ui/src/hooks/useSyncThreadListLastTurnStatus.ts
index 156f9bc8ca..2d12c028c7 100644
--- a/packages/trueforge-ui/src/hooks/useSyncThreadListLastTurnStatus.ts
+++ b/packages/trueforge-ui/src/hooks/useSyncThreadListLastTurnStatus.ts
@@ -4,7 +4,12 @@ import { useThreadIsRunning } from '@assistant-ui/core/react';
import { useEffect, useRef } from 'react';
import { useAui, useAuiState } from '../assistant-ui.js';
-import { readThreadLastTurnStatus, threadCustomWithLastTurnStatus } from '../atoms/lib/threadListMeta.js';
+import {
+ isNewerActivityAt,
+ readThreadLastActivityAt,
+ readThreadLastTurnStatus,
+ threadCustomWithLastTurnStatus,
+} from '../atoms/lib/threadListMeta.js';
import { useOptionalServer } from '../server/ServerContext.js';
/**
@@ -18,15 +23,20 @@ export function useSyncThreadListLastTurnStatus(): void {
const server = useOptionalServer();
const aui = useAui();
const remoteId = useAuiState(s => s.threadListItem.remoteId);
+ const lastMessageAt = useAuiState(s => s.threadListItem.lastMessageAt);
const isRunning = useThreadIsRunning();
const wasRunningRef = useRef(false);
const prevRemoteIdRef = useRef(remoteId);
+ // Read inside the finished-turn effect. A dep would rerun it after isRunning
+ // flips false, cancel the in-flight getSession, and skip the paused/error stamp.
+ const lastMessageAtRef = useRef(lastMessageAt);
+ lastMessageAtRef.current = lastMessageAt;
useEffect(() => {
if (!isRunning || remoteId == null) return;
const custom = aui.threadListItem().getState().custom;
if (readThreadLastTurnStatus(custom) === 'running') return;
- void aui.threadListItem().updateCustom(threadCustomWithLastTurnStatus(custom, 'running'));
+ void aui.threadListItem().updateCustom(threadCustomWithLastTurnStatus(custom, 'running', new Date().toISOString()));
}, [aui, isRunning, remoteId]);
useEffect(() => {
@@ -56,8 +66,12 @@ export function useSyncThreadListLastTurnStatus(): void {
if (cancelled) return;
const nextStatus = session.lastTurnDetails?.state.status ?? null;
const latestCustom = aui.threadListItem().getState().custom;
- if (readThreadLastTurnStatus(latestCustom) === nextStatus) return;
- return aui.threadListItem().updateCustom(threadCustomWithLastTurnStatus(latestCustom, nextStatus));
+ const statusSame = (readThreadLastTurnStatus(latestCustom) ?? null) === nextStatus;
+ const prevActivity = readThreadLastActivityAt(latestCustom) ?? lastMessageAtRef.current;
+ if (statusSame && !isNewerActivityAt(session.updatedAt, prevActivity)) return;
+ return aui
+ .threadListItem()
+ .updateCustom(threadCustomWithLastTurnStatus(latestCustom, nextStatus, session.updatedAt));
})
.catch(() => undefined);
diff --git a/packages/trueforge-ui/src/icons/IconRegistry.tsx b/packages/trueforge-ui/src/icons/IconRegistry.tsx
index 13a5d4cd52..094644f46a 100644
--- a/packages/trueforge-ui/src/icons/IconRegistry.tsx
+++ b/packages/trueforge-ui/src/icons/IconRegistry.tsx
@@ -17,6 +17,7 @@ import {
ChevronsUpDown,
CircleAlert,
CircleCheck,
+ CircleExclamationPoint,
CircleX,
Clock,
Code2,
@@ -31,7 +32,6 @@ import {
FileCode2,
FileSpreadsheet,
FileText,
- Github,
GripVertical,
History,
Info,
@@ -110,6 +110,22 @@ function Broom({ size = 24, ...props }: SVGProps & { size?: strin
);
}
+/** GitHub mark — lucide-react 1.x dropped brand icons (incl. `Github`). */
+function GitHub({ size = 24, ...props }: SVGProps & { size?: string | number }) {
+ return (
+
+ );
+}
+
const registry = new Map();
export function registerIcon(name: string, icon: IconEntry): void {
@@ -157,6 +173,7 @@ const defaults: Record = {
'clock-rotate-left': History,
'circle-exclamation': CircleAlert,
info: Info,
+ 'circle-exclamation-point': CircleExclamationPoint,
'triangle-exclamation': TriangleAlert,
'chevron-down': ChevronDown,
'chevron-left': ChevronLeft,
@@ -221,7 +238,7 @@ const defaults: Record = {
compress: Minimize2,
'external-link': ExternalLink,
'square-arrow-out-up-right': SquareArrowOutUpRight,
- github: Github,
+ github: GitHub,
monitor: Monitor,
};
diff --git a/packages/trueforge-ui/test/atoms/AgentSessionListRow.test.tsx b/packages/trueforge-ui/test/atoms/AgentSessionListRow.test.tsx
index ec953963d2..a475901387 100644
--- a/packages/trueforge-ui/test/atoms/AgentSessionListRow.test.tsx
+++ b/packages/trueforge-ui/test/atoms/AgentSessionListRow.test.tsx
@@ -126,8 +126,10 @@ describe('AgentSessionListRow', () => {
expect(container.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
});
- it('shows a blinking paused status dot after the title', () => {
- const { container } = render();
+ it('shows a blinking paused status dot after the title when activity is recent', () => {
+ const { container } = render(
+ ,
+ );
const pausedDot = container.querySelector('[data-slot="session-status-dot"]');
expect(pausedDot?.querySelector('.bg-warning-bg')).toBeInTheDocument();
@@ -135,15 +137,24 @@ describe('AgentSessionListRow', () => {
expect(screen.getByText('Waiting for input', { selector: '.sr-only' })).toBeInTheDocument();
});
- it('shows a static failure status dot for error and hides cancelled', () => {
+ it('hides the paused status dot when activity is older than 48 hours', () => {
+ const { container } = render(
+ ,
+ );
+
+ expect(container.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
+ expect(screen.getByText('Waiting for input', { selector: '.sr-only' })).toBeInTheDocument();
+ });
+
+ it('shows a failure icon for error and hides cancelled', () => {
const { container: errorContainer } = render();
- const errorDot = errorContainer.querySelector('[data-slot="session-status-dot"]');
- expect(errorDot?.querySelector('.bg-failure-bg')).toBeInTheDocument();
- expect(errorDot?.querySelector('.motion-safe\\:animate-ping')).not.toBeInTheDocument();
+ expect(errorContainer.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
+ expect(errorContainer.querySelector('[data-slot="session-status-failed"]')).toBeInTheDocument();
expect(screen.getByText('Failed', { selector: '.sr-only' })).toBeInTheDocument();
const { container: cancelledContainer } = render();
expect(cancelledContainer.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
+ expect(cancelledContainer.querySelector('[data-slot="session-status-failed"]')).not.toBeInTheDocument();
});
it('hides the status dot when last turn is done', () => {
diff --git a/packages/trueforge-ui/test/atoms/ThreadListRow.test.tsx b/packages/trueforge-ui/test/atoms/ThreadListRow.test.tsx
index ea91a1616a..467ba19cbe 100644
--- a/packages/trueforge-ui/test/atoms/ThreadListRow.test.tsx
+++ b/packages/trueforge-ui/test/atoms/ThreadListRow.test.tsx
@@ -156,7 +156,7 @@ describe('ThreadListRow', () => {
expect(screen.getByRole('tooltip')).toHaveTextContent('18h');
});
- it('replaces the relative age with a paused status dot', () => {
+ it('replaces the relative age with a paused status dot when activity is recent', () => {
const lastMessageAt = new Date(Date.now() - 30 * 60_000);
const { container } = render(
@@ -177,7 +177,26 @@ describe('ThreadListRow', () => {
expect(screen.queryByText('30m')).not.toBeInTheDocument();
});
- it('replaces the relative age with a failure status dot for error', () => {
+ it('hides the paused status dot and shows relative age when activity is older than 48 hours', () => {
+ const lastMessageAt = new Date(Date.now() - 49 * 60 * 60_000);
+ const { container } = render(
+
+ {}}
+ lastTurnStatus="paused"
+ lastMessageAt={lastMessageAt}
+ />
+ ,
+ );
+
+ expect(container.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
+ expect(screen.queryByText('Waiting for input', { selector: '.sr-only' })).not.toBeInTheDocument();
+ expect(screen.getByText('2d')).toBeInTheDocument();
+ });
+
+ it('shows relative age for error with no failure chrome', () => {
const lastMessageAt = new Date(Date.now() - 30 * 60_000);
const { container } = render(
@@ -191,11 +210,9 @@ describe('ThreadListRow', () => {
,
);
- const errorDot = container.querySelector('[data-slot="session-status-dot"]');
- expect(errorDot?.querySelector('.bg-failure-bg')).toBeInTheDocument();
- expect(errorDot?.querySelector('.motion-safe\\:animate-ping')).not.toBeInTheDocument();
- expect(screen.getByText('Failed', { selector: '.sr-only' })).toBeInTheDocument();
- expect(screen.queryByText('30m')).not.toBeInTheDocument();
+ expect(container.querySelector('[data-slot="session-status-dot"]')).not.toBeInTheDocument();
+ expect(screen.queryByText('Failed', { selector: '.sr-only' })).not.toBeInTheDocument();
+ expect(screen.getByText('30m')).toBeInTheDocument();
});
it('shows a desktop hover tip with the full title and relative age', () => {
diff --git a/packages/trueforge-ui/test/atoms/lib/sessionListPoll.test.ts b/packages/trueforge-ui/test/atoms/lib/sessionListPoll.test.ts
index 9fdc2989e0..04a79e8908 100644
--- a/packages/trueforge-ui/test/atoms/lib/sessionListPoll.test.ts
+++ b/packages/trueforge-ui/test/atoms/lib/sessionListPoll.test.ts
@@ -1,20 +1,17 @@
import { describe, expect, it } from 'vitest';
import {
+ mergePolledSessionRow,
mergeSessionListFirstPage,
SESSION_LIST_FIRST_PAGE_LIMIT,
- SESSION_LIST_PAUSED_POLL_INTERVAL_MS,
- SESSION_LIST_RUNNING_POLL_INTERVAL_MS,
+ SESSION_LIST_POLL_INTERVAL_MS,
sessionListPollIntervalMs,
} from '@/atoms/lib/sessionListPoll.js';
describe('sessionListPollIntervalMs', () => {
- it('returns the running cadence when any status is running', () => {
- expect(sessionListPollIntervalMs(['paused', 'running', 'done'])).toBe(SESSION_LIST_RUNNING_POLL_INTERVAL_MS);
- });
-
- it('returns the paused cadence when statuses are only paused', () => {
- expect(sessionListPollIntervalMs(['paused', null, 'done'])).toBe(SESSION_LIST_PAUSED_POLL_INTERVAL_MS);
+ it('polls while any status is running or paused', () => {
+ expect(sessionListPollIntervalMs(['paused', 'running', 'done'])).toBe(SESSION_LIST_POLL_INTERVAL_MS);
+ expect(sessionListPollIntervalMs(['paused', null, 'done'])).toBe(SESSION_LIST_POLL_INTERVAL_MS);
});
it('returns null when nothing needs polling', () => {
@@ -23,6 +20,31 @@ describe('sessionListPollIntervalMs', () => {
});
});
+describe('mergePolledSessionRow', () => {
+ const paused = { id: 'turn-1', state: { status: 'paused' } };
+
+ it('keeps the row when the turn and activity time are unchanged', () => {
+ const prev = { id: 'a', lastActivityAt: '2026-11-01T00:00:00.000Z', lastTurnDetails: paused };
+ expect(mergePolledSessionRow(prev, { ...prev })).toBe(prev);
+ });
+
+ it('refreshes activity time when a paused turn is touched again', () => {
+ const prev = { id: 'a', lastActivityAt: '2026-11-01T00:00:00.000Z', lastTurnDetails: paused };
+ const next = { ...prev, lastActivityAt: '2026-11-16T00:00:00.000Z' };
+ expect(mergePolledSessionRow(prev, next)).toEqual(next);
+ });
+
+ it('copies status and activity time together', () => {
+ const prev = {
+ id: 'a',
+ lastActivityAt: '2026-11-01T00:00:00.000Z',
+ lastTurnDetails: { id: 'turn-1', state: { status: 'running' } },
+ };
+ const next = { ...prev, lastActivityAt: '2026-11-16T00:00:00.000Z', lastTurnDetails: paused };
+ expect(mergePolledSessionRow(prev, next)).toEqual(next);
+ });
+});
+
describe('mergeSessionListFirstPage', () => {
it('patches matching ids and leaves later pages untouched', () => {
const current = [
diff --git a/packages/trueforge-ui/test/atoms/lib/threadListMeta.test.ts b/packages/trueforge-ui/test/atoms/lib/threadListMeta.test.ts
index c08e64fa41..729bcf9ffe 100644
--- a/packages/trueforge-ui/test/atoms/lib/threadListMeta.test.ts
+++ b/packages/trueforge-ui/test/atoms/lib/threadListMeta.test.ts
@@ -3,11 +3,15 @@ import { describe, expect, it } from 'vitest';
import {
canReuseMutableShell,
formatRelativeShort,
+ isNewerActivityAt,
isRunningTurnStatus,
lastTurnStatusDotClass,
lastTurnStatusLabel,
+ laterActivityAt,
+ PAUSED_STATUS_DOT_MAX_AGE_MS,
readThreadAgentName,
readThreadIsMutable,
+ readThreadLastActivityAt,
readThreadLastTurnStatus,
threadCustomWithLastTurnStatus,
threadListIndicesByRecency,
@@ -43,13 +47,30 @@ describe('readThreadLastTurnStatus', () => {
});
describe('lastTurnStatusDotClass', () => {
- it('maps paused and error; hides running, cancelled, and done', () => {
- expect(lastTurnStatusDotClass('paused')).toBe('bg-warning-bg');
- expect(lastTurnStatusDotClass('error')).toBe('bg-failure-bg');
- expect(lastTurnStatusDotClass('cancelled')).toBeUndefined();
- expect(lastTurnStatusDotClass('running')).toBeUndefined();
- expect(lastTurnStatusDotClass('done')).toBeUndefined();
- expect(lastTurnStatusDotClass(null)).toBeUndefined();
+ const now = new Date('2026-11-16T12:00:00.000Z');
+
+ it('maps recent paused; hides stale paused, error, running, cancelled, and done', () => {
+ expect(
+ lastTurnStatusDotClass({
+ status: 'paused',
+ activityAt: new Date(now.getTime() - PAUSED_STATUS_DOT_MAX_AGE_MS),
+ now,
+ }),
+ ).toBe('bg-warning-bg');
+ expect(
+ lastTurnStatusDotClass({
+ status: 'paused',
+ activityAt: new Date(now.getTime() - PAUSED_STATUS_DOT_MAX_AGE_MS - 1),
+ now,
+ }),
+ ).toBeUndefined();
+ expect(lastTurnStatusDotClass({ status: 'paused', now })).toBe('bg-warning-bg');
+ expect(lastTurnStatusDotClass({ status: 'paused', activityAt: new Date('invalid'), now })).toBe('bg-warning-bg');
+ expect(lastTurnStatusDotClass({ status: 'error', now })).toBeUndefined();
+ expect(lastTurnStatusDotClass({ status: 'cancelled', now })).toBeUndefined();
+ expect(lastTurnStatusDotClass({ status: 'running', now })).toBeUndefined();
+ expect(lastTurnStatusDotClass({ status: 'done', now })).toBeUndefined();
+ expect(lastTurnStatusDotClass({ status: null, now })).toBeUndefined();
});
});
@@ -80,6 +101,11 @@ describe('threadCustomWithLastTurnStatus', () => {
});
expect(custom).toEqual({ isMutable: true, lastTurnStatus: 'running' });
expect(threadCustomWithLastTurnStatus(custom, null)).toEqual({ isMutable: true });
+ expect(threadCustomWithLastTurnStatus(custom, 'paused', '2026-11-16T00:00:00.000Z')).toEqual({
+ isMutable: true,
+ lastTurnStatus: 'paused',
+ lastActivityAt: '2026-11-16T00:00:00.000Z',
+ });
expect(threadCustomWithLastTurnStatus(undefined, 'error')).toEqual({ lastTurnStatus: 'error' });
});
@@ -89,6 +115,26 @@ describe('threadCustomWithLastTurnStatus', () => {
});
});
+describe('readThreadLastActivityAt', () => {
+ it('reads a valid poll stamp and ignores anything else', () => {
+ expect(readThreadLastActivityAt({ lastActivityAt: '2026-11-16T00:00:00.000Z' })?.toISOString()).toBe(
+ '2026-11-16T00:00:00.000Z',
+ );
+ expect(readThreadLastActivityAt({ lastActivityAt: 'nope' })).toBeUndefined();
+ expect(readThreadLastActivityAt({})).toBeUndefined();
+ });
+
+ it('treats a later stamp as newer and prefers it over the list payload', () => {
+ const older = new Date('2026-11-01T00:00:00.000Z');
+ const newer = new Date('2026-11-16T00:00:00.000Z');
+ expect(isNewerActivityAt('2026-11-16T00:00:00.000Z', older)).toBe(true);
+ expect(isNewerActivityAt('2026-11-01T00:00:00.000Z', newer)).toBe(false);
+ expect(isNewerActivityAt('nope', older)).toBe(false);
+ expect(laterActivityAt(older, newer)).toBe(newer);
+ expect(laterActivityAt(newer, undefined)).toBe(newer);
+ });
+});
+
describe('threadListItemIsMutable', () => {
it('prefers custom.isMutable over agentName presence', () => {
expect(readThreadIsMutable({ isMutable: false })).toBe(false);
diff --git a/packages/trueforge-ui/test/containers/ThreadListContainer.test.tsx b/packages/trueforge-ui/test/containers/ThreadListContainer.test.tsx
index 88e94a7213..7dbf969625 100644
--- a/packages/trueforge-ui/test/containers/ThreadListContainer.test.tsx
+++ b/packages/trueforge-ui/test/containers/ThreadListContainer.test.tsx
@@ -464,9 +464,11 @@ describe('ThreadListContainer', () => {
await waitFor(() => {
expect(onUpdateCustom).toHaveBeenCalledWith('thread-other', {
lastTurnStatus: 'paused',
+ lastActivityAt: '2026-01-01T00:00:00.000Z',
});
expect(onUpdateCustom).toHaveBeenCalledWith('thread-main', {
lastTurnStatus: 'done',
+ lastActivityAt: '2026-01-01T00:00:00.000Z',
});
});
});
diff --git a/packages/trueforge-ui/test/hooks/useSyncThreadListLastTurnStatus.test.ts b/packages/trueforge-ui/test/hooks/useSyncThreadListLastTurnStatus.test.ts
index 07c8918431..ab67fbbcbf 100644
--- a/packages/trueforge-ui/test/hooks/useSyncThreadListLastTurnStatus.test.ts
+++ b/packages/trueforge-ui/test/hooks/useSyncThreadListLastTurnStatus.test.ts
@@ -4,19 +4,20 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
const useThreadIsRunning = vi.fn(() => false);
const useAuiState = vi.fn();
-const updateCustom = vi.fn(async () => undefined);
+const updateCustom = vi.fn(async (_custom: Record) => undefined);
const getState = vi.fn(() => ({ custom: { isMutable: true } as Record }));
const getSession = vi.fn();
const useOptionalServer = vi.fn((): { getSession: typeof getSession } | null => null);
+const aui = {
+ threadListItem: () => ({ updateCustom, getState }),
+};
vi.mock('@assistant-ui/core/react', () => ({
useThreadIsRunning: () => useThreadIsRunning(),
}));
vi.mock('@/assistant-ui.js', () => ({
- useAui: () => ({
- threadListItem: () => ({ updateCustom, getState }),
- }),
+ useAui: () => aui,
useAuiState: (selector: (state: unknown) => unknown) => useAuiState(selector),
}));
@@ -45,8 +46,16 @@ describe('useSyncThreadListLastTurnStatus', () => {
renderHook(() => useSyncThreadListLastTurnStatus());
await waitFor(() => {
- expect(updateCustom).toHaveBeenCalledWith({ isMutable: true, lastTurnStatus: 'running' });
+ expect(updateCustom).toHaveBeenCalledWith(
+ expect.objectContaining({ isMutable: true, lastTurnStatus: 'running' }),
+ );
});
+ const activityAt = updateCustom.mock.calls[0]?.[0]?.lastActivityAt;
+ expect(typeof activityAt).toBe('string');
+ if (typeof activityAt !== 'string') {
+ throw new Error('expected lastActivityAt string');
+ }
+ expect(Number.isNaN(new Date(activityAt).getTime())).toBe(false);
});
it('does not stamp running before the thread has a remote session id', async () => {
@@ -137,4 +146,50 @@ describe('useSyncThreadListLastTurnStatus', () => {
expect(updateCustom).not.toHaveBeenCalled();
expect(getSession).not.toHaveBeenCalled();
});
+
+ it('still stamps the finished status when lastMessageAt changes while getSession is in flight', async () => {
+ getState.mockReturnValue({ custom: { isMutable: true, lastTurnStatus: 'running' } });
+ let resolveSession: (session: {
+ id: string;
+ updatedAt: string;
+ lastTurnDetails: { id: string; state: { status: 'paused' } };
+ }) => void = () => undefined;
+ getSession.mockReturnValue(
+ new Promise(resolve => {
+ resolveSession = resolve;
+ }),
+ );
+
+ useThreadIsRunning.mockReturnValue(true);
+ const { rerender } = renderHook(() => useSyncThreadListLastTurnStatus());
+ updateCustom.mockClear();
+
+ useThreadIsRunning.mockReturnValue(false);
+ rerender();
+
+ await waitFor(() => {
+ expect(getSession).toHaveBeenCalledTimes(1);
+ });
+
+ useAuiState.mockImplementation((selector: (state: unknown) => unknown) =>
+ selector({
+ threadListItem: { remoteId: 'sess-1', lastMessageAt: new Date('2026-11-16T12:00:00.000Z') },
+ }),
+ );
+ rerender();
+
+ resolveSession({
+ id: 'sess-1',
+ updatedAt: '2026-11-16T12:00:01.000Z',
+ lastTurnDetails: { id: 'turn-1', state: { status: 'paused' } },
+ });
+
+ await waitFor(() => {
+ expect(updateCustom).toHaveBeenCalledWith({
+ isMutable: true,
+ lastTurnStatus: 'paused',
+ lastActivityAt: '2026-11-16T12:00:01.000Z',
+ });
+ });
+ });
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 45cb250d62..60b2bd1b86 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -454,8 +454,8 @@ importers:
specifier: ^2.1.1
version: 2.1.1
lucide-react:
- specifier: ^0.562.0
- version: 0.562.0(react@19.3.0)
+ specifier: ^1.73.0
+ version: 1.73.0(@types/react@19.3.0)(react@19.3.0)
monaco-editor:
specifier: ^0.57.0
version: 0.57.0
@@ -6228,6 +6228,15 @@ packages:
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ lucide-react@1.73.0:
+ resolution: {integrity: sha512-fVOzGviL9mTfHenG1PbCfIceavyGlnpYNSYr+aGZHLRymAJ7DTP6KHuqt0uBkCKAoenr1UVkwSbDIYt2xIesEQ==}
+ peerDependencies:
+ '@types/react': '*'
+ react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
luxon@3.7.2:
resolution: {integrity: sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==}
engines: {node: '>=12'}
@@ -14330,6 +14339,12 @@ snapshots:
dependencies:
react: 19.3.0
+ lucide-react@1.73.0(@types/react@19.3.0)(react@19.3.0):
+ dependencies:
+ react: 19.3.0
+ optionalDependencies:
+ '@types/react': 19.3.0
+
luxon@3.7.2: {}
lz-string@1.5.0: {}