-
Notifications
You must be signed in to change notification settings - Fork 10.8k
feat(agents): migrate subagents to event-driven scheduler #17567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @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 enhances the architecture for subagent tool execution by transitioning to a new event-driven Highlights
Using Gemini Code AssistThe 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
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 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
|
|
Hi @abhipatel12, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
There was a problem hiding this 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 successfully migrates subagents to use the new event-driven Scheduler and introduces AsyncLocalStorage-based ToolCallContext for propagating callId, schedulerId, and origin across tool validation and execution. The changes are well-implemented, with appropriate refactoring in local-executor.ts and corresponding updates in test files. The new agent-scheduler.ts and toolCallContext.ts files provide the necessary abstractions and utilities for this migration. The tests for these new components are comprehensive and cover the intended functionality, including context propagation and parallel execution isolation.
|
Size Change: +2.55 kB (+0.01%) Total Size: 23.4 MB
ℹ️ View Unchanged
|
This change transitions LocalAgentExecutor to use the new event-driven Scheduler class. It introduces an AsyncLocalStorage-based ToolCallContext to propagate callId and schedulerId across tool validation and execution, enabling correct subagent tool tracking and UI isolation.
gundermanc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3c6b7e9 to
22e9302
Compare
abhipatel12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
Summary
This PR migrates subagents to use the new event-driven
Scheduler. This is acritical step in unifying tool execution and state management across the CLI.
Details
LocalAgentExecutorfrom the legacynonInteractiveToolExecutorto the newSchedulerclass via a newscheduleAgentToolshelper.AsyncLocalStorage-basedToolCallContextto propagatecallId,schedulerId, andoriginacrosstool validation and execution. This ensures that tools executed by subagents
are correctly tracked and isolated in the UI.
agent-schedulerhelper andToolCallContextpropagation.Scheduler, subagent tool callsnow correctly emit
TOOL_CALLS_UPDATEevents, allowing for better real-timeUI feedback.
Related Issues
Related to #14306
How to Validate
npm test -w @google/gemini-cli-core -- src/agents/agent-scheduler.test.ts src/utils/toolCallContext.test.tsnpm test -w @google/gemini-cli-coreand verify that tool calls are correctly displayed and tracked in the UI.
Pre-Merge Checklist