Add completion change actions#633
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds inline "see new changes" and "restore changes" actions to the chat UI's completion result row. A new ChangesCompletion Checkpoint Diff/Restore Feature
Sequence DiagramsequenceDiagram
participant User
participant ChatView
participant SeeNewChangesButtons
participant vscode as VSCode Webview API
participant webviewMessageHandler
participant currentCline
User->>ChatView: views completion_result row
ChatView->>ChatView: getCompletionCheckpoint(messages) → CompletionCheckpoint
ChatView->>SeeNewChangesButtons: completionCheckpoint prop
alt User clicks "see new changes"
User->>SeeNewChangesButtons: click diff button
SeeNewChangesButtons->>vscode: postMessage({ type: "completionCheckpointDiff", checkpointTs })
vscode->>webviewMessageHandler: completionCheckpointDiff
webviewMessageHandler->>currentCline: checkpointDiff({ ts, commitHash, mode: "to-current" })
else User clicks "restore changes" → confirm
User->>SeeNewChangesButtons: click restore → confirm
SeeNewChangesButtons->>vscode: postMessage({ type: "completionCheckpointRestore", checkpointTs })
vscode->>webviewMessageHandler: completionCheckpointRestore
webviewMessageHandler->>currentCline: cancelTask()
webviewMessageHandler->>webviewMessageHandler: pWaitFor(isInitialized, 3s)
webviewMessageHandler->>currentCline: checkpointRestore({ ts, commitHash, mode: "restore" })
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
webview-ui/src/components/chat/utils/__tests__/completionCheckpoint.spec.ts (1)
1-19: ⚡ Quick winMove this pure-logic test out of webview-ui test scope.
This file tests a shared pure utility (
getCompletionCheckpoint) rather than React/webview behavior, so it should live in package-local/unit test scope to avoid duplicated cross-layer coverage.As per coding guidelines, webview-ui tests should focus on React/webview behavior, while pure logic should use package-local unit tests.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@webview-ui/src/components/chat/utils/__tests__/completionCheckpoint.spec.ts` around lines 1 - 19, The test for the getCompletionCheckpoint utility function is currently located in the webview-ui test scope, but since this function is pure logic imported from `@roo-code/types` and not React/webview-specific behavior, it should be moved to the appropriate package-local unit test directory where the actual utility implementation lives. Move the completionCheckpoint.spec.ts test file from the webview-ui test directory to the package-local unit tests for the `@roo-code/types` package to follow coding guidelines that separate webview-specific tests from pure logic tests.Source: Coding guidelines
src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts (1)
163-172: ⚡ Quick winAdd a timeout-path unit test for completionCheckpointRestore.
Current tests cover success/no-checkpoint, but not the re-init timeout path (where restore should not proceed). Add a test that forces
pWaitForrejection and assertscheckpointRestoreis not called.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts` around lines 163 - 172, Add a new unit test in the webviewMessageHandler.checkpoint.spec.ts file that covers the timeout/re-init path for completionCheckpointRestore. Create a test case following the same structure as the existing "restores files and task state to the checkpoint created after the latest prompt" test, but configure the test setup so that pWaitFor rejects (simulating a timeout). In this timeout scenario, assert that mockCline.checkpointRestore is not called, demonstrating that the restore does not proceed when the re-init process times out.Source: Coding guidelines
webview-ui/src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsx (1)
160-176: ⚡ Quick winUse task-shaped first message in completion fixtures.
At Line 161 and Line 166, these helpers start with
say: "text". Usingsay: "task"keeps the fixture aligned with ChatView’s task-state invariant and avoids false confidence from non-representative state.Suggested test fixture adjustment
const completionAskWithoutCheckpoint = (): ClineMessage[] => [ - { type: "say", say: "text", ts: 1, text: "Initial task" }, + { type: "say", say: "task", ts: 1, text: "Initial task" }, { type: "ask", ask: "completion_result", ts: 2, text: "Task complete", partial: false }, ] const completionAskWithCheckpoint = (): ClineMessage[] => [ - { type: "say", say: "text", ts: 1, text: "Initial task" }, + { type: "say", say: "task", ts: 1, text: "Initial task" }, { type: "say", say: "checkpoint_saved",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@webview-ui/src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsx` around lines 160 - 176, The test fixtures completionAskWithoutCheckpoint and completionAskWithCheckpoint both start with messages containing say: "text", but they should use say: "task" for the initial message to align with ChatView's task-state invariant and ensure the fixtures represent realistic test state. Change the say property from "text" to "task" in the first message object of both helper functions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/webview/webviewMessageHandler.ts`:
- Around line 1313-1327: After the pWaitFor timeout is caught and the
checkpoint_timeout error message is displayed in the first try-catch block,
execution continues to the checkpointRestore call even though the task
initialization failed. Add a return statement immediately after the
vscode.window.showErrorMessage call in the first catch block to abort the
restore flow and prevent attempting to restore on an uninitialized task.
In `@webview-ui/src/components/chat/ChatView.tsx`:
- Around line 132-143: The completionResultTs useMemo hook only checks for
message.type === "say" when searching for completion_result messages, but it
should also match message.type === "ask". Update the conditional logic to accept
both "say" and "ask" types so that ask-type completion_result messages are
captured, allowing completionCheckpoint to be properly wired into the row
downstream where the inline actions are rendered.
In `@webview-ui/src/components/chat/SeeNewChangesButtons.tsx`:
- Around line 41-50: The VSCodeButton components for seeNewChangesCallback and
restoreChangesCallback are missing tooltip attributes that expose the newly
added translation keys seeNewChanges.tooltip and restoreChanges.tooltip. Add a
title attribute to both buttons using the t() translation function to wire in
the appropriate tooltip copy (t("chat:seeNewChanges.tooltip") for the first
button and t("chat:restoreChanges.tooltip") for the second button), so users can
see the contextual guidance when hovering over the buttons.
- Around line 13-21: The callbacks seeNewChangesCallback,
restoreChangesCallback, and confirmRestoreChangesCallback post messages without
including the checkpoint identity, which causes a race condition if new messages
arrive between button click and handler execution. Update both
vscode.postMessage calls (in the callbacks for "completionCheckpointDiff" and
"completionCheckpointRestore" message types) to include checkpointTs in the
message payload, add checkpoint.ts to the dependency arrays of these callbacks
to ensure they update when the checkpoint changes, and update the corresponding
test assertions in SeeNewChangesButtons.spec.tsx to expect the new payload
format with the checkpoint identity included.
---
Nitpick comments:
In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts`:
- Around line 163-172: Add a new unit test in the
webviewMessageHandler.checkpoint.spec.ts file that covers the timeout/re-init
path for completionCheckpointRestore. Create a test case following the same
structure as the existing "restores files and task state to the checkpoint
created after the latest prompt" test, but configure the test setup so that
pWaitFor rejects (simulating a timeout). In this timeout scenario, assert that
mockCline.checkpointRestore is not called, demonstrating that the restore does
not proceed when the re-init process times out.
In
`@webview-ui/src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsx`:
- Around line 160-176: The test fixtures completionAskWithoutCheckpoint and
completionAskWithCheckpoint both start with messages containing say: "text", but
they should use say: "task" for the initial message to align with ChatView's
task-state invariant and ensure the fixtures represent realistic test state.
Change the say property from "text" to "task" in the first message object of
both helper functions.
In `@webview-ui/src/components/chat/utils/__tests__/completionCheckpoint.spec.ts`:
- Around line 1-19: The test for the getCompletionCheckpoint utility function is
currently located in the webview-ui test scope, but since this function is pure
logic imported from `@roo-code/types` and not React/webview-specific behavior, it
should be moved to the appropriate package-local unit test directory where the
actual utility implementation lives. Move the completionCheckpoint.spec.ts test
file from the webview-ui test directory to the package-local unit tests for the
`@roo-code/types` package to follow coding guidelines that separate
webview-specific tests from pure logic tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c9c5752c-acd2-4ec5-9ebc-3a22539b1042
📒 Files selected for processing (29)
packages/types/src/message.tspackages/types/src/vscode-extension-host.tssrc/core/webview/__tests__/completionCheckpoint.spec.tssrc/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.tssrc/core/webview/webviewMessageHandler.tswebview-ui/src/components/chat/ChatRow.tsxwebview-ui/src/components/chat/ChatView.tsxwebview-ui/src/components/chat/SeeNewChangesButtons.tsxwebview-ui/src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsxwebview-ui/src/components/chat/__tests__/SeeNewChangesButtons.spec.tsxwebview-ui/src/components/chat/utils/__tests__/completionCheckpoint.spec.tswebview-ui/src/i18n/locales/ca/chat.jsonwebview-ui/src/i18n/locales/de/chat.jsonwebview-ui/src/i18n/locales/en/chat.jsonwebview-ui/src/i18n/locales/es/chat.jsonwebview-ui/src/i18n/locales/fr/chat.jsonwebview-ui/src/i18n/locales/hi/chat.jsonwebview-ui/src/i18n/locales/id/chat.jsonwebview-ui/src/i18n/locales/it/chat.jsonwebview-ui/src/i18n/locales/ja/chat.jsonwebview-ui/src/i18n/locales/ko/chat.jsonwebview-ui/src/i18n/locales/nl/chat.jsonwebview-ui/src/i18n/locales/pl/chat.jsonwebview-ui/src/i18n/locales/pt-BR/chat.jsonwebview-ui/src/i18n/locales/ru/chat.jsonwebview-ui/src/i18n/locales/tr/chat.jsonwebview-ui/src/i18n/locales/vi/chat.jsonwebview-ui/src/i18n/locales/zh-CN/chat.jsonwebview-ui/src/i18n/locales/zh-TW/chat.json
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts (1)
206-213: ⚡ Quick winAssert the timeout error-reporting side effect in the timeout-path test.
Line 206 verifies cancel/restore behavior, but it doesn’t verify the user-visible error path that this branch is responsible for.
Suggested test assertion
it("does not restore when task re-initialization times out", async () => { ;(pWaitFor as any).mockRejectedValueOnce(new Error("timed out")) await webviewMessageHandler(mockProvider, { type: "completionCheckpointRestore", checkpointTs: 4 }) expect(mockProvider.cancelTask).toHaveBeenCalled() expect(mockCline.checkpointRestore).not.toHaveBeenCalled() + const vscode = await import("vscode") + expect(vscode.window.showErrorMessage).toHaveBeenCalled() })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts` around lines 206 - 213, The test "does not restore when task re-initialization times out" verifies that cancelTask is called and checkpointRestore is not called when pWaitFor rejects with a timeout error, but it's missing an assertion for the user-visible error reporting side effect. Add an expectation to verify that the error reporting mechanism (such as an error notification or message sent to the user) is invoked when the timeout occurs in the timeout path of the webviewMessageHandler function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts`:
- Around line 206-213: The test "does not restore when task re-initialization
times out" verifies that cancelTask is called and checkpointRestore is not
called when pWaitFor rejects with a timeout error, but it's missing an assertion
for the user-visible error reporting side effect. Add an expectation to verify
that the error reporting mechanism (such as an error notification or message
sent to the user) is invoked when the timeout occurs in the timeout path of the
webviewMessageHandler function.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 294d8467-d93e-422d-b110-748b0ab5a9a0
📒 Files selected for processing (10)
packages/types/src/__tests__/message.test.tspackages/types/src/message.tspackages/types/src/vscode-extension-host.tssrc/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.tssrc/core/webview/webviewMessageHandler.tswebview-ui/src/components/chat/ChatRow.tsxwebview-ui/src/components/chat/ChatView.tsxwebview-ui/src/components/chat/SeeNewChangesButtons.tsxwebview-ui/src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsxwebview-ui/src/components/chat/__tests__/SeeNewChangesButtons.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
- webview-ui/src/components/chat/tests/SeeNewChangesButtons.spec.tsx
- webview-ui/src/components/chat/SeeNewChangesButtons.tsx
- webview-ui/src/components/chat/ChatView.tsx
- webview-ui/src/components/chat/ChatRow.tsx
- src/core/webview/webviewMessageHandler.ts
- webview-ui/src/components/chat/tests/ChatView.clear-approval-buttons.spec.tsx
- packages/types/src/message.ts
…rror - Mock `console.log` and `console.error` in `ClineProvider.flicker-free-cancel.spec.ts` to prevent test output pollution. - Add assertion for `vscode.window.showErrorMessage` with `"errors.checkpoint_timeout"` in `webviewMessageHandler.checkpoint.spec.ts`.
edelauna
left a comment
There was a problem hiding this comment.
Nice! Thanks for adding this, had a couple comments.
Could you also add a screen recording showing this change in action.
Thank you.
…mpletion-change-actions # Conflicts: # src/core/webview/__tests__/ClineProvider.flicker-free-cancel.spec.ts
Screen.Recording.2026-06-22.at.05.01.36.mp4 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts (1)
211-219: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider adding a restore fallback test for symmetry.
The new fallback test at lines 211-219 verifies that
completionCheckpointDiffcorrectly falls back to the latest completion checkpoint whencheckpointTsis omitted. For completeness, consider adding a parallel test that verifies the same fallback behavior forcompletionCheckpointRestore.While not strictly necessary (both operations share
resolveCompletionCheckpointlogic), a symmetric test would make the coverage more explicit and easier to understand.📝 Suggested additional test
it("falls back to the latest completion checkpoint when checkpoint timestamp is omitted (restore)", async () => { const callOrder: string[] = [] mockProvider.cancelTask.mockImplementation(async () => callOrder.push("cancelTask")) mockCline.checkpointRestore.mockImplementation(async () => callOrder.push("checkpointRestore")) await webviewMessageHandler(mockProvider, { type: "completionCheckpointRestore" }) expect(mockCline.checkpointRestore).toHaveBeenCalledWith({ ts: 4, commitHash: "latest-prompt-checkpoint", mode: "restore", }) })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts` around lines 211 - 219, Add a symmetric test case to verify that completionCheckpointRestore also falls back to the latest completion checkpoint when checkpointTs is omitted. Create a new test following the same pattern as the existing fallback test for completionCheckpointDiff, but for the completionCheckpointRestore operation type. Mock mockProvider.cancelTask and mockCline.checkpointRestore appropriately, invoke webviewMessageHandler with type set to completionCheckpointRestore and no checkpointTs parameter, then assert that mockCline.checkpointRestore is called with the expected parameters (ts: 4, commitHash: "latest-prompt-checkpoint", and mode: "restore").src/core/webview/webviewMessageHandler.ts (1)
924-1009: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winWrap case block in braces for consistency and linter compliance.
The
importRooHistorycase declares variables (latestProgress) without wrapping the case body in braces. Other cases in this file that declare variables (e.g.,askResponse,checkpointRestore,completionCheckpointDiff) consistently use braces. While the code functions correctly, wrapping in braces prevents static analysis warnings and aligns with the established pattern.♻️ Wrap case in braces
- case "importRooHistory": { + case "importRooHistory": {{ let latestProgress = { copiedFileCount: 0, totalFileCount: 0, importedTaskCount: 0, totalTaskCount: 0, } try { // ... rest of case body ... } break - } + }}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/webview/webviewMessageHandler.ts` around lines 924 - 1009, The importRooHistory case block should be wrapped in curly braces to create proper block scope for the latestProgress variable and maintain consistency with other cases in this switch statement that declare variables (such as askResponse, checkpointRestore, completionCheckpointDiff). Ensure that the case "importRooHistory" has an opening brace after the colon and wraps the entire case body (including the try-catch block and the break statement) with a closing brace to comply with linter rules and established patterns in this file.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.ts`:
- Around line 211-219: Add a symmetric test case to verify that
completionCheckpointRestore also falls back to the latest completion checkpoint
when checkpointTs is omitted. Create a new test following the same pattern as
the existing fallback test for completionCheckpointDiff, but for the
completionCheckpointRestore operation type. Mock mockProvider.cancelTask and
mockCline.checkpointRestore appropriately, invoke webviewMessageHandler with
type set to completionCheckpointRestore and no checkpointTs parameter, then
assert that mockCline.checkpointRestore is called with the expected parameters
(ts: 4, commitHash: "latest-prompt-checkpoint", and mode: "restore").
In `@src/core/webview/webviewMessageHandler.ts`:
- Around line 924-1009: The importRooHistory case block should be wrapped in
curly braces to create proper block scope for the latestProgress variable and
maintain consistency with other cases in this switch statement that declare
variables (such as askResponse, checkpointRestore, completionCheckpointDiff).
Ensure that the case "importRooHistory" has an opening brace after the colon and
wraps the entire case body (including the try-catch block and the break
statement) with a closing brace to comply with linter rules and established
patterns in this file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8bfe2ccf-4712-4a9a-b6a2-57e3bac827f0
📒 Files selected for processing (27)
README.mdpackages/types/src/__tests__/message.test.tspackages/types/src/message.tspackages/types/src/vscode-extension-host.tssrc/core/webview/__tests__/ClineProvider.flicker-free-cancel.spec.tssrc/core/webview/__tests__/webviewMessageHandler.checkpoint.spec.tssrc/core/webview/webviewMessageHandler.tswebview-ui/src/components/chat/SeeNewChangesButtons.tsxwebview-ui/src/components/chat/__tests__/SeeNewChangesButtons.spec.tsxwebview-ui/src/i18n/locales/ca/chat.jsonwebview-ui/src/i18n/locales/de/chat.jsonwebview-ui/src/i18n/locales/en/chat.jsonwebview-ui/src/i18n/locales/es/chat.jsonwebview-ui/src/i18n/locales/fr/chat.jsonwebview-ui/src/i18n/locales/hi/chat.jsonwebview-ui/src/i18n/locales/id/chat.jsonwebview-ui/src/i18n/locales/it/chat.jsonwebview-ui/src/i18n/locales/ja/chat.jsonwebview-ui/src/i18n/locales/ko/chat.jsonwebview-ui/src/i18n/locales/nl/chat.jsonwebview-ui/src/i18n/locales/pl/chat.jsonwebview-ui/src/i18n/locales/pt-BR/chat.jsonwebview-ui/src/i18n/locales/ru/chat.jsonwebview-ui/src/i18n/locales/tr/chat.jsonwebview-ui/src/i18n/locales/vi/chat.jsonwebview-ui/src/i18n/locales/zh-CN/chat.jsonwebview-ui/src/i18n/locales/zh-TW/chat.json
✅ Files skipped from review due to trivial changes (15)
- webview-ui/src/i18n/locales/es/chat.json
- README.md
- webview-ui/src/i18n/locales/de/chat.json
- webview-ui/src/i18n/locales/ru/chat.json
- webview-ui/src/i18n/locales/it/chat.json
- webview-ui/src/i18n/locales/tr/chat.json
- webview-ui/src/i18n/locales/ca/chat.json
- webview-ui/src/i18n/locales/ja/chat.json
- webview-ui/src/i18n/locales/hi/chat.json
- webview-ui/src/i18n/locales/zh-CN/chat.json
- webview-ui/src/i18n/locales/fr/chat.json
- webview-ui/src/i18n/locales/pt-BR/chat.json
- src/core/webview/tests/ClineProvider.flicker-free-cancel.spec.ts
- webview-ui/src/i18n/locales/en/chat.json
- webview-ui/src/i18n/locales/pl/chat.json
🚧 Files skipped from review as they are similar to previous changes (10)
- packages/types/src/tests/message.test.ts
- webview-ui/src/components/chat/SeeNewChangesButtons.tsx
- packages/types/src/vscode-extension-host.ts
- webview-ui/src/i18n/locales/ko/chat.json
- webview-ui/src/i18n/locales/vi/chat.json
- webview-ui/src/components/chat/tests/SeeNewChangesButtons.spec.tsx
- webview-ui/src/i18n/locales/zh-TW/chat.json
- webview-ui/src/i18n/locales/nl/chat.json
- packages/types/src/message.ts
- webview-ui/src/i18n/locales/id/chat.json
edelauna
left a comment
There was a problem hiding this comment.
Was reviewing this more in depth and wanted to also request some architectural changes to the feature to not allow the webview to pass a checkpointTs.
edelauna
left a comment
There was a problem hiding this comment.
Cool feature, thanks for adding it.
* feat: add completion change actions * fix: address completion action review feedback * test(webview): mock console output and assert on checkpoint timeout error - Mock `console.log` and `console.error` in `ClineProvider.flicker-free-cancel.spec.ts` to prevent test output pollution. - Add assertion for `vscode.window.showErrorMessage` with `"errors.checkpoint_timeout"` in `webviewMessageHandler.checkpoint.spec.ts`. * fix: address completion checkpoint review feedback * feat(ChatRow): adding key to react component --------- Co-authored-by: Elliott de Launay <edelauna@gmail.com> # Conflicts: # webview-ui/src/components/chat/ChatView.tsx
Related GitHub Issue
Closes: #661
Description
This PR adds a Kilo Code-inspired completion experience that helps users view and undo the changes made for the latest prompt after an
attempt_completionresult.Key implementation details:
See New ChangesandRestore Changesbuttons to the completion result row, following the Kilo Code legacy placement/pattern while preserving the existingStart New Taskcompletion action.Restore Changesrestores files and rewinds the task state to the last prompt checkpoint.@roo-code/types.Reviewers should pay attention to the checkpoint selection logic and the restore flow, since those define exactly which changes are shown and undone.
Test Procedure
Validated with:
git diff --checkpnpm --filter @roo-code/types buildcd src && npx vitest run core/webview/__tests__/completionCheckpoint.spec.ts core/webview/__tests__/webviewMessageHandler.checkpoint.spec.tscd webview-ui && npx vitest run src/components/chat/__tests__/ChatView.clear-approval-buttons.spec.tsx src/components/chat/__tests__/SeeNewChangesButtons.spec.tsxcd webview-ui && pnpm exec tsc --noEmitprettier --writeand repository lint successfully.Manual behavior verified locally:
See New ChangesandRestore Changesbuttons when a latest-prompt checkpoint exists.See New Changesopens the checkpoint diff scoped to the latest prompt.Restore Changesasks for confirmation, then restores files and rewinds task state to the latest prompt checkpoint.Start New Task.Pre-Submission Checklist
Screenshots / Videos
Not included. This is a small chat-row UI addition modeled after the existing Kilo Code legacy completion action pattern.
Documentation Updates
Additional Notes
This is intentionally inspired by Kilo Code legacy: the completion result itself carries the user-facing actions to review or undo the new changes, making it easier to validate an agent's work before starting a new task.
Get in Touch
ivanarifin
Summary by CodeRabbit