Skip to content

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

fix(chat): hide a finished delegation card's report instead

M3gA-Mind8390d7a58dc3
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index f45886b08c..cfe9fc7baa 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -70,7 +70,12 @@ describe('SubagentTaskCard', () => {
toolCallId="sub-1"
args={{} as never}
argsText="{}"
- result={{ status: 'error', activity: { ...activity, status: 'failed' } } as never}
+ result={
+ {
+ status: 'error',
+ activity: { ...activity, status: 'failed', output: 'Validation failed.' },
+ } as never
+ }
status={{ type: 'complete' }}
addResult={() => {}}
resume={() => {}}
@@ -82,9 +87,11 @@ describe('SubagentTaskCard', () => {
'data-status',
'failed'
);
+ // Unlike a completed report, a failure's output is kept on the card.
+ expect(screen.getByText('Validation failed.')).toBeInTheDocument();
});
- it('keeps completed output and ignores legacy worktree fields', async () => {
+ it('hides a completed report and ignores legacy worktree fields', () => {
const legacyActivity: SubagentActivity & {
worktreePath: string;
changedFiles: string[];
@@ -116,43 +123,20 @@ describe('SubagentTaskCard', () => {
'data-status',
'success'
);
- expect(await screen.findByText('Research is complete.')).toBeInTheDocument();
+ expect(screen.getByText('Delegated to Researcher')).toBeInTheDocument();
+ expect(screen.queryByText('Research is complete.')).toBeNull();
+ expect(
+ screen.getByTestId('assistant-ui-subagent-call').querySelector('[data-slot="task-card-result"]')
+ ).toBeNull();
+ // The transcript stays one click away.
+ expect(screen.getByRole('button', { name: /Delegated to Researcher/i })).toHaveAttribute(
+ 'aria-expanded',
+ 'false'
+ );
expect(screen.queryByTestId('worktree-actions')).toBeNull();
expect(screen.queryByText(/worker/)).toBeNull();
});
- it('renders the completed report as markdown, not literal syntax', async () => {
- render(
- <SubagentTaskCard
- type="tool-call"
- toolName="task"
- toolCallId="sub-1"
- args={{} as never}
- argsText="{}"
- result={
- {
- status: 'complete',
- activity: {
- ...activity,
- status: 'success',
- output: '**Answer:** saved the flow.\n\n- trigger updated\n- step 2 shortened',
- },
- } as never
- }
- status={{ type: 'complete' }}
- addResult={() => {}}
- resume={() => {}}
- respondToApproval={async () => {}}
- />
- );
-
- const strong = await screen.findByText('Answer:');
- expect(strong.tagName).toBe('STRONG');
- const items = screen.getAllByRole('listitem').map(li => li.textContent);
- expect(items).toEqual(['trigger updated', 'step 2 shortened']);
- expect(screen.queryByText(/\*\*Answer:\*\*/)).toBeNull();
- });
-
it('renders the awaiting-user reply box and lets the answer through the composer path', async () => {
render(
<SubagentTaskCard
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.tsx b/app/src/features/conversations/aui/SubagentTaskCard.tsx
index 05f93f2c11..ce0f0ba9a9 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.tsx
@@ -19,17 +19,12 @@
* (`elements/task-card.tsx`) + `utils/task.ts` pieces instead, with those
* actions supplied explicitly.
*/
-import {
- TextMessagePartProvider,
- type ToolCallMessagePartComponent,
- useAui,
-} from '@assistant-ui/react';
+import { type ToolCallMessagePartComponent, useAui } from '@assistant-ui/react';
import { useCallback, useState } from 'react';
import { TaskCard, type TaskCardState } from '../../../components/assistant-ui/elements/task-card';
import { TaskTranscript } from '../../../components/assistant-ui/elements/task-card.aui';
import { useDisclosure } from '../../../components/assistant-ui/lib/useDisclosure';
-import { MarkdownText } from '../../../components/assistant-ui/markdown-text';
import { formatElapsed } from '../../../components/assistant-ui/utils/task';
import { Button } from '../../../components/ui';
import { useT } from '../../../lib/i18n/I18nContext';
@@ -250,13 +245,13 @@ export const SubagentTaskCard: ToolCallMessagePartComponent = ({
</div>
) : undefined;
- // The child's report is markdown, like any agent reply: render it with the
- // chat's own renderer (the same provider pattern as `reasoning-panel.tsx`).
+ // A finished delegation's report is not shown: the parent's own reply
+ // presents the same result right after, so the card stays a header row
+ // (its transcript is still one click away). A failure keeps its output,
+ // which nothing else in the thread repeats.
const resultNode =
- resolved.output && (state === 'done' || state === 'failed') ? (
- <TextMessagePartProvider text={resolved.output} isRunning={false}>
- <MarkdownText />
- </TextMessagePartProvider>
+ resolved.output && state === 'failed' ? (
+ <p className="m-0 whitespace-pre-wrap">{resolved.output}</p>
) : undefined;
// `messages` (the part's own nested transcript, built by `subagentMessages`)