-
Notifications
You must be signed in to change notification settings - Fork 10.9k
fix: exclude shell tool references from prompts when tool is unavailable #17473
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
fix: exclude shell tool references from prompts when tool is unavailable #17473
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @seongbiny, 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 enhances the robustness of the system by making prompt generation more intelligent and context-aware. It ensures that the system's instructions and suggestions are always relevant to the available tools, thereby preventing errors and improving the user experience, especially in environments where certain tools might be intentionally excluded. 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 makes references to the shell tool conditional based on its availability, which fixes a crash when the tool is not present. However, I found a critical issue where some of the prompt instructions for the shell tool were accidentally truncated during the refactoring. This will lead to an incomplete system prompt and could cause unexpected behavior from the agent. I've added a comment with a suggested fix to restore the full instructions.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
oktho1114-debug
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.
Summary
Conditionally include shell-related instructions in system prompts based on tool availability. This prevents headless mode from referencing excluded shell tools and crashing with "Tool not found in registry".
Details
- Detect shell tool availability via tool registry.
- Make all shell-related prompt guidance conditional on availability (tool listings, command execution guidance, and shell output efficiency section).
Related Issues
Fixes #17469
How to Validate
- Run headless mode:
gemini -p "how many files in this folder"- Expected: no
Tool "run_shell_command" not found in registryerror- Run interactive mode:
gemini- Expected: shell-related guidance still appears when shell tool is available
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
- Adds `devtools-standalone` package with a backend log tailer and a React/Vite frontend. - Integrates activity log cleanup into existing `sessionCleanup.ts`. - Updates root `GEMINI.md` with quick start instructions.
|
Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request. To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues. If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding! |
Summary
Conditionally include shell-related instructions in system prompts based on tool availability. This prevents headless mode from referencing excluded shell tools and crashing with "Tool not found in registry".
Details
Related Issues
Fixes #17469
✅ Issue Resolved
The fix has been validated and the issue is now resolved. Headless mode successfully runs without shell tool errors.
Test command:
gemini -p "how many files in this folder"Result: Command executed successfully without any "Tool not found in registry" errors.
How to Validate
gemini -p "how many files in this folder"Tool "run_shell_command" not found in registryerrorgeminiPre-Merge Checklist