diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
index 108f5c5b74..ee1e15763e 100644
--- a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
+++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
@@ -243,6 +243,34 @@ describe('', () => {
expect(lastFrame()).toMatchSnapshot();
unmount();
});
+
+ it('renders two tool groups where only the last line of the previous group is visible', () => {
+ const toolCalls1 = [
+ createToolCall({
+ callId: '1',
+ name: 'tool-1',
+ description: 'Description 1',
+ resultDisplay: 'line1\nline2\nline3\nline4\nline5',
+ }),
+ ];
+ const toolCalls2 = [
+ createToolCall({
+ callId: '2',
+ name: 'tool-2',
+ description: 'Description 2',
+ resultDisplay: 'line1',
+ }),
+ ];
+
+ const { lastFrame, unmount } = renderWithProviders(
+
+
+
+ ,
+ );
+ expect(lastFrame()).toMatchSnapshot();
+ unmount();
+ });
});
describe('Border Color Logic', () => {
diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
index e44517e081..9cf83e65e5 100644
--- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
+++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
@@ -103,7 +103,6 @@ export const ToolGroupMessage: React.FC = ({
{toolCalls.map((tool, index) => {
const isConfirming = toolAwaitingApproval?.callId === tool.callId;
const isFirst = index === 0;
- const isLast = index === toolCalls.length - 1;
return (
= ({
borderLeft={true}
borderRight={true}
borderTop={false}
- borderBottom={isLast}
+ borderBottom={false}
borderColor={borderColor}
borderDimColor={borderDimColor}
flexDirection="column"
@@ -161,6 +160,25 @@ export const ToolGroupMessage: React.FC = ({
);
})}
+ {
+ /*
+ We have to keep the bottom border separate so it doesn't get
+ drawn over by the sticky header directly inside it.
+ */
+ toolCalls.length > 0 && (
+
+ )
+ }
);
};
diff --git a/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap b/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap
index 057d6e52be..038c60e1f9 100644
--- a/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap
+++ b/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap
@@ -136,6 +136,15 @@ exports[` > Golden Snapshots > renders tool call with output
╰──────────────────────────────────────────────────────────────────────────────╯"
`;
+exports[` > Golden Snapshots > renders two tool groups where only the last line of the previous group is visible 1`] = `
+"╰──────────────────────────────────────────────────────────────────────────────╯
+╭──────────────────────────────────────────────────────────────────────────────╮
+│ ✓ tool-2 Description 2 │
+│ │ ▄
+│ line1 │ █
+╰──────────────────────────────────────────────────────────────────────────────╯ █"
+`;
+
exports[` > Golden Snapshots > renders when not focused 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ ✓ test-tool A tool for testing │