Skip to content

Comments

refactor(cli): switch useToolScheduler to event-driven engine#18565

Merged
abhipatel12 merged 1 commit intomainfrom
abhi/event-tools-cleanup.2
Feb 8, 2026
Merged

refactor(cli): switch useToolScheduler to event-driven engine#18565
abhipatel12 merged 1 commit intomainfrom
abhi/event-tools-cleanup.2

Conversation

@abhipatel12
Copy link
Collaborator

Summary

This PR migrates the useToolScheduler hook in the CLI package to use the event-driven tool execution engine exclusively. It removes the branching logic that previously supported the legacy scheduler, simplifying the core logic for tool scheduling and stream processing.

Details

  • Refactored packages/cli/src/ui/hooks/useToolScheduler.ts to directly wrap useToolExecutionScheduler.
  • Simplified packages/cli/src/ui/hooks/useGeminiStream.ts by removing the isEventDriven check in pendingToolGroupItems, assuming event-driven behavior.
  • Updated packages/cli/src/test-utils/mockConfig.ts to remove the isEventDrivenSchedulerEnabled flag.
  • Deleted packages/cli/src/ui/hooks/useToolSchedulerFacade.test.ts as the facade logic no longer exists.

Related Issues

Part of a larger effort to clean up the legacy scheduler from the CLI package.

How to Validate

  1. Run npm run preflight to ensure all tests, linting, and typechecks pass.
  2. Manually verify tool execution in the CLI:
    • Run a prompt that triggers a tool call.
    • Observe that the tool is scheduled and executed through the modern scheduler (verified by correct state transitions and lack of console errors).

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 February 8, 2026 04:54
@gemini-code-assist
Copy link
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 streamlines the tool scheduling mechanism within the CLI by fully adopting the event-driven architecture. The change removes conditional logic and legacy code paths, resulting in a more robust and maintainable system for handling tool execution. This is a significant step in cleaning up the codebase and ensuring all tool interactions leverage the modern event-driven engine.

Highlights

  • Scheduler Migration: The useToolScheduler hook in the CLI package has been fully migrated to exclusively use the event-driven tool execution engine, removing all legacy scheduler support.
  • Code Simplification: Branching logic that previously supported the legacy scheduler has been removed, simplifying the core logic for tool scheduling and stream processing across several files.
  • Configuration Cleanup: The isEventDrivenSchedulerEnabled flag and related checks have been removed from the configuration and useGeminiStream hook, as the event-driven scheduler is now the sole implementation.
  • Test File Deletion: The test file useToolSchedulerFacade.test.ts has been deleted, as the facade logic it tested is no longer necessary after the full migration.
Changelog
  • packages/cli/src/test-utils/mockConfig.ts
    • Removed the isEventDrivenSchedulerEnabled property from the mock configuration, reflecting its deprecation.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Eliminated the isEventDriven constant and its associated conditional logic within the pendingToolGroupItems calculation.
    • Updated the dependency array for the pendingToolGroupItems memoized value to remove config.
  • packages/cli/src/ui/hooks/useToolScheduler.ts
    • Removed imports related to the legacy useReactToolScheduler and its specific TrackedToolCall type.
    • Updated the TrackedToolCall export to directly reference the type from useToolExecutionScheduler.
    • Refactored the useToolScheduler function to directly call useToolExecutionScheduler, removing the conditional facade logic that switched between schedulers.
  • packages/cli/src/ui/hooks/useToolSchedulerFacade.test.ts
    • Deleted the file as the useToolScheduler no longer acts as a facade, making the tests for conditional scheduler selection obsolete.
Activity
  • abhipatel12 created this pull request to refactor the CLI's tool scheduling.
  • The pull request includes changes to mockConfig.ts, useGeminiStream.ts, and useToolScheduler.ts to remove legacy scheduler dependencies.
  • The test file useToolSchedulerFacade.test.ts was removed as part of the refactoring.
  • The author has marked the 'Added/updated tests' and 'Validated on MacOS (npm run)' checklist items as complete.
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.

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 8, 2026
Copy link
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 a solid refactoring that successfully migrates the useToolScheduler hook to exclusively use the event-driven engine. By removing the legacy scheduler path and the associated isEventDrivenSchedulerEnabled feature flag, the code is now simpler and more maintainable. The related cleanups in useGeminiStream, mock configurations, and the deletion of the obsolete test file are all appropriate. I have one minor suggestion to further tighten up a type definition that is now outdated as a result of this refactor.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Size Change: -4.09 kB (-0.02%)

Total Size: 23.8 MB

Filename Size Change
./bundle/gemini.js 23.8 MB -4.09 kB (-0.02%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@abhipatel12 abhipatel12 added this pull request to the merge queue Feb 8, 2026
Merged via the queue into main with commit 802bcf4 Feb 8, 2026
28 checks passed
@abhipatel12 abhipatel12 deleted the abhi/event-tools-cleanup.2 branch February 8, 2026 20:37
aswinashok44 pushed a commit to aswinashok44/gemini-cli that referenced this pull request Feb 9, 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