Skip to content

fix(cli): preserve legacy auto memory behavior#25625

Open
jasonmatthewsuhari wants to merge 3 commits intogoogle-gemini:mainfrom
jasonmatthewsuhari:issue/25623-memorymanager-automemory-regression
Open

fix(cli): preserve legacy auto memory behavior#25625
jasonmatthewsuhari wants to merge 3 commits intogoogle-gemini:mainfrom
jasonmatthewsuhari:issue/25623-memorymanager-automemory-regression

Conversation

@jasonmatthewsuhari
Copy link
Copy Markdown
Contributor

Fixes #25623

Summary

Restore backward-compatible Auto Memory behavior for existing users who only have experimental.memoryManager = true in settings.

What changed

  • Add a CLI-load compatibility fallback so experimentalAutoMemory inherits from experimental.memoryManager only when experimental.autoMemory is not explicitly set.
  • Preserve explicit opt-out behavior when experimental.autoMemory = false.
  • Add regression tests covering both the legacy compatibility case and the explicit override case.

Why

After the flag split, existing users could still have the memory manager enabled but lose /memory inbox access and background Auto Memory startup unless they manually added the new flag. This restores the old behavior for legacy configs without collapsing the new flag split.

Testing

  • node scripts/generate-git-commit-info.js
  • C:\Users\Jason\Documents\GitHub\gemini-cli\node_modules\.bin\vitest.cmd run src/config/config.test.ts --coverage.enabled=false
  • C:\Users\Jason\Documents\GitHub\gemini-cli\node_modules\.bin\vitest.cmd run src/ui/commands/memoryCommand.test.ts --coverage.enabled=false

@jasonmatthewsuhari jasonmatthewsuhari requested a review from a team as a code owner April 18, 2026 14:49
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 regression introduced by a recent flag split in the CLI configuration. It restores the expected behavior for legacy users who relied on the memory manager to implicitly enable auto-memory features, while maintaining the ability for users to explicitly opt-out of these features.

Highlights

  • Backward Compatibility: Implemented a fallback mechanism in the CLI configuration loader to ensure that experimentalAutoMemory inherits the value of experimental.memoryManager when not explicitly defined.
  • Explicit Override Preservation: Ensured that users who have explicitly set experimental.autoMemory to false retain that configuration, preventing the fallback from overriding their preference.
  • Regression Testing: Added new test cases to verify both the legacy compatibility behavior and the correct handling of explicit configuration overrides.
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.

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
Copy Markdown
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 implements backward compatibility for the autoMemory configuration flag by falling back to the memoryManager setting when autoMemory is not explicitly defined. While the logic and tests are added, the reviewer noted a potential issue: if the configuration schema defines a default value for autoMemory, the nullish coalescing operator will not trigger the fallback. The current tests use a delete operation to simulate an undefined state, which suggests that the schema or the implementation should be refined to ensure the legacy behavior is correctly restored without workarounds.

Comment thread packages/cli/src/config/config.ts Outdated
Comment thread packages/cli/src/config/config.test.ts Outdated
@jasonmatthewsuhari
Copy link
Copy Markdown
Contributor Author

Addressed the Gemini Code Assist findings in two follow-up commits. The compatibility fix now happens during settings merge, where we can still distinguish an explicit experimental.autoMemory setting from a schema defaulted value, and the regression coverage now goes through loadSettings() instead of deleting a field from a synthetic merged object. Verified with
px vitest run packages/cli/src/config/settings.test.ts packages/cli/src/config/config.test.ts.

@gemini-cli gemini-cli bot added the area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality label Apr 18, 2026
@jasonmatthewsuhari
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
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 introduces backward compatibility for memory management settings. It adds a hasOwnNestedProperty helper to detect if experimental.autoMemory has been explicitly configured in any settings source. In the mergeSettings function, if autoMemory is not explicitly set but the legacy memoryManager is enabled, autoMemory is now automatically enabled. Unit tests have been added to ensure this logic works correctly and that explicit overrides are respected. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: existing experimental.memoryManager users lose /memory inbox and Auto Memory behavior after flag split

1 participant