Skip to content

fix(cli): exclude update_topic from confirmation queue count#24945

Open
Abhijit-2592 wants to merge 3 commits intomainfrom
abhijit-2592/topics/remove-tool-from-group
Open

fix(cli): exclude update_topic from confirmation queue count#24945
Abhijit-2592 wants to merge 3 commits intomainfrom
abhijit-2592/topics/remove-tool-from-group

Conversation

@Abhijit-2592
Copy link
Copy Markdown
Contributor

@Abhijit-2592 Abhijit-2592 commented Apr 8, 2026

Summary

This PR centralizes tool visibility logic to fix UI inconsistencies, such as the update_topic tool inflating the confirmation queue count ("X of Y").

Details

The logic that dictates whether a tool call should be visible in the chat history, the active tool group, or the confirmation queue was previously fragmented across the codebase (ToolGroupMessage.tsx, confirmingTool.ts, useGeminiStream.ts).

Specifically, the update_topic tool is an auto-executing background operation that does not require user interaction. Because it was included in the calculation of the tool confirmation queue size in confirmingTool.ts, the UI showed misleading counts (e.g., "1 of 2") when only one actionable tool was actually pending.

This PR introduces a unified tool-visibility utility in the core package that exposes three semantic methods:

  • isRenderedInHistory
  • requiresUserConfirmation
  • isVisibleInToolGroup

This cleanly resolves UI inconsistencies by providing a single source of truth for tool visibility state, removing the need for the UI to manually check against specific tool names like update_topic.

examples

Before

Queue count shows "1 of 2" when an update_topic tool is executing alongside another actionable tool.

After

Queue count accurately shows "1 of 1", excluding background narrative updates.

Related Issues

Fixes #24944

How to Validate

  1. Run npm test -w @google/gemini-cli-core -- src/utils/tool-visibility.test.ts to ensure the core rules are functioning correctly.
  2. Run npm test -w @google/gemini-cli to ensure existing UI tests pass.
  3. Manually verify by triggering a turn with update_topic and another tool; the count should only reflect actionable tools.

Pre-Merge Checklist

[ ] Updated relevant documentation and README (if needed)
[x] Added/updated tests (if needed)
[ ] Noted breaking changes (if any)
[x] Validated on required platforms/methods:
[x] MacOS
[x] npm run

@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner April 8, 2026 18:13
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a UI inconsistency where auto-executing background tools were incorrectly included in the confirmation queue progress indicator. By filtering these specific tools out of the calculation, the user is presented with a more accurate representation of pending actionable tasks.

Highlights

  • Queue Filtering: Implemented a filter to exclude the update_topic tool from the confirmation queue count calculation.
  • UI Accuracy: Ensured the confirmation queue UI displays accurate counts by ignoring non-interactive background operations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Size Change: +1.55 kB (0%)

Total Size: 34 MB

Filename Size Change
./bundle/chunk-FXG4EHUI.js 0 B -3.16 MB (removed) 🏆
./bundle/chunk-JYE63JGT.js 0 B -14.8 MB (removed) 🏆
./bundle/core-2JNSFVSO.js 0 B -45.4 kB (removed) 🏆
./bundle/devtoolsService-WAGPFYEH.js 0 B -28.4 kB (removed) 🏆
./bundle/interactiveCli-L44OUAQV.js 0 B -1.65 MB (removed) 🏆
./bundle/oauth2-provider-ZCCK2HWC.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-6XDANPWK.js 3.16 MB +3.16 MB (new file) 🆕
./bundle/chunk-EBJJAAEH.js 14.8 MB +14.8 MB (new file) 🆕
./bundle/core-XALW6QPR.js 45.6 kB +45.6 kB (new file) 🆕
./bundle/devtoolsService-FRVMGRVX.js 28.4 kB +28.4 kB (new file) 🆕
./bundle/interactiveCli-YWRLRAKT.js 1.65 MB +1.65 MB (new file) 🆕
./bundle/oauth2-provider-5VJLRK64.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./bundle/bundled/third_party/index.js 8 MB
./bundle/chunk-34MYV7JD.js 2.45 kB
./bundle/chunk-5AUYMPVF.js 858 B
./bundle/chunk-5PS3AYFU.js 1.18 kB
./bundle/chunk-664ZODQF.js 124 kB
./bundle/chunk-DAHVX5MI.js 206 kB
./bundle/chunk-IUUIT4SU.js 56.5 kB
./bundle/chunk-OGWWODAT.js 1.96 MB
./bundle/chunk-RJTRUG2J.js 39.8 kB
./bundle/devtools-36NN55EP.js 696 kB
./bundle/dist-T73EYRDX.js 356 B
./bundle/events-XB7DADIJ.js 418 B
./bundle/gemini.js 554 kB
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB
./bundle/memoryDiscovery-JNNGTYL3.js 980 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB
./bundle/src-QVCVGIUX.js 47 kB
./bundle/tree-sitter-7U6MW5PS.js 274 kB
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB

