Skip to content

The agent that grows with you

fix(desktop): log lines in Command Center and the MCP editor wrap again

emozilla394793b4d82a
diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.overflow.test.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.overflow.test.tsx
index 26e1a85be55..9c862a30bf0 100644
--- a/apps/desktop/src/components/assistant-ui/markdown-text.overflow.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/markdown-text.overflow.test.tsx
@@ -104,10 +104,13 @@ describe('MarkdownTextContent overflow containment', () => {
const codeCard = container.querySelector('[data-slot="code-card"]')!
// The card's overlay scroller (ExpandableBlock's inner div).
const codeScroller = codeCard.querySelector('.scrollbar-overlay')!
+ // The fence's own <pre> takes its longest line's width, so the scroller above scrolls it.
+ const fencePre = codeScroller.querySelector('pre')!
const tableWrapper = container.querySelector('.aui-md-table')!
expect(markdown.className).toContain('min-w-0')
expect(codeScroller.className).toContain('overflow-x-auto')
+ expect(fencePre.className).toContain('min-w-max')
expect(codeCard.textContent).toContain(longToken)
expect(tableWrapper.className).toContain('overflow-x-auto')
})
diff --git a/apps/desktop/src/components/chat/code-card.tsx b/apps/desktop/src/components/chat/code-card.tsx
index 00bd0d1507c..880413801a2 100644
--- a/apps/desktop/src/components/chat/code-card.tsx
+++ b/apps/desktop/src/components/chat/code-card.tsx
@@ -36,7 +36,7 @@ function CodeCardBody({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
className={cn(
- 'font-mono text-[length:calc(0.7rem*var(--conversation-text-scale,1))] leading-relaxed text-foreground/90 [&_pre]:m-0 [&_pre]:min-w-max [&_pre]:overflow-x-auto [&_pre]:scrollbar-overlay [&_pre]:bg-transparent! [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:font-mono [&_pre]:leading-relaxed',
+ 'font-mono text-[length:calc(0.7rem*var(--conversation-text-scale,1))] leading-relaxed text-foreground/90 [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:scrollbar-overlay [&_pre]:bg-transparent! [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:font-mono [&_pre]:leading-relaxed',
className
)}
data-slot="code-card-body"
diff --git a/apps/desktop/src/components/chat/log-tail.test.tsx b/apps/desktop/src/components/chat/log-tail.test.tsx
index 6d00a775c64..f87aebd0fd4 100644
--- a/apps/desktop/src/components/chat/log-tail.test.tsx
+++ b/apps/desktop/src/components/chat/log-tail.test.tsx
@@ -71,3 +71,18 @@ describe('LogTail search', () => {
expect(scroller.scrollTop).toBe(900)
})
})
+
+describe('LogTail layout', () => {
+ // Command Center and the MCP editor show logs in this pane: a long line wraps at the pane's
+ // width. Nothing may size the log's <pre> to its longest line, which would turn every line into
+ // one long row behind a horizontal scrollbar.
+ it('wraps long lines instead of sizing the log to its longest line', () => {
+ const { container } = render(<Harness lines={[`ERROR ${'x'.repeat(400)}`]} />)
+ const pre = container.querySelector('pre')!
+ const body = pre.closest('[data-slot="code-card-body"]')!
+
+ expect(pre.className).toContain('whitespace-pre-wrap')
+ expect(pre.className).not.toContain('min-w-max')
+ expect(body.className).not.toContain('min-w-max')
+ })
+})
diff --git a/apps/desktop/src/components/chat/shiki-highlighter.tsx b/apps/desktop/src/components/chat/shiki-highlighter.tsx
index 2fad07a0e80..acaa4b32216 100644
--- a/apps/desktop/src/components/chat/shiki-highlighter.tsx
+++ b/apps/desktop/src/components/chat/shiki-highlighter.tsx
@@ -198,7 +198,8 @@ export const SyntaxHighlighter: FC<HermesSyntaxHighlighterProps> = ({
/>
<CodeCardBody className="[&_pre]:px-3 [&_pre]:py-2.5">
<ExpandableBlock>
- <Pre className="aui-shiki m-0 bg-transparent p-0">
+ {/* Sized to the longest line, so ExpandableBlock scrolls it sideways and draws its fade. */}
+ <Pre className="aui-shiki m-0 min-w-max bg-transparent p-0">
{plain ? (
<PlainCode code={content} />
) : (