Skip to content

fix: YOLO mode still asking for plan approval in non-interactive mode#20212

Closed
theshloksschauhan wants to merge 1 commit intogoogle-gemini:mainfrom
theshloksschauhan:fix/yolo-mode-non-interactive-plan-approval
Closed

fix: YOLO mode still asking for plan approval in non-interactive mode#20212
theshloksschauhan wants to merge 1 commit intogoogle-gemini:mainfrom
theshloksschauhan:fix/yolo-mode-non-interactive-plan-approval

Conversation

@theshloksschauhan
Copy link

When using --yolo or --approval-mode yolo with --output-format stream-json or --prompt (non-interactive/headless mode), the CLI was still asking for plan approval.

Two bugs fixed in promptProvider.ts:

  1. The 'Autonomous Mode (YOLO)' system prompt section was only injected when interactiveMode was true. Changed condition from 'isYoloMode && interactiveMode' to just 'isYoloMode'.
  2. enableEnterPlanModeTool was true in YOLO mode, causing the model to call enter_plan_mode and ask 'Does this plan sound good to you?'. Added '&& !isYoloMode' to suppress this.

Fixes #13561

Summary

Details

Related Issues

How to Validate

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

When using --yolo or --approval-mode yolo with --output-format stream-json
or --prompt (non-interactive/headless mode), the CLI was still asking for
plan approval.

Two bugs fixed in promptProvider.ts:
1. The 'Autonomous Mode (YOLO)' system prompt section was only injected
   when interactiveMode was true. Changed condition from
   'isYoloMode && interactiveMode' to just 'isYoloMode'.
2. enableEnterPlanModeTool was true in YOLO mode, causing the model to
   call enter_plan_mode and ask 'Does this plan sound good to you?'.
   Added '&& !isYoloMode' to suppress this.

Fixes google-gemini#13561
@theshloksschauhan theshloksschauhan requested a review from a team as a code owner February 24, 2026 19:17
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @theshloksschauhan, 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 bug where the YOLO (autonomous) mode in the CLI was still prompting for plan approval when used in non-interactive or headless environments. The changes ensure that the system behaves as expected in YOLO mode, eliminating unnecessary user intervention and streamlining automated workflows.

Highlights

  • YOLO Mode Prompt Fix: The 'Autonomous Mode (YOLO)' system prompt section is now correctly injected based solely on isYoloMode, removing the previous dependency on interactiveMode.
  • Plan Approval Suppression: The enableEnterPlanModeTool is now explicitly disabled when in YOLO mode, preventing the model from incorrectly asking for plan approval in non-interactive environments.
Changelog
  • packages/core/src/prompts/promptProvider.ts
    • Modified the condition for enableEnterPlanModeTool to include !isYoloMode, ensuring it is disabled when YOLO mode is active.
    • Updated the interactiveYoloMode section condition to activate when isYoloMode is true, removing the interactiveMode dependency.
Activity
  • No human activity has occurred on this pull request yet.
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 addresses a bug where YOLO mode would still prompt for plan approval in non-interactive sessions. The changes in packages/core/src/prompts/promptProvider.ts modify the conditions for enabling the enter_plan_mode tool and for injecting the 'Autonomous Mode (YOLO)' system prompt. These changes ensure that autonomous behavior is correctly triggered in all YOLO mode scenarios. The implementation appears to correctly resolve the issue.

@jerop
Copy link
Contributor

jerop commented Feb 24, 2026

which version are you using? this should already be fixed in #19570

cc @Adib234

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/non-interactive Issues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automation help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Feb 24, 2026
@theshloksschauhan
Copy link
Author

Thanks for the heads-up, @jerop! I'm based on commit 8e9ce3f (current main). I checked #19570 and it addresses the issue at the tool-registry level in Config.syncPlanModeTools. However, I found that in promptProvider.ts, the 'Autonomous Mode (YOLO)' system prompt section was still gated on interactiveMode, and enableEnterPlanModeTool was not guarded against YOLO mode specifically in the prompt context. I believe both fixes may be complementary — could you confirm if #19570 fully covers the non-interactive (--prompt / --output-format stream-json) headless scenario?

'interactiveYoloMode',
() => true,
isYoloMode && interactiveMode,
isYoloMode,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was very much intentional because it's used to define interactiveYoloMode

cc @jackwotherspoon

Copy link
Contributor

@jerop jerop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be covered, unless you're seeing something wrong on main branch

Comment on lines +163 to +164
enableEnterPlanModeTool:
enabledToolNames.has(ENTER_PLAN_MODE_TOOL_NAME) && !isYoloMode,
Copy link
Contributor

@jerop jerop Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enter_plan_mode tool is not available in YOLO mode so this is redundant - #19570

@theshloksschauhan
Copy link
Author

Thanks for the thorough review, @jerop! You're absolutely right — since #19570 already removes ENTER_PLAN_MODE_TOOL_NAME from the tool registry in YOLO mode, the && !isYoloMode guard is redundant. I tested this before pulling the latest main that includes #19570. I'll go ahead and close this PR.

@theshloksschauhan theshloksschauhan deleted the fix/yolo-mode-non-interactive-plan-approval branch February 24, 2026 20:03
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 help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

both --yolo and --approval-mode yolo not worl

2 participants