Skip to content

Comments

fix(plan): allow safe fallback when experiment setting for plan is not enabled but approval mode at startup is plan#19439

Merged
jerop merged 3 commits intomainfrom
adibakm/fix-startup-plan-mode
Feb 18, 2026
Merged

fix(plan): allow safe fallback when experiment setting for plan is not enabled but approval mode at startup is plan#19439
jerop merged 3 commits intomainfrom
adibakm/fix-startup-plan-mode

Conversation

@Adib234
Copy link
Contributor

@Adib234 Adib234 commented Feb 18, 2026

Summary

This PR fixes a startup crash that occurred when the plan approval mode was requested (via settings or command-line flags) while the experimental plan feature was disabled. Instead of throwing a terminal error, the CLI now gracefully falls back to the default approval mode and logs a warning, ensuring the tool remains usable even with configuration mismatches.

Details

  • Graceful Fallback: Updated loadCliConfig in packages/cli/src/config/config.ts to intercept cases where plan mode is selected without the experimental.plan setting being enabled. It now issues a warning via debugLogger and defaults to ApprovalMode.DEFAULT.
  • Improved Robustness: This change prevents the CLI from becoming unresponsive due to stale or incorrect configuration settings related to experimental features.

Related Issues

Fixes #19272

How to Validate

Turn off plan mode in all settings (user, project, and systems). If default approval mode is set as plan mode in any setting, startup should not crash and should fallback to default mode.

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

@Adib234 Adib234 self-assigned this Feb 18, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Adib234, 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 startup crash in the CLI that occurred when the 'plan' approval mode was configured without the corresponding experimental feature being enabled. Instead of an abrupt termination, the application now intelligently defaults to a safe approval mode and logs a warning, significantly improving the user experience and overall stability of the tool under potentially misconfigured settings.

Highlights

  • Graceful Fallback for Plan Mode: The CLI now gracefully falls back to the default approval mode when 'plan' mode is requested but the 'experimental.plan' feature is disabled, preventing startup crashes.
  • Improved Robustness: This change enhances the CLI's stability by handling configuration mismatches related to experimental features without terminating the application.
  • Warning Log: A warning message is now logged via 'debugLogger' when the 'plan' mode fallback occurs, informing the user of the change in behavior.
Changelog
  • packages/cli/src/config/config.test.ts
    • Added new test cases to verify the fallback mechanism when 'plan' approval mode is requested but 'experimental.plan' is disabled.
    • Updated existing tests to assert that the system falls back to 'ApprovalMode.DEFAULT' instead of throwing an error under these conditions.
    • Added a test case to confirm that 'plan' approval mode is correctly applied when 'experimental.plan' is enabled.
  • packages/cli/src/config/config.ts
    • Modified the 'loadCliConfig' function to check if 'experimental.plan' is enabled when 'plan' approval mode is selected.
    • Implemented a fallback to 'ApprovalMode.DEFAULT' and logged a warning if 'experimental.plan' is disabled.
    • Ensured 'ApprovalMode.PLAN' is set only when the experimental feature is active.
Activity
  • No human activity (comments, reviews, etc.) has been recorded 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.

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

Size Change: +95 B (0%)

Total Size: 24.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.5 MB +95 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

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

The pull request correctly addresses the startup crash that occurred when the "plan" approval mode was requested while the experimental plan feature was disabled. By implementing a graceful fallback to the default approval mode and logging a warning via debugLogger, the CLI now handles configuration mismatches robustly. The implementation in loadCliConfig is consistent with existing patterns for YOLO mode and folder trust overrides. The updated test suite in packages/cli/src/config/config.test.ts effectively verifies the fallback behavior for both command-line arguments and persistent settings. No high or critical issues were identified during the review.

@Adib234 Adib234 marked this pull request as ready for review February 18, 2026 16:19
@Adib234 Adib234 requested a review from a team as a code owner February 18, 2026 16:19
@Adib234 Adib234 changed the title fix(plan): defaulting to start in plan mode requires experimental.plan to be enabled fix(plan): allow safe fallback when experiment setting for plan is not enabled but approval mode at startup is plan Feb 18, 2026
@gemini-cli gemini-cli bot added priority/p0 Critical and urgent (e.g., critical security vulnerability, major breakage). area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 18, 2026
@jerop jerop enabled auto-merge February 18, 2026 17:50
@jerop jerop added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 9255e69 Feb 18, 2026
27 checks passed
@jerop jerop deleted the adibakm/fix-startup-plan-mode branch February 18, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p0 Critical and urgent (e.g., critical security vulnerability, major breakage).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tools] defaulting to start in plan mode requires experimental.plan to be enabled

2 participants