-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fixes #4827: Create checkpoints before changes, not after #4840
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
Conversation
- Modified all file editing tools (write_to_file, apply_diff, insert_content, search_and_replace) to create checkpoints BEFORE applying changes instead of after - This allows users to revert to the state before changes were made, which is the expected behavior - Updated both legacy and multi-file apply_diff implementations - Added fallback checkpoint creation in presentAssistantMessage for edge cases - All existing checkpoint tests continue to pass
mrubens
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.
@cte does this PR look right to you?
|
@roomote I would expect this PR to also remove the existing logic that saves checkpoints after changes have been made. Can you find where we're doing that and see if we need to make any changes there? Also, I think the pre-existing logic only needs to call saveCheckpoint in a single place, whereas this PR seems to call it in a bunch of places; is it possible to hook in at a single place (prior to changes being made)? |
Addresses @cte's feedback in PR #4840 comment: - Remove existing logic that saves checkpoints AFTER changes in presentAssistantMessage.ts - Consolidate checkpoint creation to askApproval function for file-editing tools - Remove individual checkpoint calls from writeToFileTool, applyDiffTool, insertContentTool, and searchAndReplaceTool - Handle special case for multiApplyDiffTool batch operations - Maintains fix for #4827: checkpoints are created BEFORE file modifications This reduces code duplication and centralizes checkpoint logic in a single place.
|
Generated with ❤️ by ellipsis.dev |
|
@roomote Please remove the unnecessary comments in this PR. |
|
Generated with ❤️ by ellipsis.dev |
|
A few suggestions:
Also something to keep in mind, if creating more checkpoints is making the file edit tools take longer we might want to update the timeout on the e2e tests. |
|
+1 please make sure the user interface shows the rollback icon in the correct location. it would be nice if you show a dotted horizontal-rule as the "line in the sand" for where it gets reverted for extra clarity because exactly where it reverts based on the icon is somewhat hard to figure out only show the horizontal rule if the mouse hovers |
Summary
This PR fixes issue #4827 by modifying the checkpoint creation timing to occur before file changes are made instead of after. This allows users to revert to the state before changes were applied, which is the expected and more useful behavior.
Changes Made
Core Fix
Implementation Details
cline.enableCheckpointsbeing trueTesting
Impact
Fixes #4827
Important
Checkpoints are now created before file modifications in various tools, allowing users to revert to the pre-change state, with fallback mechanisms for edge cases.
writeToFileTool,applyDiffTool,insertContentTool, andsearchAndReplaceTool.multiApplyDiffTool, a single checkpoint is created before processing all approved files.presentAssistantMessage.tsfor edge cases.cline.enableCheckpointsbeing true.This description was created by
for c7a1651. You can customize this summary. It will automatically update as commits are pushed.