feat(core): add foundation for subagent tool isolation#22708
Conversation
|
Hi @akh64bit, 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! |
Summary of ChangesHello, 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 establishes the foundational elements necessary for enabling tool isolation for subagents. It introduces new metadata structures for defining inline Model Context Protocol (MCP) servers within agent configurations and enhances the agent loading process to parse these definitions. Additionally, it provides a mechanism for deep cloning declarative tools, allowing subagents to operate with their own message buses while reusing core tool logic. This is the first step in a multi-part rollout for subagent tool isolation, focusing on core infrastructure without altering current main execution flows. Highlights
Changelog
Activity
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
|
|
Size Change: +3 kB (+0.01%) Total Size: 26.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces foundational changes for subagent tool isolation, including adding mcpServers to agent definitions, updating the agent loader to parse new configurations from markdown files, and implementing a clone method on DeclarativeTool. The identified security concerns regarding arbitrary commands and environment variables in agent definitions from project-level files are not considered vulnerabilities, as agent/skill definitions are treated as trusted by design, and thus do not require additional sanitization or UI transparency for security purposes.
There was a problem hiding this comment.
Is this change necessary?
abhipatel12
left a comment
There was a problem hiding this comment.
lgtm, but also want @gundermanc to review the clone piece to make sure we're aligned on that.
|
@gemini-code-assist why is the E2E (Chained) failing? Could you resolve it? |
|
Hi @akh64bit, I understand you're concerned about the failing "E2E (Chained)" test. As an AI, I don't have the ability to directly resolve or fix issues in the codebase. My role is to provide feedback and analysis. To help you understand why the test might be failing, could you please provide more details about the failure? Specifically, any error messages, stack traces, or logs from the CI/CD pipeline related to that test would be very helpful. Once I have that information, I can try to analyze it and offer insights or potential causes. If you're looking for assistance with commands or features I support, you can always use |
a0b8423 to
57be2dc
Compare
Summary
This PR lays the groundwork for isolating tools per subagent. It introduces the
mcpServersmetadata structure toAgentOverrideandLocalAgentDefinition, parses inline MCP servers from agent markdown definitions, and updates theDeclarativeToolclass with aclonemethod to support deep cloning with a specific message bus.Details
mcpServerstoLocalAgentDefinitionandAgentOverrideto describe inline MCP servers for subagents.markdownToAgentDefinitionto parse and populate themcpServersconfigurations from agent markdown definitions.clone(messageBus?: MessageBus)method to enable deep cloning of tools, allowing subagents to use their own message bus while sharing core tool logic.NewAgentsNotificationcomponent to optionally display the names of inline MCP servers.This is part 1 of 3 in the subagent tool isolation rollout. This PR is strictly foundational and does not alter the current main execution flow.
Child of: #21935
Related Issues
Fixes #21901
How to Validate
npm run typecheckandnpm run testto verify everything compiles and all existing tests pass.Pre-Merge Checklist