The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chat): show "Thinking…" on every turn of a chat that ran a subagent
Sanil521292e214de
diff --git a/app/src/features/conversations/aui/AgentRunningStatus.test.tsx b/app/src/features/conversations/aui/AgentRunningStatus.test.tsxindex 547d1fcc81..6e04f8359e 100644--- a/app/src/features/conversations/aui/AgentRunningStatus.test.tsx+++ b/app/src/features/conversations/aui/AgentRunningStatus.test.tsx@@ -6,7 +6,12 @@ import { describe, expect, it, vi } from 'vitest';import { AssistantUiRuntimeProvider } from '../../../providers/AssistantUiRuntimeProvider';import chatRuntimeReducer from '../../../store/chatRuntimeSlice';import threadReducer from '../../../store/threadSlice';-import { AgentRunningStatus, hasPendingClarification, waitingOnUser } from './AgentRunningStatus';+import {+ AgentRunningStatus,+ hasPendingClarification,+ turnHasTasks,+ waitingOnUser,+} from './AgentRunningStatus';vi.mock('../../../services/api/threadApi', () => ({threadApi: {@@ -134,3 +139,23 @@ describe('hasPendingClarification', () => {expect(hasPendingClarification([])).toBe(false);});});++describe('turnHasTasks', () => {+ const user = { id: 'u-2', role: 'user' };+ const earlier = { id: 'a-1', role: 'assistant' };+ const running = { id: 'a-2', role: 'assistant' };++ it('ignores delegations from earlier turns', () => {+ expect(turnHasTasks([{ messageId: 'a-1' }], [earlier, user, running])).toBe(false);+ });++ it('is true when the running turn delegated work', () => {+ expect(+ turnHasTasks([{ messageId: 'a-1' }, { messageId: 'a-2' }], [earlier, user, running])+ ).toBe(true);+ });++ it('is false before the running turn has a reply', () => {+ expect(turnHasTasks([{ messageId: 'a-1' }], [earlier, user])).toBe(false);+ });+});diff --git a/app/src/features/conversations/aui/AgentRunningStatus.tsx b/app/src/features/conversations/aui/AgentRunningStatus.tsxindex bc71e1cffa..f89c5ef3e5 100644--- a/app/src/features/conversations/aui/AgentRunningStatus.tsx+++ b/app/src/features/conversations/aui/AgentRunningStatus.tsx@@ -85,6 +85,23 @@ export function hasPendingClarification(messages: ReadonlyArray<MessageLike>): breturn false;}+/**+ * Whether the running turn has delegated work of its own.+ *+ * assistant-ui's `thread.tasks` collects delegations from every message in the+ * thread, so a chat that ran a subagent once would hide "Thinking…" on every+ * later turn. The running turn is the newest message when it is the+ * assistant's; a turn whose reply has not appeared yet has no tasks.+ */+export function turnHasTasks(+ tasks: ReadonlyArray<{ readonly messageId: string }>,+ messages: ReadonlyArray<{ readonly id: string; readonly role: string }>+): boolean {+ const newest = messages.at(-1);+ if (newest?.role !== 'assistant') return false;+ return tasks.some(task => task.messageId === newest.id);+}+/** Approval outranks review outranks answer: the most blocking gate first. */export function waitingOnUser(args: {approval: boolean;@@ -148,7 +165,8 @@ export function AgentRunningStatus() {const parentWaits = useParentWaitsOnSubagents();const [tick, setTick] = useState(0);const [startedAt] = useState(() => Date.now());- const thinking = summary.total === 0 && waiting === null;+ const turnTasks = useAuiState(s => turnHasTasks(s.thread.tasks, s.thread.messages));+ const thinking = !turnTasks && waiting === null;const elapsedMs = useTaskElapsed({ startedAt }, thinking);useEffect(() => {@@ -159,7 +177,7 @@ export function AgentRunningStatus() {if (waiting !== null) return <WaitingLine kind={waiting} />;- if (summary.total === 0) {+ if (!turnTasks) {const label =elapsedMs !== undefined && elapsedMs >= 1000? t('chat.status.thinkingElapsed').replace('{elapsed}', formatElapsed(elapsedMs))