feat: implement /rewind command - #15720
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: the 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new "/rewind" command, enabling users to navigate back to a specific point in their conversation history and optionally revert associated file changes. The implementation correctly integrates with the existing command loading mechanism and UI state management. The changes to atCommandProcessor.ts for handling referenced content headers are also a good improvement for output clarity. The new test file for rewindCommand provides good coverage for various scenarios.
2ddfa74 to
4c4cb62
Compare
981efc2 to
7b23a67
Compare
965a708 to
09f82c0
Compare
37f0ec3 to
7dcdd0b
Compare
|
The implementation of the Actionable Feedback:
Observations:
|
|
commits address the following:
This is consistent with other slash commands |
| [Command.HISTORY_DOWN]: [{ key: 'n', shift: false, ctrl: true }], | ||
| [Command.REVERSE_SEARCH]: [{ key: 'r', ctrl: true }], | ||
| [Command.REWIND]: [{ key: 'double escape' }], | ||
| // Note: original logic ONLY checked ctrl=false, ignored meta/shift/paste |
There was a problem hiding this comment.
please revert the comment on line 193. I assume it is an error.
| if (conversation) { | ||
| await revertFileChanges(conversation, messageId); | ||
| } | ||
| // Proceed to rewind logic |
There was a problem hiding this comment.
nit: having these // Proceed to rewind logic comments i a code smell. Instead call a
rewindConversation helper from both places with this logic. That way it is self documenting.
There was a problem hiding this comment.
Created a helper function
| processedQuery: [ | ||
| { text: `@${getRelativePath(filePath)}` }, | ||
| { text: '\n--- Content from referenced files ---' }, | ||
| { text: `\n${REFERENCE_CONTENT_START}` }, |
There was a problem hiding this comment.
test files should generally use the raw value not constants. Otherwise it is hard to tell what you are testing.
please revert these test changes using REFERENCE_CONTENT_START and END rather than the raw value.
There was a problem hiding this comment.
Reverted test files
jacob314
left a comment
There was a problem hiding this comment.
This PR is good enough to land once the nits mentioned here are addressed.
As a fast follow we should do the following:
- Ensure the radio button list of rewind locations doesn't wrap around as that is surprising. you should stick to the first message in the history not wrap all the way around to the last.
- Refresh is broken after changing the history when we are not in alternate buffer mode. There is a force refresh method you should call to resolve this. You can look at what happens when
/clearis called if you need a breadcrumb.

Summary
This PR introduces the /rewind slash command, enabling users to revert their conversation history to a previous point. It supports reverting both the conversation state and any associated file system changes. Additionally, it improves the readability of content included via @ references by wrapping them in clear delimiters.
Details
The new built-in command provides a comprehensive workflow for rewinding a session:
@ Command Processor Updates
Integration
Related Issues
Closes #1769
How to Validate
Pre-Merge Checklist