mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
fix: prevent ghost border for AskUserDialog (#17788)
This commit is contained in:
@@ -663,6 +663,31 @@ describe('<ToolGroupMessage />', () => {
|
|||||||
expect(output).toMatchSnapshot();
|
expect(output).toMatchSnapshot();
|
||||||
unmount();
|
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', () => {
|
describe('Ask User Filtering', () => {
|
||||||
|
|||||||
@@ -116,13 +116,11 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
[toolCalls, isEventDriven],
|
[toolCalls, isEventDriven],
|
||||||
);
|
);
|
||||||
|
|
||||||
// If all tools are hidden (e.g. group only contains confirming or pending tools),
|
// If all tools are filtered out (e.g., in-progress AskUser tools, confirming tools
|
||||||
// render nothing in the history log unless we have a border override.
|
// in event-driven mode), only render if we need to close a border from previous
|
||||||
if (
|
// tool groups. borderBottomOverride=true means we must render the closing border;
|
||||||
visibleToolCalls.length === 0 &&
|
// undefined or false means there's nothing to display.
|
||||||
borderTopOverride === undefined &&
|
if (visibleToolCalls.length === 0 && borderBottomOverride !== true) {
|
||||||
borderBottomOverride === undefined
|
|
||||||
) {
|
|
||||||
return null;
|
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 > 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`] = `
|
exports[`<ToolGroupMessage /> > Event-Driven Scheduler > shows only successful tools when mixed with confirming tools 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────╮
|
"╭──────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ ✓ success-tool A tool for testing │
|
│ ✓ success-tool A tool for testing │
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
debugLogger,
|
debugLogger,
|
||||||
runInDevTraceSpan,
|
runInDevTraceSpan,
|
||||||
EDIT_TOOL_NAMES,
|
EDIT_TOOL_NAMES,
|
||||||
|
ASK_USER_TOOL_NAME,
|
||||||
processRestorableToolCalls,
|
processRestorableToolCalls,
|
||||||
recordToolCallInteractions,
|
recordToolCallInteractions,
|
||||||
ToolErrorType,
|
ToolErrorType,
|
||||||
@@ -367,6 +368,14 @@ export const useGeminiStream = (
|
|||||||
const isEventDriven = config.isEventDrivenSchedulerEnabled();
|
const isEventDriven = config.isEventDrivenSchedulerEnabled();
|
||||||
const anyVisibleInHistory = pushedToolCallIds.size > 0;
|
const anyVisibleInHistory = pushedToolCallIds.size > 0;
|
||||||
const anyVisibleInPending = remainingTools.some((tc) => {
|
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;
|
if (!isEventDriven) return true;
|
||||||
return (
|
return (
|
||||||
tc.status !== 'scheduled' &&
|
tc.status !== 'scheduled' &&
|
||||||
|
|||||||
Reference in New Issue
Block a user