Skip to content

Conversation

@NaccOll
Copy link

@NaccOll NaccOll commented Aug 27, 2025

Related GitHub Issue

Relate: #7285
Closes: #5710 #4703

Roo Code Task Context (Optional)

Description

After fixing checkpointing issues and changing the checkpoint generation time, #5710 generated numerous conflicts, requiring a revision.

This PR resolves these conflicts, adapts to the new checkpoint generation time, improves user message editing, and supports delete operations to roll back file state.

Test Procedure

unit test

  • src/core/checkpoints/__tests__/checkpoint.test.ts
  • src/core/webview/__tests__/checkpointRestoreHandler.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts

manual test

  1. Enable checkpoint
  2. Send messages multiple times, call tools to edit files, and create multiple checkpoints
  3. Select the user message before checkpoint, click Edit, the user message will become an input box, click Send, a dialog box will pop up。
    3.1. edit message only: Does not change the status of the current workspace file, only replaces the selected user message with the new content in the input box and resends the request. Delete all messages after the selected user's message
    3.2. restore code to checkpoint: Restore the workspace files to the state of the next checkpoint, and replaces the selected user message with the new content in the input box and resends the request. Delete all messages after the selected user's message
  4. Select the user message before checkpoint, click delete, a dialog box will pop up。
    4.1. delete message only: Does not change the status of the current workspace file and delete the current user message and all subsequent messagesuser's message
    4.2. restore code to checkpoint: Restore the workspace files to the state of the next checkpoint and delete the current user message and all subsequent messagesuser's message
  5. User message with no checkpoints at after, click Edit, the user message will become an input box, click Send, a dialog box will pop up。At this time, his confirmation option is only edit message only.
  6. Select user message with no checkpoints at after, click delete, a dialog box will pop up。At this time, his confirmation option is only delete message only.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

delete message:
image

edit message:
image
image

Documentation Updates

Added a section on editing and deleting user messages

Additional Notes

Get in Touch

NaccOll


Important

This PR adds functionality to edit/delete user messages with options to restore code to a previous checkpoint, including UI updates, backend logic, and localization support.

  • Behavior:
    • Adds edit/delete functionality for user messages with checkpoint restoration options in ChatView.tsx and CheckpointRestoreDialog.tsx.
    • Supports restoring code to a previous checkpoint or only editing/deleting the message.
  • UI Components:
    • Introduces CheckpointRestoreDialog for user confirmation with options to restore to checkpoint.
    • Updates ChatRow to handle edit mode with image selection and message editing.
  • Tests:
    • Adds unit tests for CheckpointRestoreDialog in CheckpointRestoreDialog.spec.tsx.
    • Updates existing tests to cover new edit/delete behavior in ClineProvider.spec.ts and webviewMessageHandler.checkpoint.spec.ts.
  • Localization:
    • Updates localization files for multiple languages to include new confirmation messages for edit/delete actions with checkpoints.

This description was created by Ellipsis for 83c38d0. You can customize this summary. It will automatically update as commits are pushed.

@NaccOll NaccOll requested review from cte, jr and mrubens as code owners August 27, 2025 08:33
@NaccOll NaccOll marked this pull request as draft August 27, 2025 08:34
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 27, 2025
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found several issues that need attention before this can be merged. The implementation of checkpoint restoration for edit/delete operations looks promising, but there are some critical items to address.

