Skip to content

feat(cli): remove Plan Mode from rotation when actively working#19262

Merged
jerop merged 1 commit intomainfrom
fix/remove-plan-mode-active-rotation
Feb 17, 2026
Merged

feat(cli): remove Plan Mode from rotation when actively working#19262
jerop merged 1 commit intomainfrom
fix/remove-plan-mode-active-rotation

Conversation

@jerop
Copy link
Contributor

@jerop jerop commented Feb 17, 2026

Summary

This PR removes Plan Mode from the approval mode rotation when the CLI is actively working (processing or showing confirmation dialogs).

Details

  • Consolidates Plan Mode availability logic into a single allowPlanMode prop.
  • Updates AppContainer to compute allowPlanMode based on streamingState === StreamingState.Idle && !hasPendingActionRequired.
  • Updates useApprovalModeIndicator hook and ApprovalModeIndicator component to use the new prop.
  • Renames isPlanEnabled to allowPlanMode in ApprovalModeIndicator for consistency.
  • Reorders state logic in AppContainer to ensure correct initialization and dependency ordering.
  • Adds comprehensive unit tests for Plan Mode availability in AppContainer.test.tsx.
  • Updates docs/cli/plan-mode.md and docs/cli/keyboard-shortcuts.md to reflect the behavioral change.

Related Issues

Fixes #19021

How to Validate

  1. Idle State:

    • Ensure Plan Mode is enabled in settings (/settings -> search "Plan").
    • Run the CLI and wait for it to be idle.
    • Press Shift+Tab.
    • Verify it cycles: Default -> Auto-Edit -> Plan -> Default.
  2. Busy State (Streaming):

    • Ask the agent a question that generates a long response.
    • While it is responding, press Shift+Tab.
    • Verify it cycles only between Default and Auto-Edit. Plan should be skipped.
  3. Waiting for Confirmation:

    • Trigger a tool call that requires confirmation (e.g., an edit tool in Default mode).
    • While the confirmation dialog is visible, press Shift+Tab.
    • Verify it cycles only between Default and Auto-Edit. Plan should be skipped.

@jerop jerop requested review from a team as code owners February 17, 2026 16:47
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jerop, 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 user experience of the CLI by intelligently managing the availability of Plan Mode. It ensures that users cannot inadvertently switch into Plan Mode when the application is busy processing or requires immediate input, thereby streamlining interaction and preventing potential confusion. The change centralizes the logic for Plan Mode availability and updates the UI and underlying hooks to respect this new conditional behavior.

Highlights

  • Conditional Plan Mode Availability: Plan Mode is now dynamically removed from the approval mode rotation when the CLI is actively processing (streaming) or awaiting user confirmation for tool calls, preventing users from entering this mode during busy states.
  • Consolidated Logic for Plan Mode: A new allowPlanMode prop has been introduced to centralize the logic determining when Plan Mode should be available, based on the CLI's streamingState and whether hasPendingActionRequired.
  • Refactored UI State Management: The AppContainer component has been updated to compute and pass the allowPlanMode state to relevant UI components and hooks, and state logic has been reordered for improved initialization and dependency management.
  • Updated Approval Mode Indicator: The useApprovalModeIndicator hook and ApprovalModeIndicator component now utilize the new allowPlanMode prop, and the internal prop name isPlanEnabled has been renamed to allowPlanMode for consistency.
  • Comprehensive Testing and Documentation: New unit tests have been added for Plan Mode availability in AppContainer.test.tsx, and user-facing documentation (docs/cli/keyboard-shortcuts.md, docs/cli/plan-mode.md) has been updated to reflect this behavioral change.
