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): one predicate for "timeline row still in flight"\n\nCodeRabbit, PR #6036: `activeSubagentEntry` matched only\n`status === 'running'`, but `subagentAwaitingUser` sets `awaiting_user` on\nthe row's TOP-LEVEL status when a delegated child parks on\n`ask_user_clarification`. The lookup returned `undefined` for the paused\nrow, so `AssistantUiInferenceStatus` lost its `activeSubagentEntry` and the\ngeneric status line reappeared over the delegation card — announcing that\nthe agent was working at the one moment it was blocked on the user.\n\nTwo places in this PR disagreed about what "active" means, so rather than\npatch one side, the question now has a single answer:\n`isActiveTimelineStatus` in `chatRuntimeSlice`, beside the reducer that\nproduces the status.\n\nThere were three hand-written copies, not two — `assistantUiMessages`'\n`toolPart` had a correct third one that decides whether the paused row is\nprojected onto the surface at all. All three now delegate:\n\n- `useOpenHumanExternalStore` — `activeToolEntry` / `activeSubagentEntry`\n (the defect).\n- `AssistantUiSubagentCall` — `isActiveSubagentStatus` keeps its name for\n its ~4 call sites and reads better beside a `SubagentActivity`, but is\n now a delegate rather than a second opinion.\n- `assistantUiMessages` — `toolPart`'s `running`.\n\nTest: a sub-agent pauses via the real `subagentAwaitingUser` reducer, and\nthe delegation card keeps the floor — its question renders and the generic\nline stays away. Reverting the `activeSubagentEntry` predicate alone fails\nit on that assertion.\n\nTwo correct-but-still-hand-written copies are deliberately left alone\nrather than widen this PR's diff into files other workers hold open:\n`AssistantUiToolCall.tsx:149` and `ToolTimelineBlock.tsx:535`.\n
M3gA-Mind976638137808
diff --git a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx b/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsxindex 86c79d45fc..b027121645 100644--- a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx+++ b/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx@@ -24,6 +24,7 @@ import chatRuntimeReducer, {markInferenceTurnStreaming,setInferenceStatusForThread,setToolTimelineForThread,+ subagentAwaitingUser,} from '../../../store/chatRuntimeSlice';import mascotReducer from '../../../store/mascotSlice';import threadReducer from '../../../store/threadSlice';@@ -201,6 +202,76 @@ describe('inference status on the assistant-ui chat surface', () => {expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();});+ it('keeps the paused sub-agent as the active row when the child asks the user', async () => {+ // Regression (CodeRabbit, PR #6036): `activeSubagentEntry` matched only+ // `status === 'running'`, but `subagentAwaitingUser` sets `awaiting_user` on+ // the row's TOP-LEVEL status. The lookup therefore lost the row the instant+ // the child parked on `ask_user_clarification`, and the generic status line+ // reappeared over the delegation card — announcing that the agent was+ // working at the one moment it was blocked on the user.+ const store = buildStore();+ renderChat(store);+ startTurn(store);++ const rowId = `${THREAD_ID}:subagent:task-1:researcher`;+ act(() => {+ store.dispatch(+ setToolTimelineForThread({+ threadId: THREAD_ID,+ entries: [+ {+ id: rowId,+ name: 'subagent:researcher',+ round: 1,+ seq: 0,+ status: 'running',+ subagent: {+ taskId: 'task-1',+ agentId: 'researcher',+ status: 'running',+ toolCalls: [],+ },+ },+ ],+ })+ );+ store.dispatch(+ setInferenceStatusForThread({+ threadId: THREAD_ID,+ status: {+ phase: 'subagent',+ iteration: 1,+ maxIterations: 8,+ activeSubagent: 'researcher',+ },+ })+ );+ });++ // Guards the instrument: while the child runs, the delegation card owns the+ // display and the generic line is already suppressed.+ await screen.findByText(/researcher/i);+ expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();++ // The child parks on the user. Driven through the real reducer, so the test+ // pins the reducer -> adapter -> render chain rather than a hand-written+ // status value.+ act(() => {+ store.dispatch(+ subagentAwaitingUser({+ threadId: THREAD_ID,+ rowId,+ question: 'Which repository should I review?',+ })+ );+ });++ // The row is still the active sub-agent, so the card keeps the floor and+ // the generic line stays away.+ expect(await screen.findByText('Which repository should I review?')).toBeInTheDocument();+ expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();+ });+it('drops the line when the turn ends', async () => {const store = buildStore();renderChat(store);diff --git a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.tsxindex b7da51cee1..e978071fad 100644--- a/app/src/features/conversations/components/AssistantUiSubagentCall.tsx+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx@@ -18,10 +18,11 @@ import { Button } from '../../../components/ui';import Badge from '../../../components/ui/Badge';import WorktreeActions from '../../../components/worktree/WorktreeActions';import { useT } from '../../../lib/i18n/I18nContext';-import type {- SubagentActivity,- SubagentToolCallEntry,- SubagentTranscriptItem,+import {+ isActiveTimelineStatus,+ type SubagentActivity,+ type SubagentToolCallEntry,+ type SubagentTranscriptItem,} from '../../../store/chatRuntimeSlice';import { basename } from '../../../utils/pathUtils';import { stripToolCallEnvelopes } from '../../../utils/toolTimelineFormatting';@@ -167,9 +168,14 @@ function SubagentDetails({* rendering bugs: a caller that omitted `running` showed a *failed* delegation* with a success check, while `status !== 'completed'` gave the same row an* endless spinner. Both call sites now ask this one question.+ *+ * The question itself is `isActiveTimelineStatus`, which the timeline row's+ * top-level `status` is also read through. This name survives because ~4 call+ * sites and their tests use it and it reads better beside a `SubagentActivity`+ * — but it must never grow a second opinion about what "active" means.*/export function isActiveSubagentStatus(status: string | undefined): boolean {- return status === 'running' || status === 'awaiting_user';+ return isActiveTimelineStatus(status);}/** Statuses that mean the delegation stopped without succeeding. */diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.tsindex 7716ddad25..18d1f55a11 100644--- a/app/src/providers/assistantUiMessages.ts+++ b/app/src/providers/assistantUiMessages.ts@@ -7,11 +7,12 @@ import type {import { parseMessageImages } from '../lib/attachments';import { unwrapToolCallEnvelope } from '../lib/chat/toolCallEnvelope';-import type {- PendingApproval,- ProcessingTranscriptItem,- StreamingAssistantState,- ToolTimelineEntry,+import {+ isActiveTimelineStatus,+ type PendingApproval,+ type ProcessingTranscriptItem,+ type StreamingAssistantState,+ type ToolTimelineEntry,} from '../store/chatRuntimeSlice';import type { ThreadMessage } from '../types/thread';@@ -105,7 +106,7 @@ function toolResultPayload(entry: ToolTimelineEntry): unknown {}function toolPart(entry: ToolTimelineEntry): ThreadAssistantMessagePart {- const running = entry.status === 'running' || entry.status === 'awaiting_user';+ const running = isActiveTimelineStatus(entry.status);const isSubagent = entry.name.startsWith('subagent:') || entry.subagent !== undefined;const args = isSubagent? jsonObject({diff --git a/app/src/providers/useOpenHumanExternalStore.ts b/app/src/providers/useOpenHumanExternalStore.tsindex 39dca9695c..4426b880f2 100644--- a/app/src/providers/useOpenHumanExternalStore.ts+++ b/app/src/providers/useOpenHumanExternalStore.ts@@ -7,6 +7,7 @@ import { threadApi } from '../services/api/threadApi';import {clearPendingApprovalForThread,type InferenceStatus,+ isActiveTimelineStatus,type ToolTimelineEntry,} from '../store/chatRuntimeSlice';import { useAppDispatch, useAppSelector } from '../store/hooks';@@ -242,11 +243,15 @@ export function useOpenHumanExternalStore(threadId: string | null) {if (!inferenceStatus) return EMPTY_EXTRAS;return {inferenceStatus,+ // `isActiveTimelineStatus`, not `status === 'running'`: a delegated child+ // parked on `ask_user_clarification` carries `awaiting_user` on the row's+ // top-level status, and dropping the match there loses the sub-agent's+ // identity at the one moment the user is the thing being waited on.activeToolEntry: [...liveTimeline].reverse()- .find(entry => entry.status === 'running' && !entry.name.startsWith('subagent:')),+ .find(entry => isActiveTimelineStatus(entry.status) && !entry.name.startsWith('subagent:')),activeSubagentEntry: liveTimeline.find(- entry => entry.status === 'running' && entry.name.startsWith('subagent:')+ entry => isActiveTimelineStatus(entry.status) && entry.name.startsWith('subagent:')),};}, [inferenceStatus, liveTimeline]);diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.tsindex 6bbfe75430..263f07e551 100644--- a/app/src/store/chatRuntimeSlice.ts+++ b/app/src/store/chatRuntimeSlice.ts@@ -39,6 +39,24 @@ export type ToolTimelineEntryStatus =| 'awaiting_user'| 'cancelled';+/**+ * The single answer to "is this row still in flight?".+ *+ * `awaiting_user` is in flight. `subagentAwaitingUser` below sets it on the+ * row's TOP-LEVEL `status` (not only on `subagent.status`) when a delegated+ * child parks on `ask_user_clarification`, and a turn parked on the user has+ * not finished — it is blocked, which is the one moment the UI most needs to+ * keep the row's identity.+ *+ * It lives beside the reducer that produces the status because the alternative+ * was measured: three call sites spelled this out by hand, and the one that+ * omitted `awaiting_user` lost the delegation exactly during the pause. A+ * predicate a caller can retype is a predicate that drifts.+ */+export function isActiveTimelineStatus(status: string | undefined): boolean {+ return status === 'running' || status === 'awaiting_user';+}+/** Live progress of the running turn, as the socket handlers maintain it. */export interface InferenceStatus {phase: 'thinking' | 'tool_use' | 'subagent';