feat(core): remove hardcoded policy bypass for local subagents#18153
feat(core): remove hardcoded policy bypass for local subagents#18153abhipatel12 merged 2 commits intomainfrom
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 refactors the subagent execution flow by eliminating a hardcoded policy bypass for local subagents. The change centralizes the decision-making process for subagent call confirmations, ensuring that all such decisions are now handled by the designated policy engine. This promotes a more consistent and configurable approach to managing subagent interactions, reducing specific logic within the 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
|
There was a problem hiding this comment.
Code Review
This pull request removes a hardcoded policy bypass for local subagents within SubAgentInvocation, ensuring all local subagent tool calls flow through the BaseToolInvocation logic and are subject to policy checks, which improves consistency. However, this change also removes a delegation mechanism in SubAgentInvocation.shouldConfirmExecute that was crucial for transparent user confirmation prompts, especially with remote agents. This loss of visibility into data sent to external services during confirmation poses a security risk.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/core/src/agents/subagent-tool.ts (88-98)
The removal of the shouldConfirmExecute override in SubAgentInvocation introduces a security regression by reducing the transparency of the user confirmation flow.
Previously, SubAgentInvocation delegated the confirmation check to the underlying RemoteAgentInvocation (via buildSubInvocation), which provided a detailed prompt including the actual query being sent to the remote agent. By removing this override, the tool now falls back to the base BaseToolInvocation.shouldConfirmExecute implementation, which uses SubAgentInvocation.getDescription().
Since SubAgentInvocation.getDescription() only returns a generic string (Delegating to agent '${this.definition.name}'), the user is no longer shown the specific arguments (like the query) being passed to the subagent. This makes it difficult for users to identify and block potentially malicious or sensitive data transfers to external services.
To remediate this, consider restoring the delegation logic while removing the hardcoded bypass for local agents. This ensures that the specific confirmation details of the underlying invocation are used, while still allowing the policy engine to be checked.
|
Size Change: -85 B (0%) Total Size: 23.7 MB ℹ️ View Unchanged
|
adamfweidman
left a comment
There was a problem hiding this comment.
I think this will break tool confirmations for remote agents.
We should just remove the kind !== remote and jus keep the buildSubInvocation and shouldConfirmExecute, this will automatically delegate to the remote vs local invocations.
f51e12b to
26d0f49
Compare
Remove hard-coded subagent policy. This should be handled by policy engine now