fix(core): handle EISDIR on virtual drives in memory discovery#26985
Conversation
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 significantly improves the robustness of the Gemini CLI by addressing a critical crash on Windows systems. It refines the path resolution mechanism within the memory discovery module, ensuring that the application can correctly handle scenarios involving virtual drive roots without encountering unhandled errors. This change enhances the overall stability and user experience for Windows users. 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 refactors the path resolution logic in packages/core/src/utils/memoryDiscovery.ts by introducing a resolveToRealPath helper function. This change replaces direct fs.realpath calls to improve consistency and maintainability when handling symlinks during directory comparisons. There are no review comments to address.
|
Size Change: -48 B (0%) Total Size: 34.1 MB
ℹ️ View Unchanged
|
Summary
Fixes a crash when the Gemini CLI is launched from a virtual drive root (e.g.,
A:\) on Windows. The crash was caused by an unhandledEISDIRerror fromfs.realpathin the memory discovery logic.Details
In
loadServerHierarchicalMemory, the code was callingfs.realpathdirectly on the current working directory and home directory. On some Windows setups with virtual drives, this call can throwEISDIRfor directory roots. This PR replaces these direct calls with the robustresolveToRealPathutility frompackages/core/src/utils/paths.ts, which already handlesEISDIRandENOENTby falling back to manual path resolution.Related Issues
Closes #25216
How to Validate
fs.realpathSyncthrowsEISDIRfor certain paths.npm test -w @google/gemini-cli-core -- src/utils/memoryDiscovery.test.tsPre-Merge Checklist