Skip to content

Conversation

sgnagnarella
Copy link
Contributor

TLDR

  • Refactored /memory refresh command to make sure it uses loadHierarchicalGeminiMemory to match the initial memory load on gemini.tsx
  • Made sure that the number of files in the UI was also refreshed as part of this command call.
  • Used the right call to determine folder trust in this context.
  • Fixed file filtering options to use the same defaults across the board coming from DEFAULT_MEMORY_FILE_FILTERING_OPTIONS when no values exist in settings.json
  • Fixed tests and integrations tests across the board

Dive Deeper

Reviewer Test Plan

  1. Start Gemini CLI trusting the workspace folder
  2. Run /memory refresh
  3. Number of GEMINI.md files used should match the initial load
  4. Create a new GEMINI.md file within the workspace folder stracture
  5. Run /memory refresh
  6. The new number of GEMINI.md files in use should have incremented by 1

Testing Matrix

🍏 🪟 🐧
npm run X
npx X
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

- Refactored /memory refresh command to make sure it uses loadHierarchicalGeminiMemory to match the initial memory load on gemini.tsx
- Made sure that the number of files in the UI was also refreshed as part of this command call.
- Used the right call to determine folder trust in this context.
- Fixed file filtering options to use the same defaults accross the board comming from DEFAULT_MEMORY_FILE_FILTERING_OPTIONS
- Fixed tests and integrations tests across the board
@sgnagnarella sgnagnarella requested a review from a team as a code owner October 6, 2025 18:32
Copy link
Contributor

Summary of Changes

Hello @sgnagnarella, 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 a critical bug where the /memory refresh command could lead to discrepancies in the loaded memory compared to the initial application startup. The core issue stemmed from inconsistent memory loading and file filtering mechanisms. By refactoring the refresh command to leverage the same hierarchical memory loading function used during initial setup, and by standardizing file filtering defaults and folder trust checks, this PR ensures that memory refreshes accurately reflect the intended configuration and file set, thereby improving the reliability and predictability of the CLI's memory management.

Highlights

  • Memory Refresh Consistency: The /memory refresh command has been refactored to consistently use loadHierarchicalGeminiMemory, ensuring its behavior matches the initial memory load process on gemini.tsx.
  • UI File Count Refresh: The number of files displayed in the UI is now correctly refreshed as part of the /memory refresh command execution, providing accurate real-time feedback.
  • Folder Trust Logic: The logic for determining folder trust within the memory refresh context has been updated to use the correct isTrustedFolder call.
  • File Filtering Defaults: File filtering options now consistently use DEFAULT_MEMORY_FILE_FILTERING_OPTIONS when no specific values are present in settings.json, ensuring uniform behavior.
  • Test Suite Updates: All relevant tests and integration tests have been updated to reflect these changes and ensure continued correctness.
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 correctly refactors the /memory refresh command to use the same memory loading logic as the initial startup, fixing inconsistencies with file filtering and folder trust settings. The changes align the refresh behavior with the initial load by using the loadHierarchicalGeminiMemory wrapper and updating the UI with the new file count. My review includes one high-severity suggestion regarding a change in the @google/gemini-cli-core package. While the fix for the CLI is correct, changing the default file filtering options in the core Config class to be memory-specific could introduce subtle bugs in other areas. I've recommended using more generic defaults in the core package and letting the CLI layer handle the specifics, which would improve the overall architecture and prevent potential side effects.

targetDir: tempDir,
debugMode: false,
fileFilteringRespectGitIgnore: undefined, // Should default to true
fileFilteringRespectGitIgnore: undefined, // Should default to DEFAULT_FILE_FILTERING_OPTIONS
Copy link
Member

Choose a reason for hiding this comment

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

Super nit: DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes good catch!

if (config) {
const { memoryContent, fileCount, filePaths } =
await loadServerHierarchicalMemory(
await loadHierarchicalGeminiMemory(
Copy link
Member

Choose a reason for hiding this comment

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

Confirmed that these are wrappers of each other.

LG.

@shrutip90
Copy link
Collaborator

LGTM for the folder trust related changes. Thanks for fixing!

@bdmorgan bdmorgan added this pull request to the merge queue Oct 10, 2025
Merged via the queue into google-gemini:main with commit 971eb64 Oct 10, 2025
19 checks passed
SandyTao520 pushed a commit that referenced this pull request Oct 10, 2025
…ncies with initial memory load ignoring settings/config for trusted folder and file filters (#10611)

Co-authored-by: Bryan Morgan <[email protected]>
thacio added a commit to thacio/auditaria that referenced this pull request Oct 11, 2025
… /memory refresh will create discrepancies with initial memory load ignoring settings/config for trusted folder and file filters (google-gemini#10611)
medic-code pushed a commit to medic-code/gemini-cli that referenced this pull request Oct 18, 2025
…eate discrepancies with initial memory load ignoring settings/config for trusted folder and file filters (google-gemini#10611)

Co-authored-by: Bryan Morgan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/memory refresh removes workspace context with folderTrust feature default disabled

4 participants