Skip to content

refactor(cli): consolidate useToolScheduler and delete legacy implementation#18567

Merged
abhipatel12 merged 2 commits intomainfrom
abhi/event-tools-cleanup.4
Feb 12, 2026
Merged

refactor(cli): consolidate useToolScheduler and delete legacy implementation#18567
abhipatel12 merged 2 commits intomainfrom
abhi/event-tools-cleanup.4

Conversation

@abhipatel12
Copy link
Copy Markdown
Contributor

Summary

This PR consolidates the tool scheduling logic in the CLI package by removing the legacy useReactToolScheduler and renaming the modern implementation to useToolScheduler. This significantly simplifies the hook architecture and removes the need for a facade layer.

Details

  • Consolidation: Deleted the legacy useReactToolScheduler.ts and its associated unit tests.
  • Renaming: Renamed packages/cli/src/ui/hooks/useToolExecutionScheduler.ts to packages/cli/src/ui/hooks/useToolScheduler.ts.
  • Simplification: Removed the facade layer in useToolScheduler.ts that previously toggled between legacy and modern engines.
  • Import Cleanup: Updated all CLI hooks and components (useGeminiStream, useTurnActivityMonitor, useShellInactivityStatus, etc.) to import types and the main hook from the unified useToolScheduler.js.
  • Test Refactoring: Updated App.test.tsx and useGeminiStream.test.tsx to remove redundant feature flag mocks and spies.

Note: A follow-up PR will address the removal of the remaining onConfirm adapter logic within the hook, as it is now redundant with the MessageBus based confirmation flow.

Related Issues

Significant progress on the legacy scheduler cleanup in the CLI package.

How to Validate

  1. Run npm run preflight to ensure all tests pass and the build is stable.
  2. Verify that packages/cli/src/ui/hooks/useReactToolScheduler.ts no longer exists in the codebase.
  3. Confirm that all imports in the CLI correctly point to the renamed useToolScheduler.js.

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

@abhipatel12 abhipatel12 requested a review from a team as a code owner February 8, 2026 05:37
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @abhipatel12, 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 significantly refactors the tool scheduling logic within the CLI package. By removing the outdated useReactToolScheduler and directly integrating the modern event-driven implementation under the new useToolScheduler name, the architecture is streamlined. This change eliminates a facade layer, simplifies configuration, and cleans up various UI components and tests that previously managed compatibility between the two scheduling approaches. The overall impact is a more maintainable and less complex codebase for tool execution.

Highlights

  • Scheduler Consolidation: The legacy useReactToolScheduler and its associated unit tests have been removed, streamlining the tool scheduling logic.
  • Renaming and Simplification: The modern tool scheduling implementation, previously useToolExecutionScheduler, has been renamed to useToolScheduler. The facade layer that previously toggled between legacy and modern engines has been eliminated, simplifying the hook architecture.
  • Import Updates: All relevant CLI hooks and components (useGeminiStream, useTurnActivityMonitor, useShellInactivityStatus, etc.) now import types and the main hook directly from the unified useToolScheduler.js.
  • Test Refactoring: App.test.tsx and useGeminiStream.test.tsx have been updated to remove redundant feature flag mocks and spies, reflecting the removal of the legacy scheduler. Additionally, ToolGroupMessage.test.tsx and related snapshots were updated to remove tests specific to the legacy confirmation handling.
  • UI Component Cleanup: UI components like AlternateBufferQuittingDisplay.tsx, MainContent.tsx, and ToolGroupMessage.tsx have been refactored to remove conditional logic and imports related to the isEventDrivenSchedulerEnabled flag and the legacy confirmation flow.
