Skip to content

Conversation

@seongbiny
Copy link

@seongbiny seongbiny commented Jan 25, 2026

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

✅ 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"
스크린샷 2026-01-26 오전 11 08 48

Result: Command executed successfully without any "Tool not found in registry" errors.

How to Validate

  1. Run headless mode:
    • gemini -p "how many files in this folder"
    • Expected: no Tool "run_shell_command" not found in registry error
  2. 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

@seongbiny seongbiny requested a review from a team as a code owner January 25, 2026 04:39
@google-cla
Copy link

google-cla bot commented Jan 25, 2026

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Conditional Shell Tool References: System prompts now conditionally include references to shell tools based on their availability in the tool registry. This prevents the system from suggesting tools that are not present.
  • Prevents Headless Mode Crashes: This change specifically addresses an issue where headless mode would crash due to system prompts referencing unavailable shell tools, leading to 'Tool not found in registry' errors.
  • Dynamic Prompt Generation: All shell-related guidance within the system prompts, including tool listings, command execution instructions, and shell output efficiency sections, are now dynamically included or excluded.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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>
@gemini-cli gemini-cli bot added the area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation label Jan 25, 2026
Copy link

@oktho1114-debug oktho1114-debug left a 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

  1. Run headless mode:
    • gemini -p "how many files in this folder"
    • Expected: no Tool "run_shell_command" not found in registry error
  2. 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

SandyTao520 and others added 2 commits January 25, 2026 18:53
- 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.
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Jan 27, 2026

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!

@gemini-cli gemini-cli bot closed this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System prompt explicitly instructs model to use excluded SHELL_TOOL_NAME in headless mode

3 participants