mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 21:32:56 -07:00
fix: Adjust ToolGroupMessage filtering to hide Confirming and show Canceled tool calls. (#22230)
This commit is contained in:
-4
@@ -13,10 +13,6 @@ Tips for getting started:
|
|||||||
2. /help for more information
|
2. /help for more information
|
||||||
3. Ask coding questions, edit code or run commands
|
3. Ask coding questions, edit code or run commands
|
||||||
4. Be specific for the best results
|
4. Be specific for the best results
|
||||||
╭──────────────────────────────────────────────────────────────────────────╮
|
|
||||||
│ ? confirming_tool Confirming tool description │
|
|
||||||
│ │
|
|
||||||
╰──────────────────────────────────────────────────────────────────────────╯
|
|
||||||
|
|
||||||
Action Required (was prompted):
|
Action Required (was prompted):
|
||||||
|
|
||||||
|
|||||||
@@ -118,10 +118,30 @@ describe('<ToolGroupMessage />', () => {
|
|||||||
{ config: baseMockConfig, settings: fullVerbositySettings },
|
{ config: baseMockConfig, settings: fullVerbositySettings },
|
||||||
);
|
);
|
||||||
|
|
||||||
// Should now render confirming tools
|
// Should now hide confirming tools (to avoid duplication with Global Queue)
|
||||||
|
await waitUntilReady();
|
||||||
|
expect(lastFrame({ allowEmpty: true })).toBe('');
|
||||||
|
unmount();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders canceled tool calls', async () => {
|
||||||
|
const toolCalls = [
|
||||||
|
createToolCall({
|
||||||
|
callId: 'canceled-tool',
|
||||||
|
name: 'canceled-tool',
|
||||||
|
status: CoreToolCallStatus.Cancelled,
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
const item = createItem(toolCalls);
|
||||||
|
|
||||||
|
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
|
||||||
|
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
|
||||||
|
{ config: baseMockConfig, settings: fullVerbositySettings },
|
||||||
|
);
|
||||||
|
|
||||||
await waitUntilReady();
|
await waitUntilReady();
|
||||||
const output = lastFrame();
|
const output = lastFrame();
|
||||||
expect(output).toContain('test-tool');
|
expect(output).toMatchSnapshot('canceled_tool');
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -842,7 +862,7 @@ describe('<ToolGroupMessage />', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await waitUntilReady();
|
await waitUntilReady();
|
||||||
expect(lastFrame({ allowEmpty: true })).not.toBe('');
|
expect(lastFrame({ allowEmpty: true })).toBe('');
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -110,11 +110,12 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
() =>
|
() =>
|
||||||
toolCalls.filter((t) => {
|
toolCalls.filter((t) => {
|
||||||
const displayStatus = mapCoreStatusToDisplayStatus(t.status);
|
const displayStatus = mapCoreStatusToDisplayStatus(t.status);
|
||||||
// We used to filter out Pending and Confirming statuses here to avoid
|
// We hide Confirming tools from the history log because they are
|
||||||
// duplication with the Global Queue, but this causes tools to appear to
|
// currently being rendered in the interactive ToolConfirmationQueue.
|
||||||
// "vanish" from the context after approval.
|
// We show everything else, including Pending (waiting to run) and
|
||||||
// We now allow them to be visible here as well.
|
// Canceled (rejected by user), to ensure the history is complete
|
||||||
return displayStatus !== ToolCallStatus.Canceled;
|
// and to avoid tools "vanishing" after approval.
|
||||||
|
return displayStatus !== ToolCallStatus.Confirming;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
[toolCalls],
|
[toolCalls],
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ exports[`<ToolGroupMessage /> > Border Color Logic > uses yellow border for shel
|
|||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`<ToolGroupMessage /> > Golden Snapshots > renders canceled tool calls > canceled_tool 1`] = `
|
||||||
|
"╭──────────────────────────────────────────────────────────────────────────╮
|
||||||
|
│ - canceled-tool A tool for testing │
|
||||||
|
│ │
|
||||||
|
│ Test result │
|
||||||
|
╰──────────────────────────────────────────────────────────────────────────╯
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`<ToolGroupMessage /> > Golden Snapshots > renders empty tool calls array 1`] = `""`;
|
exports[`<ToolGroupMessage /> > Golden Snapshots > renders empty tool calls array 1`] = `""`;
|
||||||
|
|
||||||
exports[`<ToolGroupMessage /> > Golden Snapshots > renders header when scrolled 1`] = `
|
exports[`<ToolGroupMessage /> > Golden Snapshots > renders header when scrolled 1`] = `
|
||||||
|
|||||||
Reference in New Issue
Block a user