Skip to content

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

fix(conversations): correct inference status display for subagent calls

Steven Enamakel812ab7d137de
diff --git a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx b/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx
index 4d7fc822b0..f2e298417d 100644
--- a/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx
+++ b/app/src/features/conversations/components/AssistantUiInferenceStatus.test.tsx
@@ -1,8 +1,7 @@
/**
* The progress line on the assistant-ui chat surface.
*
- * `/chat` renders `AssistantUiChat`, never `ChatThreadView`, so before the
- * `RunningStatus` slot the whole of `chatRuntime.inferenceStatusByThread` —
+ * `/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
diff --git a/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx b/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx
index c6297895c0..d7658208e7 100644
--- a/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx
+++ b/app/src/features/conversations/components/AssistantUiInferenceStatus.tsx
@@ -10,8 +10,8 @@ const selectThreadExtras = (state: AssistantState) => state.thread.extras;
*
* assistant-ui knows only `thread.isRunning`, so before this the whole of
* `chatRuntime.inferenceStatusByThread` — reasoning round, active tool,
- * delegated sub-agent — stopped at `ChatThreadView`, which `/chat` no longer
- * renders. A slow turn was an unlabelled spinner.
+ * 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
@@ -40,9 +40,8 @@ const selectThreadExtras = (state: AssistantState) => state.thread.extras;
* (`@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, it exists only on this surface — `ChatThreadView` has no
- * equivalent, which is why the shared `InferenceStatusLine` keeps its
- * `thinking` branch and the suppression lives here instead.
+ * 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
diff --git a/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx
index b483d4c528..b6637c3ebb 100644
--- a/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx
+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.awaitingUser.test.tsx
@@ -7,8 +7,8 @@
* which folds `awaiting_user` into `running`: the delegation card showed a
* spinning "running" chip for as long as the gate stayed open, the question was
* never carried out of the socket event at all, and the only surface that could
- * have shown it (`SubagentDrawer`) lives inside the unreachable
- * `legacyMainPanel`.
+ * have shown it (`SubagentDrawer`) was then mounted only by the legacy
+ * transcript, which `/chat` did not render.
*/
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { act, render, screen, waitFor } from '@testing-library/react';
diff --git a/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx b/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
index e5aebb0917..5234c54674 100644
--- a/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
+++ b/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
@@ -28,7 +28,7 @@ function renderInStore(ui: React.ReactNode) {
describe('SubagentActivityBlock', () => {
it('derives its lifecycle from the activity when no running prop is passed', () => {
- // Most call sites (AgentProcessSourcePanel, PastTurnInsights, this block)
+ // Most call sites (AgentProcessSourcePanel, this block)
// pass no `running` prop at all. The old `running = false` default reported
// an in-flight delegation as finished, with a success check.
renderInStore(
diff --git a/app/src/features/conversations/components/aui/ChatSources.test.tsx b/app/src/features/conversations/components/aui/ChatSources.test.tsx
index 37fa1a83b4..b6a4e9f060 100644
--- a/app/src/features/conversations/components/aui/ChatSources.test.tsx
+++ b/app/src/features/conversations/components/aui/ChatSources.test.tsx
@@ -13,8 +13,8 @@
* transcript RPC → `mapDisplayItems` → the adapter → message metadata), not
* by rendering `ChatSources` directly with a hand-made prop. A component that
* renders correctly in isolation while nothing mounts it is the defect shape
- * this codebase keeps producing (`legacyMainPanel`, the assistant-ui
- * reasoning part, the suggestion chips), so proving the wiring is the point;
+ * this codebase keeps producing (the old voice-only transcript panel, the
+ * assistant-ui reasoning part, the suggestion chips), so proving the wiring is the point;
* 3. a non-`http(s)` URL never becomes a link. Sources are derived from the
* `url` argument of a fetch tool call, which is raw model output, so a
* `javascript:` value must not reach an `<a href>`. `extractAgentSources`
diff --git a/app/src/features/conversations/components/aui/InferenceStatusLine.tsx b/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
index 0f1849c1e1..db91de83ca 100644
--- a/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
+++ b/app/src/features/conversations/components/aui/InferenceStatusLine.tsx
@@ -23,12 +23,8 @@ export interface InferenceStatusLineProps {
* once that timeline is on screen, and keeps it when there is no timeline row
* to fall back on.
*
- * The `thinking` branch renders `Thinking... (N)`, and stays here because this
- * component is shared: `ChatThreadView` (the legacy / voice-mode surface) renders
- * this line *specifically* for that phase, and that surface has no assistant-ui
- * markdown, so nothing else indicates the pre-first-token gap for it.
- *
- * On the assistant-ui surface that caption WOULD stack a second indicator under
+ * The `thinking` branch renders `Thinking... (N)`. On the assistant-ui surface
+ * that caption WOULD stack a second indicator under
* the library's own, and the `(N)` is the harness's iteration counter, internal
* telemetry a reader cannot act on. That is suppressed one layer up:
* `AssistantUiInferenceStatus` returns null for `thinking` before reaching this
@@ -36,26 +32,17 @@ export interface InferenceStatusLineProps {
* message-level synthetic `indicator` part, not a CSS rule on `.aui-md`) and why
* that is precisely why this surface has no equivalent.
*
- * So the suppression is per-surface, at the surface-specific caller, rather than
- * by deleting a branch the other caller depends on.
+ * So the suppression is per-surface, at the surface-specific caller, and this
+ * component stays a complete renderer for every phase.
*/
export function InferenceStatusLine({
status,
activeToolEntry,
activeSubagentEntry,
}: InferenceStatusLineProps) {
- // The `thinking` caption stays HERE, in the shared component, because the
- // legacy surface still needs it: `ChatThreadView` renders this line
- // specifically for that phase ("keep it only for the `thinking` phase, which
- // has no timeline row yet") and has no assistant-ui markdown, so nothing
- // paints a dot for it. Removing the branch left that surface with a bare
- // pulse and no caption.
- //
- // The duplicate this PR is fixing is an assistant-ui problem, and it is fixed
- // at the assistant-ui layer: `AssistantUiInferenceStatus` returns null for
- // `thinking` before it ever reaches this component, so the caption below
- // cannot stack under assistant-ui's own `●` there — a message-level
- // `indicator` part that has no counterpart on this surface.
+ // `AssistantUiInferenceStatus` returns null for `thinking` before it ever
+ // reaches this component, so the caption below cannot stack under
+ // assistant-ui's own `●` (a message-level `indicator` part).
const { t } = useT();
return (
<div
diff --git a/app/src/features/conversations/components/aui/TranscriptOverlays.tsx b/app/src/features/conversations/components/aui/TranscriptOverlays.tsx
index 298f113ee3..a9d6bc6299 100644
--- a/app/src/features/conversations/components/aui/TranscriptOverlays.tsx
+++ b/app/src/features/conversations/components/aui/TranscriptOverlays.tsx
@@ -31,9 +31,9 @@ export interface TranscriptOverlaysProps {
* The three transcript-local modals: background sub-agents, the sub-agent
* drawer, and the Agent Process Source panel.
*
- * Split out of `ChatThreadView` because none of it is part of the transcript's
- * render path — it is driven entirely by the view's own disclosure state, and
- * keeping it inline made the hot path harder to read than it needs to be.
+ * Mounted beside the assistant-ui `Thread` by each host (the home chat and the
+ * workflow copilot) because none of it is part of the transcript's render path
+ * — it is driven entirely by the host's own disclosure state.
*/
export function TranscriptOverlays({
threadId,
diff --git a/app/src/features/conversations/components/aui/auiThreadState.ts b/app/src/features/conversations/components/aui/auiThreadState.ts
index 1813eb1d8c..128cbc7c91 100644
--- a/app/src/features/conversations/components/aui/auiThreadState.ts
+++ b/app/src/features/conversations/components/aui/auiThreadState.ts
@@ -86,7 +86,8 @@ export function useAuiReloadCapability(): boolean {
*
* When the core gains a branch model and `useOpenHumanExternalStore` grows
* `onEdit` + `setMessages`, two affordances become renderable and both belong
- * inside `TranscriptRow` (the memoized per-turn component), NOT here:
+ * in the assistant-ui message components (`components/assistant-ui/thread.tsx`),
+ * NOT here:
*
* - an edit composer, gated on `useAuiEditCapabilities().canEdit`, rendered
* from `ComposerPrimitive.Root` / `ComposerPrimitive.Input` inside a
@@ -101,9 +102,9 @@ export function useAuiReloadCapability(): boolean {
* That rule was stated here but not enforced anywhere until #5897 — this hook
* had zero production consumers while `ActionBarPrimitive.Edit` shipped
* unconditionally, so the button was rendered, clickable and inert. The gate is
- * wired now; keep it wired when the affordances move into `TranscriptRow`.
+ * wired now; keep it wired when the affordances land in `thread.tsx`.
*/
export const EDIT_AND_BRANCH_SEAM = Object.freeze({
- editComposer: 'TranscriptRow — gated on useAuiEditCapabilities().canEdit',
- branchPicker: 'TranscriptRow — gated on useAuiEditCapabilities().canSwitchToBranch',
+ editComposer: 'thread.tsx UserMessage — gated on useAuiEditCapabilities().canEdit',
+ branchPicker: 'thread.tsx BranchPicker — gated on useAuiEditCapabilities().canSwitchToBranch',
});
diff --git a/app/src/features/conversations/derived/mapDisplayItems.ts b/app/src/features/conversations/derived/mapDisplayItems.ts
index 09a371534c..49d8e1ee79 100644
--- a/app/src/features/conversations/derived/mapDisplayItems.ts
+++ b/app/src/features/conversations/derived/mapDisplayItems.ts
@@ -3,11 +3,10 @@
* {@link DerivedDisplayItem}s onto the **existing** settled-turn renderer
* models, keyed by producing `requestId` — the exact shapes
* `fetchAndHydrateTurnHistory` produces from the legacy `turn_state_history`
- * snapshot ring, so `PastTurnInsights` / `ProcessingTranscriptView` /
- * assistant-ui tool and delegation cards are reused unchanged.
+ * snapshot ring, so `ProcessingTranscriptView` / assistant-ui tool and
+ * delegation cards are reused unchanged.
*
- * Division of labour (matches how `turnTimelinesByThread` / `PastTurnInsights`
- * anchor today):
+ * Division of labour (matches how `turnTimelinesByThread` anchors today):
* - **Final assistant text and user text are NOT emitted here** — they stay
* rendered from the thread message list (`threads_messages_list`). This
* mapper only produces the *process trail* (reasoning, interim narration,
diff --git a/app/src/lib/chat/toolCallEnvelope.ts b/app/src/lib/chat/toolCallEnvelope.ts
index f89c60d007..b5ea3345cf 100644
--- a/app/src/lib/chat/toolCallEnvelope.ts
+++ b/app/src/lib/chat/toolCallEnvelope.ts
@@ -4,9 +4,9 @@ import createDebug from 'debug';
* toolCallEnvelope — defends any chat transcript against rendering the raw
* provider wire-format envelope instead of clean assistant text (B25).
*
- * Applied by the shared `ChatThreadView` transcript renderer, so it guards
- * BOTH the home chat and the workflow copilot (which now reuses that
- * renderer). Originally lived under `lib/flows` for the copilot alone.
+ * Applied by the assistant-ui message projection (`assistantUiMessages.ts`),
+ * so it guards BOTH the home chat and the workflow copilot (which renders the
+ * same `Thread`). Originally lived under `lib/flows` for the copilot alone.
*
* The Rust core's `NativeToolDispatcher::to_provider_messages`
* (`crates/openhuman-core/src/agent/dispatcher.rs`) and the tinyagents bridge's
@@ -60,8 +60,8 @@ function isPlainObject(value: unknown): value is Record<string, unknown> {
/**
* Memo cache for `unwrapToolCallEnvelope`, keyed on the raw message string.
*
- * WHY: `ChatThreadView` calls this for every agent message inside a `.map()` in
- * its render body, and that component re-renders on every streamed token. The
+ * WHY: the transcript projection calls this for every agent message, and it
+ * can re-run on every streamed token. The
* work is therefore O(transcript) per token. Worse, the common case is the
* expensive one: ordinary prose is not JSON, so `JSON.parse` THROWS and is
* caught, once per message per token.
diff --git a/app/src/providers/__tests__/AssistantUiRuntimeProvider.threadScope.test.tsx b/app/src/providers/__tests__/AssistantUiRuntimeProvider.threadScope.test.tsx
index a3bc920be2..58f1cb9dc2 100644
--- a/app/src/providers/__tests__/AssistantUiRuntimeProvider.threadScope.test.tsx
+++ b/app/src/providers/__tests__/AssistantUiRuntimeProvider.threadScope.test.tsx
@@ -2,11 +2,10 @@
* The runtime must represent the thread it is GIVEN.
*
* `AssistantUiRuntimeProvider` used to read `state.thread.selectedThreadId`
- * itself, which is only correct for the home chat. `ChatThreadView` is also
- * rendered by the Workflow Copilot against its own dedicated builder thread,
- * which is never the selected one — so a runtime that follows the selection
- * would, once the transcript renders from assistant-ui primitives, paint the
- * home chat's messages inside the copilot.
+ * itself, which is only correct for the home chat. The assistant-ui `Thread` is
+ * also rendered by the Workflow Copilot against its own dedicated builder
+ * thread, which is never the selected one — so a runtime that follows the
+ * selection would paint the home chat's messages inside the copilot.
*
* These tests state that as behaviour rather than as structure: what a probe
* under the runtime sees, and what two simultaneously-mounted runtimes see.
diff --git a/app/src/providers/__tests__/assistantUiMessages.test.ts b/app/src/providers/__tests__/assistantUiMessages.test.ts
index 5ab050830a..379441d86b 100644
--- a/app/src/providers/__tests__/assistantUiMessages.test.ts
+++ b/app/src/providers/__tests__/assistantUiMessages.test.ts
@@ -454,8 +454,7 @@ describe('buildRuntimeMessages', () => {
});
it('re-converts only the tail as tokens land, never the settled transcript', () => {
- // The projection-level statement of the property `ChatThreadView.renderPerf`
- // pins for the render tree: streaming must not sweep the transcript.
+ // Streaming must not sweep the transcript: only the live tail re-converts.
const settled = Array.from({ length: 40 }, (_, i) =>
msg({ id: `m-${i}`, sender: i % 2 ? 'agent' : 'user', content: `prose ${i}` })
);
diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.ts
index 9ca3a4f44f..34e997ad90 100644
--- a/app/src/providers/assistantUiMessages.ts
+++ b/app/src/providers/assistantUiMessages.ts
@@ -39,9 +39,8 @@ export type ToolLabelArtifact = { displayName?: string; detail?: string };
*
* The one property that matters for performance is stated as a test, not a
* comment: converting the transcript while a token streams must not re-convert
- * the settled messages above the live tail. `ChatThreadView.renderPerf.test.tsx`
- * pins the equivalent property for the render tree; `assistantUiMessages.test.ts`
- * pins it for this projection.
+ * the settled messages above the live tail. `assistantUiMessages.test.ts` pins
+ * it for this projection.
*/
type ConversionCacheEntry = {
diff --git a/app/src/types/derivedTranscript.ts b/app/src/types/derivedTranscript.ts
index 3df032b9af..a54ef5b6fc 100644
--- a/app/src/types/derivedTranscript.ts
+++ b/app/src/types/derivedTranscript.ts
@@ -5,8 +5,8 @@
*
* The Rust core projects the append-only `session_raw/*.jsonl` source of truth
* into typed **display items** in the frontend's chat vocabulary. Phase C maps
- * these onto the existing settled-turn renderers (`PastTurnInsights` /
- * `ProcessingTranscriptView` / assistant-ui tool and delegation cards)
+ * these onto the existing settled-turn renderers (`ProcessingTranscriptView`
+ * / assistant-ui tool and delegation cards)
* via `features/conversations/derived/mapDisplayItems.ts`.
*
* Serde is camelCase on the wire, so every field here is camelCase and mirrors