Core data structure updates for Rewind functionality - #15714
Conversation
Summary of ChangesHello @Adib234, 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 significant new feature allowing users to "rewind" their chat conversations to a previous state, enhancing conversational control. Concurrently, it refines how file modification details are captured and displayed by tools, providing more comprehensive information such as the full file path and whether a file is newly created. These changes improve both the user experience for managing chat history and the accuracy of tool interaction feedback. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
|
Size Change: +1.56 kB (+0.01%) Total Size: 22.3 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a "rewind" capability for chat sessions and refactors the data structures for file diffs. The core changes include:
- A new
rewindTomethod inChatRecordingServiceto truncate chat history. - Enhanced chat compression logic in
GeminiClientto preserve and resume session data, preventing loss of context. - The
FileDiffinterface and related objects have been updated to includefilePathandisNewFileproperties, with corresponding changes propagated through tool implementations and tests.
The changes are well-implemented and consistent across the codebase. The new logic for session resumption during compression is covered by a new test case. I have reviewed the changes and did not find any issues of high or critical severity. The code quality is good.
| const resultDisplayRaw = call.response?.resultDisplay; | ||
| const resultDisplay = | ||
| typeof resultDisplayRaw === 'string' ? resultDisplayRaw : undefined; | ||
| const resultDisplay = call.response?.resultDisplay; |
There was a problem hiding this comment.
why did this logic change? seems unrelated to the pr.
There was a problem hiding this comment.
restored logic and added an additional check to make sure that resultDisplay can get assigned to an object. Since it's type is ToolResultDisplay we want it to be assigned to FileDiff as well so that we have the necessary information to perform a rewind
|
Gemini CLI - Reviewed by Jacob 1. Robustness in ChatRecordingService.tsThe 2. UI Integration of New MetadataThe PR enriches
|
545599e to
2ebfff0
Compare
|
Addressed the issue with the robustness of in |
8231747 to
588f46c
Compare
| const resultDisplayRaw = call.response?.resultDisplay; | ||
| const resultDisplay = | ||
| typeof resultDisplayRaw === 'string' ? resultDisplayRaw : undefined; | ||
| typeof resultDisplayRaw === 'string' || |
There was a problem hiding this comment.
I'm confused why this change is part of the PR. Approving to unblock reviewing the followup but please review whether this is needed.

Summary
This PR introduces foundational changes to the core data structures and services to support a new "Rewind" feature. It enables the truncation of chat history, ensures session continuity across context resets, and enriches file operation results with metadata necessary for future undo capabilities.
Details
GeminiClientnow captures the current session's conversation data and file path before restarting the chat (e.g., during context compression), ensuring the session file is preserved and correctly resumed.rewindTo(messageId)method has been added to ChatRecordingService. This allows the conversation history to be truncated to a specific message, effectively "rewinding" the chat state.FileDiffinterface and associated tools (edit, smart-edit, write-file) have been updated to include filePath and isNewFile properties. This provides the essential data required to potentially revert file creations and modifications in the future.geminiChat.tsandcoreToolScheduler.tswere updated to handle the expanded ToolResultDisplay types and ensure file path information is propagated correctly through the system.Related Issues
After this PR gets merged here are the other PRs that will get reviewed in order
#15715
#15716
#15717
#15718
#15720
How to Validate
Pre-Merge Checklist