Changelog
  • packages/cli/src/test-utils/mockConfig.ts
    • Removed isEventDrivenSchedulerEnabled from mock configuration.
  • packages/cli/src/ui/App.test.tsx
    • Removed a vi.spyOn call for isEventDrivenSchedulerEnabled.
  • packages/cli/src/ui/AppContainer.test.tsx
    • Updated import of TrackedToolCall type from useReactToolScheduler.js to useToolScheduler.js.
  • packages/cli/src/ui/components/AlternateBufferQuittingDisplay.tsx
    • Removed useConfig import and conditional logic based on isEventDrivenSchedulerEnabled.
  • packages/cli/src/ui/components/MainContent.tsx
    • Removed useConfig import and conditional logic based on isEventDrivenSchedulerEnabled.
  • packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx
    • Deleted file, as its functionality is no longer relevant with the removal of legacy confirmation handling.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Removed createMockSettings import and enableEventDrivenScheduler from mock config.
    • Removed several test cases related to confirmation handling and event-driven scheduler behavior.
    • Updated snapshots to reflect changes in test logic and removed components.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Removed imports for ToolConfirmationMessage and useConfig.
    • Eliminated logic related to isEventDriven and toolAwaitingApproval for inline confirmations.
    • Removed isFocused prop from component signature.
  • packages/cli/src/ui/components/messages/snapshots/ToolGroupMessage.test.tsx.snap
    • Updated to reflect changes in ToolGroupMessage.test.tsx.
  • packages/cli/src/ui/hooks/snapshots/useToolScheduler.test.ts.snap
    • Deleted file.
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx
    • Removed isEventDrivenSchedulerEnabled mock from config.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Removed the isEventDriven variable and associated conditional logic for filtering tool calls.
  • packages/cli/src/ui/hooks/useReactToolScheduler.test.ts
    • Deleted file.
  • packages/cli/src/ui/hooks/useReactToolScheduler.ts
    • Deleted file, removing the legacy scheduler implementation.
  • packages/cli/src/ui/hooks/useShellInactivityStatus.ts
    • Updated import of TrackedToolCall type from useReactToolScheduler.js to useToolScheduler.js.
  • packages/cli/src/ui/hooks/useToolExecutionScheduler.test.ts
    • Deleted file.
  • packages/cli/src/ui/hooks/useToolExecutionScheduler.ts
    • Deleted file, as its implementation has been moved and renamed.
  • packages/cli/src/ui/hooks/useToolScheduler.test.ts
    • Updated to reflect the new useToolScheduler implementation directly, removing facade-specific tests.
  • packages/cli/src/ui/hooks/useToolScheduler.ts
    • Refactored to directly implement the modern event-driven scheduler logic, removing the facade pattern and the conditional loading of useReactToolScheduler or useToolExecutionScheduler.
  • packages/cli/src/ui/hooks/useToolSchedulerFacade.test.ts
    • Deleted file.
  • packages/cli/src/ui/hooks/useTurnActivityMonitor.test.ts
    • Updated import of TrackedToolCall type from useReactToolScheduler.js to useToolScheduler.js.
  • packages/cli/src/ui/hooks/useTurnActivityMonitor.ts
    • Updated import of TrackedToolCall type from useReactToolScheduler.js to useToolScheduler.js.
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 is an excellent refactoring that consolidates the tool scheduling logic by removing the legacy useReactToolScheduler and its associated feature flag. The modern, event-driven useToolExecutionScheduler has been correctly renamed to useToolScheduler and is now the single implementation, which significantly simplifies the hook architecture and improves maintainability. All related imports, components, and tests have been updated consistently to reflect this change. The test suite has been particularly well-refactored to remove the now-obsolete branching logic and focus on the unified behavior. The changes are clean, well-executed, and align perfectly with the goal of simplifying the codebase. I found no issues with this refactoring.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 8, 2026

Size Change: -354 B (0%)

Total Size: 24.3 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.3 MB -354 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 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-closed.sb 3.29 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

compressed-size-action