Changelog
  • docs/cli/keyboard-shortcuts.md
    • Updated the description for the Shift+Tab shortcut to clarify that Plan Mode is skipped when the agent is busy.
  • docs/cli/plan-mode.md
    • Added a note to the Plan Mode entry explaining that it is automatically removed from the rotation when the agent is actively processing or showing confirmation dialogs.
  • packages/cli/src/test-utils/render.tsx
    • Added allowPlanMode with a default value of true to the base mock UI state for testing purposes.
  • packages/cli/src/ui/AppContainer.test.tsx
    • Imported StreamingState enum for use in tests.
    • Added a new test suite for 'Plan Mode Availability' to verify correct behavior when Plan Mode is enabled/disabled, streaming, or awaiting tool confirmation.
  • packages/cli/src/ui/AppContainer.tsx
    • Removed the initial declaration of showApprovalModeIndicator.
    • Introduced a new allowPlanMode constant, computed based on config.isPlanEnabled(), streamingState, and hasPendingActionRequired.
    • Re-declared showApprovalModeIndicator to include the new allowPlanMode prop.
    • Added allowPlanMode to the UIState object passed to the context provider.
  • packages/cli/src/ui/components/ApprovalModeIndicator.test.tsx
    • Updated test cases to use allowPlanMode prop instead of isPlanEnabled.
  • packages/cli/src/ui/components/ApprovalModeIndicator.tsx
    • Renamed the isPlanEnabled prop to allowPlanMode in the ApprovalModeIndicatorProps interface.
    • Updated the component's destructuring and logic to use allowPlanMode instead of isPlanEnabled.
  • packages/cli/src/ui/components/Composer.tsx
    • Updated the ApprovalModeIndicator component to pass uiState.allowPlanMode instead of config.isPlanEnabled().
  • packages/cli/src/ui/contexts/UIStateContext.tsx
    • Added allowPlanMode: boolean; to the UIState interface.
  • packages/cli/src/ui/hooks/useApprovalModeIndicator.test.ts
    • Removed a redundant test case for cycling through approval modes when plan is enabled.
    • Added allowPlanMode to the UseApprovalModeIndicatorArgs in test setups.
    • Added new test cases to verify cycling behavior when allowPlanMode is true or false.
  • packages/cli/src/ui/hooks/useApprovalModeIndicator.ts
    • Added allowPlanMode?: boolean; to the UseApprovalModeIndicatorArgs interface.
    • Updated the useApprovalModeIndicator function to accept allowPlanMode with a default of false.
    • Modified the approval mode cycling logic to use the allowPlanMode prop instead of config.isPlanEnabled() when determining the next mode after AUTO_EDIT.
Activity
  • The pull request author provided a detailed summary of the changes, including a breakdown of specific implementation details, related issues, and comprehensive validation steps.
  • The author outlined the consolidation of Plan Mode availability logic and its integration into the UI components and hooks.
  • Unit tests were added to ensure the correct behavior of the new Plan Mode availability logic.
  • Documentation for keyboard shortcuts and Plan Mode was updated to reflect the new conditional behavior.
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 effectively removes Plan Mode from the approval mode rotation when the agent is busy, as described. The implementation is clean and well-structured. I appreciate the refactoring that consolidates the logic for Plan Mode availability into a new allowPlanMode state variable in AppContainer and passes it down, decoupling the useApprovalModeIndicator hook from this logic. The accompanying updates to tests and documentation are thorough and accurate. Overall, this is a high-quality change with no issues found.

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Size Change: +190 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB +190 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

- Use `streamingState === StreamingState.Idle && !hasPendingActionRequired` for `allowPlanMode`.
- Consolidate Plan Mode availability logic into `allowPlanMode` prop.
- Update `AppContainer` to pass computed `allowPlanMode` to `useApprovalModeIndicator` hook and `ApprovalModeIndicator` component.
- Rename `isPlanEnabled` prop to `allowPlanMode` in `ApprovalModeIndicator` for consistency.
- Reorder state logic in `AppContainer` to avoid 'used before declaration' errors.
- Add unit tests for `allowPlanMode` in `AppContainer.test.tsx`.

Fixes #19021
@jerop jerop force-pushed the fix/remove-plan-mode-active-rotation branch from b5242b4 to 6b2d8d5 Compare February 17, 2026 16:55
@jerop jerop enabled auto-merge February 17, 2026 16:56
@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 17, 2026
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm
Please cleanup the tests as part of a follow up. they look like a good candidate for parameterization to reduce duplicate code.

);
});

it('should cycle to PLAN when allowPlanMode is true', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: parameterize these two tests.

describe('Plan Mode Availability', () => {
it('should allow plan mode when enabled and idle', async () => {
vi.spyOn(mockConfig, 'isPlanEnabled').mockReturnValue(true);
mockedUseGeminiStream.mockReturnValue({
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please parameterize these tests as well

@jerop jerop added this pull request to the merge queue Feb 17, 2026
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

Summary
This PR successfully removes Plan Mode from the Shift+Tab approval mode rotation when the CLI is actively working (streaming or awaiting a tool confirmation). This is a solid UX improvement that prevents users from accidentally cycling into Plan Mode while waiting for an ongoing action to complete or while dealing with confirmation dialogs.

Findings

  • Critical: None. The changes are logically sound, cleanly implemented, and covered by new tests. All npm run preflight checks pass locally.
  • Improvements: The logic correctly avoids forcing a mode switch if the user is already in Plan Mode when an action starts, while ensuring they cannot cycle back into it until the CLI is idle again. allowPlanMode is well-integrated with useApprovalModeIndicator and correctly replaces the previous usage of isPlanEnabled. The hasPendingActionRequired check provides a robust way of ensuring the agent is fully idle before allowing the switch.
  • Nitpicks: None. The documentation and keyboard shortcut updates correctly reflect the new behavior.

Conclusion
Approved. The code is clean, tests are comprehensive, and validation checks passed without issues. Excellent contribution!

Merged via the queue into main with commit fb32db5 Feb 17, 2026
26 of 27 checks passed
@jerop jerop deleted the fix/remove-plan-mode-active-rotation branch February 17, 2026 17:51
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] Remove plan mode from rotation in mode cycling when actively working

2 participants