feat(plan): hide plan write and edit operations on plans in Plan Mode#19012
feat(plan): hide plan write and edit operations on plans in Plan Mode#19012
Conversation
Summary of ChangesHello @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 improves the user experience in the CLI's 'Plan Mode' by intelligently filtering out certain tool operations from the main terminal history. Specifically, 'WriteFile' and 'Edit' operations are no longer displayed in the history when the agent is in Plan Mode, as their outcomes are presented through a dedicated planning UI. This change centralizes the logic for determining tool visibility, making the UI cleaner and more focused on relevant information for the user. Highlights
Changelog
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 effectively hides WriteFile and Edit tool operations from the UI when in Plan Mode, which is a great enhancement to reduce redundancy. The approach of storing the approvalMode on the ToolCall object is solid, ensuring that the visibility state is preserved even if the application's mode changes. The refactoring of shouldHideAskUserTool into a more generic shouldHideToolCall utility is a commendable improvement for maintainability, centralizing the logic for tool visibility. The changes to propagate the approvalMode through the schedulers and state manager are implemented correctly and consistently. The addition of new tests and the updates to existing ones provide good coverage for the new functionality. Overall, this is a well-executed feature with clean and robust changes.
|
Size Change: +2.19 kB (+0.01%) Total Size: 24.4 MB
ℹ️ View Unchanged
|
|
note: failing windows tests are flaky (unrelated to these changes) |
jacob314
left a comment
There was a problem hiding this comment.
Approved once shouldHideToolCall is mode to package/core
ab4fb5c to
3062a54
Compare
This change hides 'WriteFile' and 'Edit' tool operations from the terminal history when they are executed while the agent is in Plan Mode. This avoids redundancy because the resulting plans are displayed in a specialized UI separately upon exiting plan mode. Insights & Decisions: - We store 'approvalMode' directly on the 'ToolCall' status objects in the scheduler. This ensures that tool calls remain hidden even after the CLI transitions out of Plan Mode, preventing them from suddenly 'popping' back into history during a re-render. - Refactored 'shouldHideAskUserTool' into a generic 'shouldHideToolCall' utility in 'packages/cli/src/ui/utils/toolUtils.ts'. This centralizes the logic for hiding tools that are either redundant or handled by specialized UI (like in-progress 'Ask User' calls). - Updated 'Scheduler' and 'CoreToolScheduler' to capture and propagate the active 'approvalMode' at the time of tool invocation. - Preserved 'approvalMode' across all tool call state transitions in the 'SchedulerStateManager'. Alternatives Considered: - Path-based hiding (checking if a write targets the 'plansDir'): Rejected because it is less semantic and would require adding complex path normalization/comparison logic and tool arguments to the UI display layer. - Reading current mode from config: Rejected because history items would reappear as soon as the user exited Plan Mode. - Modifying the request object: Rejected to keep the request metadata clean of execution-phase context. Verified with unit tests in both core and cli packages. Fixes #18918
69c2d16 to
de93ddf
Compare

This change hides 'WriteFile' and 'Edit' tool operations from the terminal history when they are executed while the agent is in Plan Mode. This avoids redundancy because the resulting plans are displayed in a specialized UI separately for approval.
Details:
Alternatives Considered:
Fixes #18918