The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep background reports behind bounded disclosures
brooklyn!258b351fc150
diff --git a/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx b/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsxindex 14ea92d7ac2..5ee1206fa66 100644--- a/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/system-message.test.tsx@@ -1,5 +1,5 @@import { AssistantRuntimeProvider, type ThreadMessage, useExternalStoreRuntime } from '@assistant-ui/react'-import { cleanup, render } from '@testing-library/react'+import { cleanup, fireEvent, render } from '@testing-library/react'import { afterEach, describe, expect, it } from 'vitest'import { $displayTimestamps } from '@/store/display-timestamps'@@ -14,13 +14,13 @@ $displayTimestamps.set(true)const timestamp = new Date('2026-05-01T00:00:00.000Z')stubThreadEnvironment()-function Harness({ text }: { text: string }) {+function Harness({ text, asyncResult }: { text: string; asyncResult?: string }) {const message = {id: 'system-1',role: 'system',content: [{ type: 'text', text }],createdAt: timestamp,- metadata: { custom: { timelineTimestamp: timestamp.getTime() / 1000 } }+ metadata: { custom: { timelineTimestamp: timestamp.getTime() / 1000, asyncResult } }} as unknown as ThreadMessageconst runtime = useExternalStoreRuntime<ThreadMessage>({@@ -46,6 +46,26 @@ function expectTimestampSeparated(container: HTMLElement, precedingText: string)afterEach(cleanup)+describe('background report disclosure', () => {+ it('keeps result bodies out of the transcript until opened and removes them when collapsed', () => {+ const report = '{"blockers":[{"title":"Local-model readiness uses the wrong endpoint"}]}'+ const { container, getByRole } = render(<Harness asyncResult={report} text="2 background agents finished" />)++ expect(container.textContent).not.toContain('blockers')+ expectTimestampSeparated(container, '2 background agents finished')+ const toggle = getByRole('button', { name: '2 background agents finished' })+ expect(toggle.getAttribute('aria-expanded')).toBe('false')++ fireEvent.click(toggle)+ expect(toggle.getAttribute('aria-expanded')).toBe('true')+ expect(container.textContent).toContain(report)++ fireEvent.click(toggle)+ expect(toggle.getAttribute('aria-expanded')).toBe('false')+ expect(container.textContent).not.toContain('blockers')+ })+})+describe('system message timestamp text separation', () => {it('separates an ordinary system row timestamp in accessible and copied text', () => {const { container } = render(<Harness text="Review saved." />)diff --git a/apps/desktop/src/components/assistant-ui/thread/system-message.tsx b/apps/desktop/src/components/assistant-ui/thread/system-message.tsxindex 08a919e9de2..1bdf6275486 100644--- a/apps/desktop/src/components/assistant-ui/thread/system-message.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/system-message.tsx@@ -1,10 +1,10 @@import { MessagePrimitive, useAuiState } from '@assistant-ui/react'-import { type FC } from 'react'+import { type FC, useState } from 'react'import { MarkdownTextContent } from '@/components/assistant-ui/markdown-text'import { messageContentText } from '@/components/assistant-ui/thread/content'import { MessageTimelineTimestamp } from '@/components/assistant-ui/thread/timeline-timestamp'-import { SCAFFOLD_LABEL_CLASS } from '@/components/chat/scaffold-row'+import { SCAFFOLD_LABEL_CLASS, ScaffoldRow } from '@/components/chat/scaffold-row'import { Codicon } from '@/components/ui/codicon'import { ToolIcon } from '@/components/ui/tool-icon'import { LinkifiedText } from '@/lib/external-link'@@ -17,6 +17,7 @@ const REVIEW_NOTE_RE = /^review:(?<label>[^:\n]+):?\s*(?<detail>[\s\S]*)$/export const SystemMessage: FC = () => {const text = useAuiState(s => messageContentText(s.message.content))const asyncResult = useAuiState(s => s.message.metadata.custom?.asyncResult)+ const [reportOpen, setReportOpen] = useState(false)if (!text) {return null@@ -25,14 +26,29 @@ export const SystemMessage: FC = () => {if (typeof asyncResult === 'string' && asyncResult) {return (<MessagePrimitive.Root- className="flex w-full min-w-0 flex-col gap-2 self-start py-1"+ className="flex w-full min-w-0 flex-col self-start py-1"data-role="system"data-slot="aui_system-message-root">- <div className="text-[0.6875rem] leading-5 text-muted-foreground/55">- {text} <MessageTimelineTimestamp />+ <div data-conversation-scaffold="">+ <ScaffoldRow+ onToggle={() => setReportOpen(!reportOpen)}+ open={reportOpen}+ trailing={+ <>+ {' '}+ <MessageTimelineTimestamp />+ </>+ }+ >+ <span className={SCAFFOLD_LABEL_CLASS}>{text}</span>+ </ScaffoldRow></div>- <MarkdownTextContent isRunning={false} text={asyncResult} />+ {reportOpen && (+ <div className="mt-2 max-h-80 min-w-0 max-w-full overflow-auto overscroll-contain wrap-anywhere">+ <MarkdownTextContent isRunning={false} text={asyncResult} />+ </div>+ )}</MessagePrimitive.Root>)}