-
Notifications
You must be signed in to change notification settings - Fork 10.1k
fix: similar to policy-engine, throw error in case of requiring tool execution confirmation for non-interactive mode #14702
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 @MayV, 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 addresses a critical issue where the 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
|
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 correctly addresses a critical issue where gemini-cli could hang indefinitely in non-interactive mode when a tool requires user confirmation. The approach of adding a centralized check in CoreToolScheduler is sound. My only feedback is to improve the error message to be more descriptive for users who are not using the policy engine. This will help avoid confusion and make the error more actionable.
|
Size Change: +294 B (0%) Total Size: 21.6 MB ℹ️ View Unchanged
|
9962362 to
2667db5
Compare
|
The "Tool Call Lifecycle" section of Gemini CLI A2A documentation clearly states that the confirmation requirement is expected for tool calls. Hence do not throw error and break the flow in case of an A2A request. To identify if the request is an A2A request, a new config is added which is only set to true when an A2A request is created. |
1f24f91 to
db80242
Compare
…interactive mode.
Update error description Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…n is required in non-interactive mode in legacy confirmation flow
4f03467 to
8788e69
Compare
Summary
Replicate throwing error (inspired by DENY case of policy-engine) in case of non-interactive mode and requiring user confirmation for tool execution. This avoids non-interactive gemini-cli indefinitely waiting for mcp-server tool execution confirmation. This error is caught and an error response is shown to the user.
Details
The issue #11459 is only observed in case the Policy Engine is not enabled. Code flow:
When a tool call is scheduled and processed (inside
_processNextInQueue()method ofpackages/core/src/core/coreToolScheduler.ts), it callsshouldConfirmExecute()method ofpackages/core/src/tools/tools.tsto determine if user approval is needed. For determining this, the flow splits here depending on whether the policy-engine is enabled or not. In case the policy-engine is not enabled, the legacy confirmation flow is used.Finally, if the user confirmation message is required, it is checked if the tool part of
--allowedToolslist. If not, user confirmation message is triggered (check_processNextInQueue()method ofpackages/core/src/core/coreToolScheduler.ts).The user confirmation is required for executing mcp-tools (in case the server is not trusted or the tool is not explicitly allowed). This causes the indefinite waiting of non-interactive gemini-cli on executing mcp-tools.
To solve this, the exact same logic defined in policy-engine of throwing error in case of tool deny is used. This error is caught and an error response is shown to the user (check _processNextInQueue() method of
packages/core/src/core/coreToolScheduler.ts)Related Issues
Fixes #11459
How to Validate
Follow steps to reproduce #11459
Pre-Merge Checklist
Working as expected without indefinite wait on invoking mcp-server tool in non-interactive mode:
