Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(block-agent): let session errors expand to show the full message (#7629)

Wolf Mermelsteind663e5c31bb0
diff --git a/apps/web/src/features/block-agent/component/AgentMessage.test.tsx b/apps/web/src/features/block-agent/component/AgentMessage.test.tsx
index bf5c294bef..d65dbf1651 100644
--- a/apps/web/src/features/block-agent/component/AgentMessage.test.tsx
+++ b/apps/web/src/features/block-agent/component/AgentMessage.test.tsx
@@ -98,8 +98,10 @@ vi.mock('../ui', () => ({
WorkingLine: (props: { label?: string }) => (
<div data-testid="working">{props.label}</div>
),
- ActionLine: (props: { label: string }) => (
- <div data-testid="action-line">{props.label}</div>
+ ActionLine: (props: { label: string; detail?: string }) => (
+ <div data-testid="action-line" data-detail={props.detail}>
+ {props.label}
+ </div>
),
FailureNoticeCard: (props: {
notice: { title: string; body: string; link?: { url: string } | null };
@@ -750,7 +752,7 @@ describe('Message failed turns', () => {
inFlight={false}
/>
));
- expect(view.getByTestId('action-line').textContent).toContain(
+ expect(view.getByTestId('action-line').dataset.detail).toBe(
'Internal error: something broke'
);
expect(view.queryByTestId('failure-notice')).toBeNull();
diff --git a/apps/web/src/features/block-agent/component/AgentMessage.tsx b/apps/web/src/features/block-agent/component/AgentMessage.tsx
index dd165e8935..7f973271f4 100644
--- a/apps/web/src/features/block-agent/component/AgentMessage.tsx
+++ b/apps/web/src/features/block-agent/component/AgentMessage.tsx
@@ -362,7 +362,7 @@ export function Message(props: {
when={failed().notice}
fallback={
<ActionLine
- label={`${TURN_FAILED_LABEL} — ${failed().message}`}
+ label={TURN_FAILED_LABEL}
detail={failed().message}
failed
/>
diff --git a/apps/web/src/features/block-agent/debug/Gallery.tsx b/apps/web/src/features/block-agent/debug/Gallery.tsx
index 92e73b6d87..37cfe03c3e 100644
--- a/apps/web/src/features/block-agent/debug/Gallery.tsx
+++ b/apps/web/src/features/block-agent/debug/Gallery.tsx
@@ -1149,7 +1149,7 @@ export default function AgentUiGallery() {
detail="no credentials configured for provider openai"
/>
<ActionLine
- label="An error was encountered with your session. Send another message to continue — Internal error: Bad Request: bad request: Authorization header is badly formatted"
+ label="An error was encountered with your session. Send another message to continue"
detail="Internal error: Bad Request: bad request: Authorization header is badly formatted"
failed
/>
diff --git a/apps/web/src/features/block-agent/ui/ActionLine.test.tsx b/apps/web/src/features/block-agent/ui/ActionLine.test.tsx
new file mode 100644
index 0000000000..de3189aa57
--- /dev/null
+++ b/apps/web/src/features/block-agent/ui/ActionLine.test.tsx
@@ -0,0 +1,31 @@
+/** @vitest-environment jsdom */
+
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it } from 'vitest';
+import { ActionLine } from './ActionLine';
+
+afterEach(cleanup);
+
+describe('ActionLine', () => {
+ it('expands to show the full detail when its label is clicked', () => {
+ const detail =
+ 'herdr agent start failed: {"error":{"code":"agent_pane_busy"}}';
+ const view = render(() => (
+ <ActionLine label="Something went wrong" detail={detail} failed />
+ ));
+ const toggle = view.getByRole('button', { name: /Something went wrong/ });
+ expect(view.queryByText(detail)).toBeNull();
+
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute('aria-expanded')).toBe('true');
+ expect(view.getByText(detail)).toBeTruthy();
+
+ fireEvent.click(toggle);
+ expect(view.queryByText(detail)).toBeNull();
+ });
+
+ it('is not a button when there is no detail', () => {
+ const view = render(() => <ActionLine label="Context compacted" />);
+ expect(view.queryByRole('button')).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/block-agent/ui/ActionLine.tsx b/apps/web/src/features/block-agent/ui/ActionLine.tsx
index 65fe6c9860..4851f560b8 100644
--- a/apps/web/src/features/block-agent/ui/ActionLine.tsx
+++ b/apps/web/src/features/block-agent/ui/ActionLine.tsx
@@ -6,8 +6,9 @@
* turns instead of competing with tool cards for attention.
*/
+import CaretRight from '@phosphor/caret-right.svg';
import type { JSX } from 'solid-js';
-import { Show } from 'solid-js';
+import { createSignal, Show } from 'solid-js';
export interface ActionLineProps {
/** What happened, e.g. `Model set to opus`. */
@@ -18,10 +19,10 @@ export interface ActionLineProps {
*/
failed?: boolean;
/**
- * Verbatim detail behind the label — a runtime's error message. Shown on
- * hover rather than inline: the line is punctuation between turns, and an
- * arbitrarily long message would make it the loudest thing in the
- * transcript.
+ * Verbatim detail behind the label — a runtime's error message. Collapsed
+ * behind the label rather than inline: the line is punctuation between
+ * turns, and an arbitrarily long message would make it the loudest thing in
+ * the transcript. Clicking the label expands it.
*/
detail?: string;
/** Optional glyph before the label. */
@@ -29,24 +30,60 @@ export interface ActionLineProps {
}
export function ActionLine(props: ActionLineProps) {
+ const [expanded, setExpanded] = createSignal(false);
+
+ const label = () => (
+ <>
+ <Show when={props.icon}>
+ <span aria-hidden="true" class="flex shrink-0 items-center">
+ {props.icon}
+ </span>
+ </Show>
+ <span class="min-w-0" classList={{ truncate: !expanded() }}>
+ {props.label}
+ </span>
+ </>
+ );
+
return (
<div
- class="flex w-full items-center gap-4 px-4 py-1 text-xs"
+ class="w-full px-4 py-1 text-xs"
classList={{
'text-ink-extra-muted': !props.failed,
'text-failure': props.failed,
}}
>
- <span aria-hidden="true" class="h-px flex-1 bg-edge-muted" />
- <span class="flex min-w-0 items-center gap-1.5" title={props.detail}>
- <Show when={props.icon}>
- <span aria-hidden="true" class="flex shrink-0 items-center">
- {props.icon}
- </span>
+ <div class="flex w-full items-center gap-4">
+ <span aria-hidden="true" class="h-px flex-1 bg-edge-muted" />
+ <Show
+ when={props.detail}
+ fallback={
+ <span class="flex min-w-0 items-center gap-1.5">{label()}</span>
+ }
+ >
+ <button
+ type="button"
+ aria-expanded={expanded()}
+ class="flex min-w-0 items-center gap-1.5 text-left hover:opacity-80"
+ onClick={() => setExpanded((prev) => !prev)}
+ >
+ {label()}
+ <CaretRight
+ aria-hidden="true"
+ class="size-3 shrink-0"
+ classList={{ 'rotate-90': expanded() }}
+ />
+ </button>
</Show>
- <span class="min-w-0 truncate">{props.label}</span>
- </span>
- <span aria-hidden="true" class="h-px flex-1 bg-edge-muted" />
+ <span aria-hidden="true" class="h-px flex-1 bg-edge-muted" />
+ </div>
+ <Show when={expanded() && props.detail}>
+ {(detail) => (
+ <pre class="mt-1.5 max-h-64 overflow-auto rounded-md bg-failure-bg px-3 py-2 font-mono text-[11px] leading-4 whitespace-pre-wrap wrap-break-word select-text">
+ {detail()}
+ </pre>
+ )}
+ </Show>
</div>
);
}