@abhipatel12 abhipatel12 changed the base branch from main to abhi/event-tools-cleanup.3 February 8, 2026 05:43
@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 8, 2026
@abhipatel12 abhipatel12 force-pushed the abhi/event-tools-cleanup.3 branch 2 times, most recently from 13703d1 to f9fff2e Compare February 8, 2026 22:57
@abhipatel12 abhipatel12 force-pushed the abhi/event-tools-cleanup.4 branch from cd89ffd to f63186e Compare February 9, 2026 00:18
@abhipatel12 abhipatel12 force-pushed the abhi/event-tools-cleanup.3 branch from f9fff2e to b614153 Compare February 12, 2026 00:35
Copy link
Copy Markdown
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from abhi/event-tools-cleanup.3 to main February 12, 2026 01:00
@abhipatel12 abhipatel12 force-pushed the abhi/event-tools-cleanup.4 branch from f63186e to 77d4c65 Compare February 12, 2026 01:34
@abhipatel12 abhipatel12 added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit fad9f46 Feb 12, 2026
27 checks passed
@abhipatel12 abhipatel12 deleted the abhi/event-tools-cleanup.4 branch February 12, 2026 02:10
krsjenmt added a commit to krsjenmt/gemini-cli that referenced this pull request Feb 12, 2026
…ini/gemini-cli (#37)

* fix(cli): resolve double rendering in shpool and address vscode lint warnings (google-gemini#18704)

* feat(plan): document and validate Plan Mode policy overrides (google-gemini#18825)

* Fix pressing any key to exit select mode. (google-gemini#18421)

* fix(cli): update F12 behavior to only open drawer if browser fails (google-gemini#18829)

* feat(plan): allow skills to be enabled in plan mode (google-gemini#18817)

Co-authored-by: Jerop Kipruto <jerop@google.com>

* docs(plan): add documentation for plan mode tools (google-gemini#18827)

* Remove experimental note in extension settings docs (google-gemini#18822)

* Update prompt and grep tool definition to limit context size (google-gemini#18780)

* docs(plan): add `ask_user` tool documentation (google-gemini#18830)

* Revert unintended credentials exposure (google-gemini#18840)

* feat(core): update internal utility models to Gemini 3 (google-gemini#18773)

* feat(a2a): add value-resolver for auth credential resolution (google-gemini#18653)

* Removed getPlainTextLength (google-gemini#18848)

* More grep prompt tweaks (google-gemini#18846)

* refactor(cli): Reactive useSettingsStore hook (google-gemini#14915)

* fix(mcp): Ensure that stdio MCP server execution has the `GEMINI_CLI=1` env variable populated. (google-gemini#18832)

* fix(core): improve headless mode detection for flags and query args (google-gemini#18855)

* refactor(cli): simplify UI and remove legacy inline tool confirmation logic (google-gemini#18566)

* feat(cli): deprecate --allowed-tools and excludeTools in favor of policy engine (google-gemini#18508)

* fix(workflows): improve maintainer detection for automated PR actions (google-gemini#18869)

* refactor(cli): consolidate useToolScheduler and delete legacy implementation (google-gemini#18567)

* Update changelog for v0.28.0 and v0.29.0-preview0 (google-gemini#18819)

* fix(core): ensure sub-agents are registered regardless of tools.allowed (google-gemini#18870)

---------

Co-authored-by: Brad Dux <959674+braddux@users.noreply.github.com>
Co-authored-by: Jerop Kipruto <jerop@google.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Sandy Tao <sandytao520@icloud.com>
Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com>
Co-authored-by: christine betts <chrstn@uw.edu>
Co-authored-by: Christian Gunderman <gundermanc@gmail.com>
Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com>
Co-authored-by: Dev Randalpura <devrandalpura@google.com>
Co-authored-by: Pyush Sinha <pyushsinha20@gmail.com>
Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
Co-authored-by: Abhijit Balaji <abhijitbalaji@google.com>
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
Co-authored-by: g-samroberts <158088236+g-samroberts@users.noreply.github.com>
Co-authored-by: matt korwel <matt.korwel@gmail.com>
kuishou68 pushed a commit to iOfficeAI/aioncli that referenced this pull request Feb 27, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
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.

2 participants