Skip to content

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

fix(chat): render the delegation card's report as markdown

M3gA-Mindb6570fb5e81d
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index e7f3a29d1c..f45886b08c 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -84,7 +84,7 @@ describe('SubagentTaskCard', () => {
);
});
- it('keeps completed output and ignores legacy worktree fields', () => {
+ it('keeps completed output and ignores legacy worktree fields', async () => {
const legacyActivity: SubagentActivity & {
worktreePath: string;
changedFiles: string[];
@@ -116,11 +116,43 @@ describe('SubagentTaskCard', () => {
'data-status',
'success'
);
- expect(screen.getByText('Research is complete.')).toBeInTheDocument();
+ expect(await screen.findByText('Research is complete.')).toBeInTheDocument();
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 4670851429..05f93f2c11 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.tsx
@@ -19,12 +19,17 @@
* (`elements/task-card.tsx`) + `utils/task.ts` pieces instead, with those
* actions supplied explicitly.
*/
-import { type ToolCallMessagePartComponent, useAui } from '@assistant-ui/react';
+import {
+ TextMessagePartProvider,
+ 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';
@@ -245,9 +250,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`).
const resultNode =
resolved.output && (state === 'done' || state === 'failed') ? (
- <p className="m-0 whitespace-pre-wrap">{resolved.output}</p>
+ <TextMessagePartProvider text={resolved.output} isRunning={false}>
+ <MarkdownText />
+ </TextMessagePartProvider>
) : undefined;
// `messages` (the part's own nested transcript, built by `subagentMessages`)