Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @shrutip90, 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 introduces a new feature to display the trust status of the current working folder directly in the application's footer. The primary goal is to enhance user awareness by clearly indicating when a folder is considered 'untrusted', while maintaining a clean interface by not showing any status for trusted folders. This change involves updates to how folder trust is determined based on application settings, improvements to UI state management for reactivity, and expanded test coverage to ensure reliability.
Highlights
- Footer Trust Status Display: The application's footer now visually indicates if the current folder is 'untrusted', providing immediate security context to the user. This status is only displayed for untrusted folders; trusted folders show no specific status.
- Enhanced Folder Trust Logic: The
isWorkspaceTrustedfunction, which determines the trust level of a folder, has been updated to accept applicationsettingsas an argument. This allows the trust evaluation to correctly consider feature flags and configuration settings, ensuring accurate trust assessments. - UI State Management and Reactivity: The
Appcomponent now manages the folder trust state and passes it down to theFootercomponent. TheuseFolderTrusthook has been refactored to provide the current trust status and a callback to update this status, ensuring a reactive UI based on user interactions or configuration changes. - Improved Test Coverage: Comprehensive new test cases have been added for the
Footercomponent to verify the correct display of untrusted status and various sandbox information. Existing tests forAppanduseFolderTrusthave been updated to reflect the new state management and trust evaluation mechanisms.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to display an 'untrusted' status in the footer when the current folder is not trusted. The changes include refactoring the folder trust logic for better centralization and updating the UI components and hooks accordingly. The implementation is solid and well-tested. I've identified one high-severity performance issue in the useFolderTrust hook where dependencies could cause excessive re-renders and file I/O. My review includes a suggestion to resolve this.
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
I have also encountered this problem. |
There was a problem hiding this comment.
Most of the business logic should go into the core package and not the CLI package. We use core in places without the CLI package, for example in vs code agent mode.
There was a problem hiding this comment.
agree would be good to move this logic to the core package. Sorry I missed that on the previous pr!
There was a problem hiding this comment.
there is a corresponding config.ts in core where you will want to make sure the folder trusted setting is passed to.
There was a problem hiding this comment.
I do have the trustedFolder values in core/config too:
gemini-cli/packages/core/src/config/config.ts
Line 678 in 4973e7e
I had kept this here, since I thought this is similar to the parsing of settings file. But I can try to move it...
Will do it in another PR.
jacob314
left a comment
There was a problem hiding this comment.
Looks good. Will approve once the trustedFolders logic has been mored to Core.
There was a problem hiding this comment.
agree would be good to move this logic to the core package. Sorry I missed that on the previous pr!
There was a problem hiding this comment.
there is a corresponding config.ts in core where you will want to make sure the folder trusted setting is passed to.
| setIsFolderTrustDialogOpen(trusted === undefined); | ||
| onTrustChange(trusted); | ||
| }, [onTrustChange, settings.merged]); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
don't suppress this lint. it is required for robust react behavior. same bellow.
jacob314
left a comment
There was a problem hiding this comment.
Approved once the react dependencies issue is addressed.
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>

TLDR
Show untrusted status in the Footer only when the folder is untrusted. This will replace the sandbox info.
For trusted folders, we do not show any status.
Dive Deeper
Screenshot:

Reviewer Test Plan
Testing Matrix
Linked issues / bugs
Related to https://github.com/google-gemini/maintainers-gemini-cli/issues/640