-
Notifications
You must be signed in to change notification settings - Fork 10.9k
fix: persist and restore workspace directories on session resume #17454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: persist and restore workspace directories on session resume #17454
Conversation
…when added via `/dir add` and on session resume.
…iles when added via `/dir add`.
Summary of ChangesHello @korade-krushna, 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 issue where workspace directories added during a session were not preserved when resuming that session. The changes ensure that any directories added by the user are now correctly saved and automatically restored, providing a more consistent and reliable user experience across sessions. 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 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 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
|
There was a problem hiding this 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 effectively addresses the issue of persisting and restoring workspace directories across sessions. The user experience during session restoration could be improved by notifying the user if any directories from the previous session could not be restored, preventing silent failures and confusion. The initial high-severity security concern was re-evaluated and deemed not applicable, as paths originating from a local user's session file are considered user-provided in a CLI context.
|
I have reviewed PR 17454. The intent to persist and restore workspace directories added via Regarding the tests and React logic, I have one piece of feedback (manual review from
I have also flagged this change to |
jacob314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Head branch was pushed to by a user without write access
|
@jacob314 all the failed CI checks are addressed and fixed now |

Summary
This PR fixes issue #17409 where directories added via
/dir adddid not persist across sessions when using the--resumeflag. It ensures that any directories added to the workspace during a session are serialized to the session JSON file and automatically restored upon resumption.Details
The fix involves the following changes:
directoriesfield to the ConversationRecord interface in packages/core/src/services/chatRecordingService.ts and a corresponding recordDirectories method to save the current workspace state./dir addcommand in packages/cli/src/ui/commands/directoryCommand.tsx to persist the updated directory list to the session file immediately after a successful addition.Related Issues
Closes #17409
How to Validate
npm run start/dir add ./some-local-folder/dir show/exitorCtrl+Cnpm run start -- --resume/dir shownpm test -w @google/gemini-cli-core -- src/services/chatRecordingService.test.tsnpm test -w @google/gemini-cli -- src/ui/hooks/useSessionResume.test.tsnpm testVideo
Screen.Recording.2026-01-25.at.12.31.51.AM.mov
Pre-Merge Checklist