currentCline.abortTask()
// Wait a bit for the abort to complete
await pWaitFor(() => currentCline.abort === true, {
timeout: 1000,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a 1-second timeout sufficient for complex operations? Consider making this configurable or increasing the default:

variant="ghost"
size="icon"
className="shrink-0 hidden"
className="shrink-0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? The edit button was previously hidden but is now always visible. Should this be conditional based on message type or user permissions?


const visibleMessages = useMemo(() => {
// Pre-compute checkpoint hashes that have associated user messages for O(1) lookup
const userMessageCheckpointHashes = new Set<string>()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good optimization using Set for O(1) lookup! This improves performance when filtering checkpoint messages.

@roomote
Copy link

roomote bot commented Aug 27, 2025

Additional Review Comments

Critical Issues to Address:

  1. Merge Conflicts - This PR currently has merge conflicts that need to be resolved before it can be properly reviewed and merged.

  2. Incomplete PR Checklist - Please complete the following items in your pre-submission checklist:

    • Self-Review: Perform a thorough self-review of your code
    • Testing: Confirm that tests have been added/updated to cover your changes
    • Documentation Impact: Consider if your changes require documentation updates
    • Contribution Guidelines: Confirm you have read and agree to the guidelines
  3. Missing Test Procedure - The "Test Procedure" section is empty. Please add steps for reviewers to test the edit/delete functionality with checkpoint restoration.

Positive Observations:

  • Excellent test coverage for the new CheckpointRestoreDialog component
  • Complete localization support across all languages
  • Good separation of concerns with the new checkpointRestoreHandler.ts module

Once these issues are addressed and the PR is moved out of draft status, it will be ready for final review and merge.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 27, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Aug 27, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 27, 2025
@NaccOll NaccOll force-pushed the feature-user-message-edit branch 2 times, most recently from fddb922 to 83c38d0 Compare August 28, 2025 16:48
@NaccOll NaccOll marked this pull request as ready for review August 29, 2025 15:58
@dosubot dosubot bot added the documentation Improvements or additions to documentation label Aug 29, 2025
@NaccOll NaccOll force-pushed the feature-user-message-edit branch from 83c38d0 to 44144bd Compare August 30, 2025 06:41
@NaccOll NaccOll mentioned this pull request Sep 1, 2025
6 tasks
commit 6384ca5
Merge: 0c481a3 85268aa
Author: NaccOll <[email protected]>
Date:   Mon Aug 25 18:00:51 2025 +0800

    Merge branch 'will/edit-w-checkpoints' into main

commit 85268aa
Author: Will Li <[email protected]>
Date:   Fri Jul 25 09:57:08 2025 -0700

    remove some extra code

commit 0bd49d7
Merge: a78aed8 d62a260
Author: Will Li <[email protected]>
Date:   Fri Jul 25 09:23:24 2025 -0700

    Merge branch 'main' into will/edit-w-checkpoints

commit a78aed8
Author: Will Li <[email protected]>
Date:   Wed Jul 23 04:06:27 2025 -0700

    further simplification

commit b8c5dda
Author: Will Li <[email protected]>
Date:   Wed Jul 23 03:17:54 2025 -0700

    clean code more

commit 6657a7d
Merge: 7baefef 9956cc1
Author: Will Li <[email protected]>
Date:   Wed Jul 23 03:03:58 2025 -0700

    Merge branch 'main' into will/edit-w-checkpoints

commit 7baefef
Author: Will Li <[email protected]>
Date:   Wed Jul 23 01:20:46 2025 -0700

    reduce checkpoint changes

commit ab46f94
Merge: 15ce9e3 5629199
Author: Matt Rubens <[email protected]>
Date:   Tue Jul 22 14:51:14 2025 -0400

    Merge remote-tracking branch 'origin/main' into will/edit-w-checkpoints

commit 15ce9e3
Merge: 09d0b29 9014840
Author: Will Li <[email protected]>
Date:   Fri Jul 18 15:33:21 2025 -0700

    merge main

commit 09d0b29
Author: Will Li <[email protected]>
Date:   Thu Jul 17 08:41:08 2025 -0700

    fix typo

commit 17658ba
Author: Will Li <[email protected]>
Date:   Thu Jul 17 08:39:36 2025 -0700

    fix weird autolint again

commit 2ab8d49
Author: Will Li <[email protected]>
Date:   Thu Jul 17 08:35:05 2025 -0700

    other merge fixes

commit 0e9954d
Merge: 2c77f32 fb374b3
Author: Will Li <[email protected]>
Date:   Thu Jul 17 08:34:29 2025 -0700

    Merge branch 'main' into will/edit-w-checkpoints

commit 2c77f32
Author: Will Li <[email protected]>
Date:   Mon Jul 14 15:56:18 2025 -0700

    clean logging

commit 616c4b6
Author: Will Li <[email protected]>
Date:   Mon Jul 14 15:42:08 2025 -0700

    do translations

commit 7015608
Author: Will Li <[email protected]>
Date:   Mon Jul 14 15:26:05 2025 -0700

    fix race cond and lint

commit caee1dc
Author: Will Li <[email protected]>
Date:   Mon Jul 14 14:52:06 2025 -0700

    tests, optimizations, refactors

commit bccffac
Author: Will Li <[email protected]>
Date:   Mon Jul 14 11:41:27 2025 -0700

    working

commit 930e70e
Author: Will Li <[email protected]>
Date:   Sun Jul 13 18:03:51 2025 -0700

    refactor

commit 6044c1a
Author: Will Li <[email protected]>
Date:   Sun Jul 13 15:26:24 2025 -0700

    initial print fix

commit 0872b8b
Author: Will Li <[email protected]>
Date:   Sun Jul 13 10:36:45 2025 -0700

    cleaner code

commit d3c655d
Author: Will Li <[email protected]>
Date:   Sun Jul 13 00:19:49 2025 -0700

    working version, still some default checkpointing bugs

commit 63c7c7c
Author: Will Li <[email protected]>
Date:   Fri Jul 11 15:56:33 2025 -0700

    some merge fixes

commit 7b77d80
Merge: ce0c182 69c3996
Author: Will Li <[email protected]>
Date:   Fri Jul 11 09:49:47 2025 -0700

    Merge branch 'will/edit-delete-overhaul' into will/edit-w-checkpoints

commit 69c3996
Merge: 4604211 406b366
Author: Will Li <[email protected]>
Date:   Thu Jul 10 20:46:31 2025 -0700

    Merge branch 'main' into will/edit-delete-overhaul

commit 4604211
Author: Will Li <[email protected]>
Date:   Thu Jul 10 20:26:35 2025 -0700

    ui fix

commit 5edab52
Author: Will Li <[email protected]>
Date:   Thu Jul 10 18:47:21 2025 -0700

    fixed image issue

commit f89d768
Author: Will Li <[email protected]>
Date:   Thu Jul 10 17:26:36 2025 -0700

    remove option to skip notif

commit ce0c182
Author: Will Li <[email protected]>
Date:   Thu Jul 10 17:10:12 2025 -0700

    temp push

commit 67fd5a7
Author: Will Li <[email protected]>
Date:   Wed Jul 9 17:08:10 2025 -0700

    add back hidden flag

commit a17bf98
Author: Will Li <[email protected]>
Date:   Wed Jul 9 17:06:43 2025 -0700

    translations

commit ed4a2a7
Author: Will Li <[email protected]>
Date:   Wed Jul 9 16:48:11 2025 -0700

    ok finally tests working for real!

commit 303a9c8
Author: Will Li <[email protected]>
Date:   Wed Jul 9 16:33:04 2025 -0700

    tests working

commit 24a8c10
Author: Will Li <[email protected]>
Date:   Wed Jul 9 15:32:50 2025 -0700

    working functionality

commit d926a77
Author: Will Li <[email protected]>
Date:   Wed Jul 9 13:02:18 2025 -0700

    big UI improvements

commit ff8c188
Author: Will Li <[email protected]>
Date:   Wed Jul 9 09:00:43 2025 -0700

    improved chat row first pass
@NaccOll NaccOll force-pushed the feature-user-message-edit branch from 44144bd to 7922443 Compare September 4, 2025 03:03
@daniel-lxs daniel-lxs moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code Roadmap Sep 4, 2025
@daniel-lxs
Copy link
Member

The checkpoint feature handles more than just code changes so I think it makes sense to have a more generic message. The translations should be updated to remove specific references to "code":

In all language files (webview-ui/src/i18n/locales/*/common.json):

restoreToCheckpoint:

  • Current: "Yes, restore code to checkpoint"
  • Should be: "Yes, restore the checkpoint"

editQuestionWithCheckpoint:

  • Current: "...Do you also want to undo all code changes back to this checkpoint?"
  • Should be: "...Do you also want to undo all changes back to this checkpoint?"

deleteQuestionWithCheckpoint:

  • Current: "...Do you also want to undo all code changes back to this checkpoint?"
  • Should be: "...Do you also want to undo all changes back to this checkpoint?"

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer PR - Needs Review size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants