mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
fix: prevent ghost border for AskUserDialog (#17788)
This commit is contained in:
@@ -663,6 +663,31 @@ describe('<ToolGroupMessage />', () => {
|
||||
expect(output).toMatchSnapshot();
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('renders nothing when only tool is in-progress AskUser with borderBottom=false', () => {
|
||||
// AskUser tools in progress are rendered by AskUserDialog, not ToolGroupMessage.
|
||||
// When AskUser is the only tool and borderBottom=false (no border to close),
|
||||
// the component should render nothing.
|
||||
const toolCalls = [
|
||||
createToolCall({
|
||||
callId: 'ask-user-tool',
|
||||
name: 'Ask User',
|
||||
status: ToolCallStatus.Executing,
|
||||
}),
|
||||
];
|
||||
|
||||
const { lastFrame, unmount } = renderWithProviders(
|
||||
<ToolGroupMessage
|
||||
{...baseProps}
|
||||
toolCalls={toolCalls}
|
||||
borderBottom={false}
|
||||
/>,
|
||||
{ config: baseMockConfig },
|
||||
);
|
||||
// AskUser tools in progress are rendered by AskUserDialog, so we expect nothing.
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Ask User Filtering', () => {
|
||||
|
||||
@@ -116,13 +116,11 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
[toolCalls, isEventDriven],
|
||||
);
|
||||
|
||||
// If all tools are hidden (e.g. group only contains confirming or pending tools),
|
||||
// render nothing in the history log unless we have a border override.
|
||||
if (
|
||||
visibleToolCalls.length === 0 &&
|
||||
borderTopOverride === undefined &&
|
||||
borderBottomOverride === undefined
|
||||
) {
|
||||
// If all tools are filtered out (e.g., in-progress AskUser tools, confirming tools
|
||||
// in event-driven mode), only render if we need to close a border from previous
|
||||
// tool groups. borderBottomOverride=true means we must render the closing border;
|
||||
// undefined or false means there's nothing to display.
|
||||
if (visibleToolCalls.length === 0 && borderBottomOverride !== true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ exports[`<ToolGroupMessage /> > Confirmation Handling > shows confirmation dialo
|
||||
|
||||
exports[`<ToolGroupMessage /> > Event-Driven Scheduler > hides confirming tools when event-driven scheduler is enabled 1`] = `""`;
|
||||
|
||||
exports[`<ToolGroupMessage /> > Event-Driven Scheduler > renders nothing when only tool is in-progress AskUser with borderBottom=false 1`] = `""`;
|
||||
|
||||
exports[`<ToolGroupMessage /> > Event-Driven Scheduler > shows only successful tools when mixed with confirming tools 1`] = `
|
||||
"╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ✓ success-tool A tool for testing │
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
debugLogger,
|
||||
runInDevTraceSpan,
|
||||
EDIT_TOOL_NAMES,
|
||||
ASK_USER_TOOL_NAME,
|
||||
processRestorableToolCalls,
|
||||
recordToolCallInteractions,
|
||||
ToolErrorType,
|
||||
@@ -367,6 +368,14 @@ export const useGeminiStream = (
|
||||
const isEventDriven = config.isEventDrivenSchedulerEnabled();
|
||||
const anyVisibleInHistory = pushedToolCallIds.size > 0;
|
||||
const anyVisibleInPending = remainingTools.some((tc) => {
|
||||
// AskUser tools are rendered by AskUserDialog, not ToolGroupMessage
|
||||
const isInProgress =
|
||||
tc.status !== 'success' &&
|
||||
tc.status !== 'error' &&
|
||||
tc.status !== 'cancelled';
|
||||
if (tc.request.name === ASK_USER_TOOL_NAME && isInProgress) {
|
||||
return false;
|
||||
}
|
||||
if (!isEventDriven) return true;
|
||||
return (
|
||||
tc.status !== 'scheduled' &&
|
||||
|
||||
Reference in New Issue
Block a user