Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(conversations): remove AssistantUiInferenceStatus component and its tests

Steven Enamakel9cd8a0514306
diff --git a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx b/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx
deleted file mode 100644
index 41c20c6c92..0000000000
--- a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * The progress line on the assistant-ui chat surface.
- *
- * `/chat` renders `AssistantUiChat`, so before the `RunningStatus` slot the whole of `chatRuntime.inferenceStatusByThread` —
- * reasoning round, active tool, delegated sub-agent — was dispatched by
- * `onInferenceStart` / `onIterationStart` / `onToolCall` and rendered nowhere.
- * assistant-ui knows only `thread.isRunning`, so a long turn was a spinner with
- * no round counter and no tool name.
- *
- * These tests mount the real surface (`AssistantUiChat` → its own
- * `AssistantUiRuntimeProvider` → `Thread`) over a real store, so they cover
- * both halves of the fix: the adapter publishing the status on the runtime's
- * `extras`, and the slot rendering it.
- */
-import { combineReducers, configureStore } from '@reduxjs/toolkit';
-import { act, render, screen } from '@testing-library/react';
-import { Provider } from 'react-redux';
-import { describe, expect, it, vi } from 'vitest';
-
-import chatRuntimeReducer, {
- beginInferenceTurn,
- endInferenceTurn,
- markInferenceTurnStreaming,
- setInferenceStatusForThread,
- setToolTimelineForThread,
- subagentAwaitingUser,
-} from '../../../store/chatRuntimeSlice';
-import mascotReducer from '../../../store/mascotSlice';
-import runModeReducer from '../../../store/runModeSlice';
-import threadReducer from '../../../store/threadSlice';
-import { AssistantUiChat } from './AssistantUiChat';
-
-const THREAD_ID = 't-status';
-
-function buildStore() {
- return configureStore({
- reducer: combineReducers({
- thread: threadReducer,
- chatRuntime: chatRuntimeReducer,
- mascot: mascotReducer,
- // The composer's `/plan` / `/build` commands read it (`useRunMode`).
- runMode: runModeReducer,
- }),
- preloadedState: {
- thread: {
- threads: [
- {
- id: THREAD_ID,
- title: 'Status thread',
- chatId: null,
- isActive: true,
- messageCount: 1,
- lastMessageAt: '2026-01-01T00:00:00.000Z',
- createdAt: '2026-01-01T00:00:00.000Z',
- labels: ['general'],
- },
- ],
- selectedThreadId: THREAD_ID,
- activeThreadIds: {},
- welcomeThreadId: null,
- messagesByThreadId: {
- [THREAD_ID]: [
- {
- id: 'm-0',
- sender: 'user',
- type: 'text',
- content: 'run the suite',
- extraMetadata: {},
- createdAt: '2026-01-01T00:00:00.000Z',
- },
- ],
- },
- messages: [],
- isLoadingThreads: false,
- isLoadingMessages: false,
- messagesError: null,
- },
- } as never,
- });
-}
-
-function renderChat(store: ReturnType<typeof buildStore>) {
- return render(
- <Provider store={store}>
- <AssistantUiChat
- model={null}
- onModelChange={vi.fn()}
- inputValue=""
- onInputValueChange={vi.fn()}
- attachments={[]}
- onAttachFiles={vi.fn()}
- onRemoveAttachment={vi.fn()}
- maxAttachments={5}
- attachmentsEnabled={false}
- attachmentInteractionBlocked={false}
- onAttachmentOnlySend={vi.fn()}
- />
- </Provider>
- );
-}
-
-/** Put the thread in the state a live turn leaves behind. */
-function startTurn(store: ReturnType<typeof buildStore>) {
- act(() => {
- store.dispatch(beginInferenceTurn({ threadId: THREAD_ID }));
- store.dispatch(markInferenceTurnStreaming({ threadId: THREAD_ID }));
- });
-}
-
-describe('inference status on the assistant-ui chat surface', () => {
- it('renders nothing while the model is thinking — the library dot owns that gap', async () => {
- const store = buildStore();
- renderChat(store);
- startTurn(store);
-
- // Nothing to say before the first `iteration_start`.
- expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();
-
- act(() => {
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'thinking', iteration: 3, maxIterations: 8 },
- })
- );
- });
-
- // `Thinking... (3)` used to render here. It duplicated assistant-ui's own
- // in-flight marker: a synthetic `indicator` part, emitted by
- // `MessagePrimitive.GroupedParts` for a running message with zero content
- // parts and rendered by `thread.tsx` as
- // `<span data-slot="aui_assistant-message-indicator">●</span>`. Probing the
- // DOM in this exact state finds that span present and zero `.aui-md`
- // elements, so it is not the `dot.css` `:empty::after` rule — see
- // `AssistantUiInferenceStatus`'s doc comment. The iteration count was
- // harness telemetry besides.
- expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();
-
- // The suppression must be specific to `thinking`, not a dead component:
- // a `tool_use` phase with no timeline row still has to caption itself, or
- // this assertion would pass with the whole line removed.
- act(() => {
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'tool_use', iteration: 3, maxIterations: 8, activeTool: 'shell' },
- })
- );
- });
- expect(await screen.findByTestId('inference-status-line')).toHaveTextContent('Running command');
- });
-
- it('names the running tool when no timeline row carries it', async () => {
- const store = buildStore();
- renderChat(store);
- startTurn(store);
-
- // `tool_use` with an empty timeline: a restored snapshot, or a row that
- // settled ahead of the status. `status.activeTool` is then the only name
- // the surface has for the work in flight.
- act(() => {
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'tool_use', iteration: 2, maxIterations: 8, activeTool: 'shell' },
- })
- );
- });
-
- expect(await screen.findByTestId('inference-status-line')).toHaveTextContent('Running command');
- });
-
- it('yields to the tool part once the running row is on screen', async () => {
- const store = buildStore();
- renderChat(store);
- startTurn(store);
-
- // Anchored on `tool_use` with an empty timeline — the phase that still
- // captions itself. `thinking` renders nothing now, so anchoring there
- // would leave the assertion below passing from a state where the line was
- // never present: a guard that cannot fail.
- act(() => {
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'tool_use', iteration: 2, maxIterations: 8, activeTool: 'shell' },
- })
- );
- });
- expect(await screen.findByTestId('inference-status-line')).toHaveTextContent('Running command');
-
- // The tool call lands: the row is projected as a tool part that already
- // names the command, so the line must not caption it a second time.
- act(() => {
- store.dispatch(
- setToolTimelineForThread({
- threadId: THREAD_ID,
- entries: [
- { id: 'tl-1', name: 'shell', round: 2, seq: 0, status: 'running', detail: 'npm test' },
- ],
- })
- );
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'tool_use', iteration: 2, maxIterations: 8, activeTool: 'shell' },
- })
- );
- });
-
- 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);
- startTurn(store);
-
- // `tool_use` with no timeline row, for the same reason as above: it is the
- // phase that still renders, so the disappearance asserted below is a real
- // transition rather than an absence that was already true.
- act(() => {
- store.dispatch(
- setInferenceStatusForThread({
- threadId: THREAD_ID,
- status: { phase: 'tool_use', iteration: 1, maxIterations: 8, activeTool: 'shell' },
- })
- );
- });
- expect(await screen.findByTestId('inference-status-line')).toHaveTextContent('Running command');
-
- act(() => {
- store.dispatch(endInferenceTurn({ threadId: THREAD_ID }));
- });
-
- // `thread.isRunning` is false now, so the slot is gone even though the
- // status slice has not been cleared yet.
- expect(screen.queryByTestId('inference-status-line')).not.toBeInTheDocument();
- });
-});
diff --git a/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx b/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx
deleted file mode 100644
index d7658208e7..0000000000
--- a/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { type AssistantState, useAuiState } from '@assistant-ui/react';
-
-import { readOpenHumanThreadExtras } from '../../../providers/useOpenHumanExternalStore';
-import { InferenceStatusLine } from './aui/InferenceStatusLine';
-
-const selectThreadExtras = (state: AssistantState) => state.thread.extras;
-
-/**
- * The "what is the model doing right now" line, on the assistant-ui surface.
- *
- * assistant-ui knows only `thread.isRunning`, so before this the whole of
- * `chatRuntime.inferenceStatusByThread` — reasoning round, active tool,
- * delegated sub-agent — reached no assistant-ui surface. A slow turn was an
- * unlabelled spinner.
- *
- * The status arrives on the runtime's `extras` channel
- * (`useOpenHumanExternalStore`), so it is always the status of the thread *this
- * runtime* represents; this component holds no Redux read of its own and is
- * therefore safe on a second runtime such as the Workflow Copilot's.
- *
- * Rendering is shared with the legacy surface (`InferenceStatusLine`) so the
- * mic-cloud composer and `/chat` cannot drift apart, and so is the rule for
- * when to show it: the `tool_use` / `subagent` phases only restate the running
- * row, which this surface already paints as a tool part, so the line would be
- * a duplicate caption under the card. It is kept as a fallback whenever the
- * phase's row is not on screen (a restored snapshot, or a row that settled
- * ahead of the status), where `status.activeTool` / `status.activeSubagent` is
- * the only name for the work in flight.
- *
- * The `thinking` phase renders NOTHING here. It used to show
- * `Thinking... (N)` — a pulsing dot plus the harness's iteration counter — but
- * assistant-ui already marks a running turn as in flight, so ours was a second
- * indicator stacked under it, and the iteration count was harness telemetry the
- * reader has no use for.
- *
- * The library's marker is a *message-level* part, which is the detail that
- * matters here. While the thread is running assistant-ui mints a placeholder
- * assistant message; `MessagePrimitive.GroupedParts` emits a synthetic
- * `indicator` part for a running message with zero content parts
- * (`@assistant-ui/core`, `contentLength === 0 && isRunning`), and
- * `components/assistant-ui/thread.tsx` renders that part as
- * `<span data-slot="aui_assistant-message-indicator">●</span>`. Being
- * message-level, which is why the suppression lives here, at this caller,
- * rather than in the shared `InferenceStatusLine`.
- *
- * It is NOT `@assistant-ui/react-markdown/styles/dot.css` painting
- * `.aui-md[data-status="running"]:empty::after`. That rule cannot fire in this
- * window: `assistantParts` pushes a text part only when `text.length > 0` and
- * `streamingTailMessage` returns `null` at `parts.length === 0`
- * (`providers/assistantUiMessages.ts`), so no `.aui-md` element exists yet for
- * `:empty` to match. Said here because believing the marker was CSS on a
- * markdown element is what once made deleting the shared `thinking` branch look
- * safe; it blanked the voice surface.
- */
-export function AssistantUiInferenceStatus() {
- const extras = readOpenHumanThreadExtras(useAuiState(selectThreadExtras));
- const status = extras?.inferenceStatus;
- if (!status) return null;
- if (status.phase === 'thinking') return null;
-
- const activeRow =
- status.phase === 'subagent'
- ? extras?.activeSubagentEntry
- : status.phase === 'tool_use'
- ? extras?.activeToolEntry
- : undefined;
- if (activeRow) return null;
-
- return (
- <InferenceStatusLine
- status={status}
- activeToolEntry={extras?.activeToolEntry}
- activeSubagentEntry={extras?.activeSubagentEntry}
- />
- );
-}
-
-export default AssistantUiInferenceStatus;