Skip to content

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

test(chat): cover collapsed delegation consumers

Steven Enamakel9d7d59558c04
diff --git a/app/src/features/conversations/components/PastTurnInsights.test.tsx b/app/src/features/conversations/components/PastTurnInsights.test.tsx
index ef0314b83b..31a5bb47cd 100644
--- a/app/src/features/conversations/components/PastTurnInsights.test.tsx
+++ b/app/src/features/conversations/components/PastTurnInsights.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen } from '@testing-library/react';
+import { fireEvent, render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { describe, expect, it } from 'vitest';
@@ -53,6 +53,7 @@ describe('PastTurnInsights', () => {
renderInStore(<PastTurnInsights entries={entries} transcript={transcript} />);
const subagents = screen.getByTestId('past-turn-subagents');
+ fireEvent.click(screen.getByTestId('assistant-ui-subagent-call').querySelector('button')!);
expect(subagents.textContent).toContain('child reasoning trail');
});
diff --git a/app/src/features/conversations/components/__tests__/AgentProcessSourcePanel.test.tsx b/app/src/features/conversations/components/__tests__/AgentProcessSourcePanel.test.tsx
index 9208cd39f5..fd0f5fd301 100644
--- a/app/src/features/conversations/components/__tests__/AgentProcessSourcePanel.test.tsx
+++ b/app/src/features/conversations/components/__tests__/AgentProcessSourcePanel.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen } from '@testing-library/react';
+import { fireEvent, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Provider } from 'react-redux';
import { describe, expect, it, vi } from 'vitest';
@@ -11,6 +11,10 @@ function renderPanel(ui: React.ReactNode) {
return render(<Provider store={store}>{ui}</Provider>);
}
+function openFirstSubagent(): void {
+ fireEvent.click(screen.getAllByTestId('assistant-ui-subagent-call')[0].querySelector('button')!);
+}
+
const fetchEntry = (id: string, url: string): ToolTimelineEntry => ({
id,
name: 'web_fetch',
@@ -129,7 +133,8 @@ describe('AgentProcessSourcePanel', () => {
onClose={() => {}}
/>
);
- // The subagent activity renders, but with no onView → no button.
+ // The assistant-ui delegation is collapsed until the reviewer opens it.
+ openFirstSubagent();
expect(screen.getByTestId('subagent-activity')).toBeInTheDocument();
expect(screen.queryByTestId('subagent-view-processing')).toBeNull();
});
@@ -187,6 +192,7 @@ describe('AgentProcessSourcePanel', () => {
// …and the sub-agent's full activity (its thoughts) shows in the deep-dive,
// with no redundant "view full processing" button (no onView).
expect(screen.getByTestId('agent-source-subagent')).toBeInTheDocument();
+ openFirstSubagent();
const activity = screen.getByTestId('subagent-activity');
expect(activity.textContent).toContain('planning the search');
expect(screen.queryByTestId('subagent-view-processing')).toBeNull();
@@ -222,6 +228,7 @@ describe('AgentProcessSourcePanel', () => {
// Header shows the step's label, not the generic title.
expect(screen.getByText('Researching')).toBeInTheDocument();
// Only the scoped step's activity renders…
+ openFirstSubagent();
expect(screen.getByTestId('subagent-activity').textContent).toContain('scoped thought');
// …and the whole-run transcript / other steps do NOT.
expect(screen.queryByTestId('processing-transcript')).toBeNull();
diff --git a/app/src/features/conversations/derived/derivedRestore.render.test.tsx b/app/src/features/conversations/derived/derivedRestore.render.test.tsx
index 02490e8ec1..af7a457a91 100644
--- a/app/src/features/conversations/derived/derivedRestore.render.test.tsx
+++ b/app/src/features/conversations/derived/derivedRestore.render.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen } from '@testing-library/react';
+import { fireEvent, render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { describe, expect, it } from 'vitest';
@@ -73,6 +73,7 @@ describe('derived transcript restore (mapper → PastTurnInsights)', () => {
expect(screen.getAllByTestId('processing-tool-row').length).toBeGreaterThan(0);
// The sub-agent's own reasoning trail renders beneath.
const subagents = screen.getByTestId('past-turn-subagents');
+ fireEvent.click(screen.getByTestId('assistant-ui-subagent-call').querySelector('button')!);
expect(subagents.textContent).toContain('child reasoning trail');
});
});
diff --git a/app/src/providers/useOpenHumanExternalStore.ts b/app/src/providers/useOpenHumanExternalStore.ts
index aab1a80f00..92c88f80f4 100644
--- a/app/src/providers/useOpenHumanExternalStore.ts
+++ b/app/src/providers/useOpenHumanExternalStore.ts
@@ -112,7 +112,7 @@ export function useOpenHumanExternalStore(threadId: string | null) {
? (state.chatRuntime.processingByThread?.[threadId] ?? EMPTY_TRANSCRIPT)
: EMPTY_TRANSCRIPT
);
- const settledRevision = `${messages.at(-1)?.id ?? ''}:${messages.at(-1)?.content.length ?? 0}:${lifecycle ?? ''}`;
+ const settledRevision = `${messages.at(-1)?.id ?? ''}:${messages.at(-1)?.content?.length ?? 0}:${lifecycle ?? ''}`;
const coreTranscript = useCoreTranscriptProjection(
threadId,
settledRevision,