Skip to content

fix(cli): allow sub-agent confirmation requests in UI while preventing background flicker#20722

Merged
abhipatel12 merged 1 commit intomainfrom
abhi/parallel-agents.4
Mar 1, 2026
Merged

fix(cli): allow sub-agent confirmation requests in UI while preventing background flicker#20722
abhipatel12 merged 1 commit intomainfrom
abhi/parallel-agents.4

Conversation

@abhipatel12
Copy link
Copy Markdown
Contributor

Summary

This PR fixes a regression where subagent tool confirmation requests were not being displayed in the UI. It also refines the tool filtering logic to prevent background "thinking" tools (like read_file or grep_search) from flickering in the UI after a subagent confirmation has been shown.

Details

In commit c914fd0700665790aea3faaf6cdc59ccffd9119c, a blanket filter was added to useToolScheduler.ts that blocked all updates from non-root schedulers. While this successfully prevented flickering from subagent internal tools, it also suppressed all AwaitingApproval status updates, making it impossible for users to see or respond to subagent confirmation requests.

This PR introduces a more granular, per-tool-call filtering strategy:

  • Root Scheduler: All tool calls are displayed as before.
  • Subagent Schedulers: A tool call is displayed only if:
    1. It is currently in AwaitingApproval status.
    2. It was previously displayed (meaning it was confirmed and is now executing or completed).

This ensures that only the relevant tools requiring user interaction are shown, while all other background activity from the subagent remains hidden, preserving the intended clean UI.

Related Issues

Fixes the regression introduced in c914fd0.

How to Validate

  1. Run the updated unit tests: npm test -w @google/gemini-cli -- src/ui/hooks/useToolScheduler.test.ts
  2. (Manual) Trigger a subagent that requires confirmation (e.g., using a tool that requires approval). Verify the confirmation appears.
  3. (Manual) Verify that background reads/searches from the subagent do not appear in the tool list/history.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@abhipatel12 abhipatel12 requested a review from a team as a code owner March 1, 2026 01:35
@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 critical UI issue where subagent tool confirmation requests were not visible to users. It introduces a sophisticated filtering mechanism to ensure that only necessary subagent interactions are displayed, thereby improving user experience by eliminating distracting background tool activity while restoring essential approval prompts. The changes enhance the clarity and responsiveness of the tool scheduler in the UI.

Highlights

  • Subagent Confirmation Requests: Fixed a regression that prevented subagent tool confirmation requests from being displayed in the UI, ensuring users can now see and respond to them.
  • Refined Tool Filtering Logic: Implemented a more granular, per-tool-call filtering strategy for subagents to prevent background 'thinking' tools (like read_file or grep_search) from flickering in the UI, while still showing relevant tools requiring user interaction.
  • Enhanced Test Coverage: Added new unit tests to validate the correct display and filtering behavior of subagent tool calls, including scenarios for awaiting approval and preserving approved tools.
Changelog
  • packages/cli/src/ui/hooks/useToolScheduler.test.ts
    • Imported WaitingToolCall type for improved type safety in tests.
    • Added dispose method to the mocked Scheduler to align with new API.
    • Updated test data for subagent calls to explicitly include AwaitingApproval status and confirmationDetails.
    • Modified assertions in existing tests to correctly reflect the display of both root and subagent tool calls.
    • Renamed a test case to clarify that non-root scheduler updates are ignored only when no tools await approval.
    • Introduced new test cases to verify that subagent tools awaiting approval are displayed and that approved tools remain visible, while background tools are hidden.
  • packages/cli/src/ui/hooks/useToolScheduler.ts
    • Replaced the blanket filter for non-root schedulers with a granular, per-tool-call filtering strategy within the useEffect hook.
    • Implemented logic to display subagent tool calls only if they are AwaitingApproval or were previously displayed.
    • Added an optimization to prevent unnecessary re-renders for subagents when no relevant tools are present or were previously shown.
    • Refactored the setToolCallsMap update to encapsulate the new filtering logic and internalAdaptToolCalls call.
Activity
  • abhipatel12 updated unit tests for @google/gemini-cli in src/ui/hooks/useToolScheduler.test.ts.
  • abhipatel12 manually validated the changes on MacOS using npm run.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

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 effectively addresses a regression where sub-agent tool confirmation requests were not being displayed in the UI. No security vulnerabilities were found. The introduction of a more granular filtering logic in useToolScheduler is a solid improvement, ensuring that only relevant tool calls (those awaiting approval or previously displayed) are shown for sub-agents. This correctly prevents UI flicker from background tasks while re-enabling the crucial confirmation workflow. The accompanying unit tests are comprehensive and validate the new logic thoroughly.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

Size Change: +396 B (0%)

Total Size: 25.8 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.3 MB +396 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 1, 2026
@abhipatel12 abhipatel12 added this pull request to the merge queue Mar 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 1, 2026
@abhipatel12 abhipatel12 added this pull request to the merge queue Mar 1, 2026
Merged via the queue into main with commit 703759c Mar 1, 2026
30 checks passed
@abhipatel12 abhipatel12 deleted the abhi/parallel-agents.4 branch March 1, 2026 02:50
@quinell343-dsd
Copy link
Copy Markdown

THANK U LETS CHECK IT OUT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants