fix(cli): restore YOLO mode after exiting Plan mode-new - #19625
fix(cli): restore YOLO mode after exiting Plan mode-new#19625Manik-Khajuria-5 wants to merge 1 commit into
Conversation
Summary of ChangesHello @Manik-Khajuria-5, 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 an issue where the CLI's approval mode would incorrectly revert to Default after exiting Plan mode, even when initially launched in YOLO mode. The changes introduce a robust mechanism to remember the initial approval state and ensure that exiting Plan mode restores the correct, original approval setting, thereby maintaining the intended user experience for YOLO mode users. Highlights
Changelog
Activity
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.
Code Review
This pull request successfully addresses an issue where YOLO mode was not correctly restored after exiting Plan mode. The solution involves tracking the initial approval mode and implementing separate cycling logic for sessions started in YOLO mode versus default mode. The changes are well-tested with new test cases covering both scenarios. I have one suggestion to improve performance and code quality in the useApprovalModeIndicator hook, which has been retained as it aligns with general best practices and is not contradicted by any specific rules.
|
This is fixed in #19570 where we removed EnterPlanMode tool from YOLO mode - we want to be careful about switching to YOLO without user action |
Fixes #19592
Problem
When starting with
gemini --yolo, entering Plan mode (Shift+Tab) and then exiting with Shift+Tab always returned to Default/Manual instead of YOLO. Tool execution then required confirmation instead of staying auto-approved.Solution
--yolo, otherwise DEFAULT). This is used when leaving Plan so we restore the right mode.--yolo): YOLO → DEFAULT → AUTO_EDIT → PLAN → YOLO (repeat).Changes
packages/cli/src/ui/hooks/useApprovalModeIndicator.ts: AddedinitialModeRefto capture mode at CLI open; cycle logic uses it so Plan exit restores YOLO or DEFAULT and the two sequences above are correct.packages/cli/src/ui/hooks/useApprovalModeIndicator.test.ts: Tests for YOLO restore after Plan, default sequence (DEFAULT → PLAN → AUTO_EDIT → DEFAULT), and updated expectations for initialgetApprovalModecall count and cycle behavior.Testing
npm run preflight(ornpm run testinpackages/cli) — all tests pass.Manual: Start with
gemini --yolo, press Shift+Tab until Plan, then Shift+Tab again → returns to YOLO.Updated relevant documentation and README (if needed)
Added/updated tests (if needed)
Noted breaking changes (if any)
Validated on required platforms/methods: