feat(cli): implemented Git-backed Named Checkpoints and Session Reversion#17965
feat(cli): implemented Git-backed Named Checkpoints and Session Reversion#17965AasheeshLikePanner wants to merge 3 commits intogoogle-gemini:mainfrom
Conversation
Introduces /checkpoint, /revert, and /undo commands. Uses a Shadow Git repository to synchronize file state with conversation history. Includes auto-checkpointing before user prompts.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @AasheeshLikePanner, 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 introduces a robust session management system to the CLI, allowing users to save, restore, and undo changes to their project and conversation history. By leveraging a shadow Git repository for file state and integrating conversation history, it provides a powerful mechanism for developers to manage their interactive coding sessions, recover from errors, and explore different solutions with confidence. 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.
Code Review
This pull request introduces a robust checkpointing and session reversion system with /checkpoint, /revert, and /undo commands, which is a great addition for managing session state. The implementation, including the use of a shadow Git repository and auto-checkpointing, is well-structured. My review identified one high-severity issue where a failure to create a file snapshot during checkpointing could silently fall back to an older state, potentially leading to user confusion or data loss upon reversion. I've provided a suggestion to address this by ensuring failures are propagated to the user.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Closing because of closed issue #17967 |
Summary
This PR implements a robust Named Checkpoint system for the Gemini CLI, allowing users to save and restore atomic snapshots of both their project files and conversation history. This feature bridges the gap between simple chat "rewinding" and professional-grade session management.
Details
Unlike the existing
/rewindcommand which uses heuristic patches, this system leverages the CLI's Shadow Git infrastructure to create 100% reliable state snapshots.Key Design Decisions:
GitService.createFileSnapshotto ensure that every restoration is byte-perfect, even if files were modified manually between turns.ChatRecordingServiceis truncated to the matchingmessageId, and theContextManageris force-refreshed. This ensures the LLM's "memory" perfectly matches the restored code state.New Commands:
/checkpoint <name>: Create a labeled milestone./revert [name]: Restore a specific state (includes an interactive selection UI if no name is provided)./undo: Instant one-step rollback of the last turn.Related Issues
Closes #17967
How to Validate
settings.json("general": { "checkpointing": { "enabled": true } })./checkpoint stable-start./revert(no arguments) and use the arrow keys to selectstable-start./undoto verify the instant rollback.Pre-Merge Checklist
docs/cli/checkpointing.md)packages/core/src/utils/checkpointUtils.test.ts, etc.)