fix(core): handle invalid custom plans directory gracefully#26560
fix(core): handle invalid custom plans directory gracefully#26560
Conversation
|
Size Change: +442 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
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 a crash in the Gemini CLI occurring during startup when a custom plans directory is misconfigured. By introducing robust error handling during the configuration initialization phase, the CLI can now detect invalid paths, notify the user, and safely fall back to the default storage location instead of terminating unexpectedly. Highlights
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 the 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 counterproductive. 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
|
There was a problem hiding this comment.
Code Review
This pull request implements a fallback mechanism for the plans directory initialization in Config.ts, ensuring that if a custom directory cannot be retrieved, the system reverts to the default project temporary directory. A new test case validates this graceful fallback and the emission of a warning. The review feedback recommends broadening the error handling to catch non-Error objects and improving debuggability by including the original error in the feedback emission.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces error handling for the plans directory initialization in the Config class. It now wraps the retrieval of the plans directory in a try-catch block, ensuring that if a custom directory is invalid, the system emits a warning feedback and gracefully falls back to the default project temporary directory. A new test case has been added to config.test.ts to verify this fallback logic and the associated warning emission. I have no feedback to provide as there were no review comments to evaluate.
Summary
This PR addresses a crash in the Gemini CLI (issue #25566) caused by an unhandled promise rejection during startup. The crash occurred when a customPlansDir was configured outside the project root, triggering a validation error that wasn't caught in Config._initialize().
Details
Updated Config._initialize() in
packages/core/src/config/config.tsto wrap the this.storage.getPlansDir() call in a try/catch block. If an error occurs, the CLI now:Related Issues
Fixes #25566
How to Validate
npm test -w @google/gemini-cli-core -- src/config/config.test.ts.Pre-Merge Checklist