compressed-size-action

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the confirming tool state logic to filter out specific tool names, ensuring they are excluded from the pending tools list. The review highlights that filtering by display name is brittle and suggests implementing a more robust approach, such as adding an 'isSystemTool' flag to the 'IndividualToolCallDisplay' interface, to improve maintainability and adherence to project standards.

Comment on lines +41 to +44
(tool) =>
tool.name !== UPDATE_TOPIC_TOOL_NAME &&
tool.name !== UPDATE_TOPIC_DISPLAY_NAME,
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Filtering based on the display name (UPDATE_TOPIC_DISPLAY_NAME) makes this logic brittle. Per repository standards, if using internal or undocumented properties is unavoidable for critical functionality, define a local interface for those properties and add a detailed comment explaining the rationale and why a public API could not be used.

Could this be made more robust? For instance, by adding a boolean flag like isSystemTool to the IndividualToolCallDisplay interface to identify such tools? This would be a more resilient long-term solution.

References
  1. If using internal or undocumented SDK properties is unavoidable for critical functionality, define a local interface for those properties and add a detailed comment explaining the rationale.

Copy link
Copy Markdown
Contributor Author

@Abhijit-2592 Abhijit-2592 Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm this is the simplest solution to the problem. As long as we aren't directly using the string, we should be Good. Any other solution will add unnecessary extra code affecting readability. I think the logic is very clear here in-terms of readability. I don't want to add an unnecessary interface just for one tool. In the future, if there is another similar tool then we can think about generalizing it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is already some other filtering logic. please find and add to that rather than adding additional filter logic

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Apr 8, 2026
The `update_topic` tool is an auto-executing background operation that
does not require user interaction. Previously, it was included in the
calculation of the tool confirmation queue size, causing the UI to show
misleading counts (e.g., "1 of 2") when only one actionable tool was
actually pending.

This change filters out both the raw and display names of the topic tool
when deriving the `index` and `total` for the `ConfirmingToolState`.
Since `update_topic` never enters the `AwaitingApproval` state, the
active confirming tool is guaranteed to be present in the filtered list,
allowing for a simplified calculation of the queue position.
The logic that dictates whether a tool call should be visible in the chat history, the active tool group, or the confirmation queue was previously fragmented across the codebase (ToolGroupMessage.tsx, confirmingTool.ts, useGeminiStream.ts).

This commit introduces a unified tool-visibility utility in the core package that exposes three semantic methods:
- isRenderedInHistory
- requiresUserConfirmation
- isVisibleInToolGroup

This cleanly resolves UI inconsistencies (such as background update_topic tools inflating the confirmation queue) by providing a single source of truth for tool visibility state, removing the need for the UI to manually check against specific tool names.
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/topics/remove-tool-from-group branch from e1b6455 to dd8f81c Compare April 9, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] update_topic tool inflates confirmation queue count

3 participants