fix(plan): prevent plan truncation in approval dialog by supporting unconstrained heights#21037
fix(plan): prevent plan truncation in approval dialog by supporting unconstrained heights#21037
Conversation
Summary of ChangesHello, 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 resolves an issue where the CLI's plan approval dialog would truncate lengthy plans, displaying only the first 15 lines. The changes implement a flexible height mechanism for dialogs, allowing them to expand and utilize available terminal space to show complete plan content. This enhancement significantly improves the review process for complex or extensive plans by ensuring full visibility. 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 introduces an unconstrainedHeight option to prevent truncation of long content in approval dialogs, which is a great improvement for usability. The implementation is mostly correct, but I've identified a potential issue in the height calculation within the generic AskUserDialog component. The current logic could lead to UI issues in other scenarios with many options. I've provided a suggestion to make the height calculation more robust and future-proof.
|
Size Change: +119 B (0%) Total Size: 26.2 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request enhances the Gemini CLI by preventing plan truncation in the approval dialog, introducing an unconstrainedHeight property to the Question interface for dynamic height adjustment and improved user experience. However, this change introduces a critical security vulnerability: an increased risk of terminal escape sequence injection. The LLM-generated plan content is rendered without sanitization, which could allow an attacker to manipulate the terminal UI and trick users into approving malicious actions. It is highly recommended to add sanitization for the plan content before it is displayed.
7044441 to
5bc8ac4
Compare
…constrained heights Fixes #20716
3110789 to
7490f28
Compare
eb9ff67 to
e37954a
Compare
|
I completely agree with the goal of this PR! Expanding the vertical space for the However, looking at the code, I noticed the addition of a magic number ( Root Cause: By artificially subtracting those 5 lines from the available container height, all history items (and dialogs within them) were being forced to truncate 5 lines shorter than necessary, leading to the need for the The Fix: Let me know if you agree with this approach! I have a fix ready locally and can push it to this PR if needed. |
|
/patch preview |
|
🚀 [Step 1/4] Patch workflow(s) waiting for approval! 📋 Details:
⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs. 🔗 Track Progress: |
…nconstrained heights (#21037) Co-authored-by: jacob314 <jacob314@gmail.com>
|
🚀 [Step 2/4] Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 [Step 3/4] Patch Release Waiting for Approval! 📋 Release Details:
⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes. 🔗 Track Progress: |
|
✅ [Step 4/4] Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
…nconstrained heights (google-gemini#21037) Co-authored-by: jacob314 <jacob314@gmail.com>
…nconstrained heights (google-gemini#21037) Co-authored-by: jacob314 <jacob314@gmail.com>
…nconstrained heights (google-gemini#21037) Co-authored-by: jacob314 <jacob314@gmail.com>
…nconstrained heights (google-gemini#21037) Co-authored-by: jacob314 <jacob314@gmail.com>

Summary
Fixes the plan approval dialog so that it displays the full plan without truncating it at 15 lines. This improves the workflow for reviewing long plans by letting the plan content take up the maximum vertical space available.
Details
unconstrainedHeight?: boolean;property to theQuestioninterface inpackages/core/src/confirmation-bus/types.ts.ChoiceQuestionViewinpackages/cli/src/ui/components/AskUserDialog.tsxto utilizeunconstrainedHeight. When true, it dynamically calculates the maximum question height based on the available terminal height and the number of selection items, bypassing the hard-coded 15-line limit.unconstrainedHeight: trueon the question object insideExitPlanModeDialog.tsx.ExitPlanModeDialogsnapshot tests to reflect the new un-truncated UI.Related Issues
Fixes #20716
How to Validate
gemini->/plan/actorCtrl+C).AskUserDialoginstances (like multi-choice settings dialogs) remain unaffected.Pre-Merge Checklist