From a6888c0c2e835093f7f000dea6cf2a230da995da Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 21 Jul 2025 05:01:04 +0000 Subject: [PATCH] feat: Add checkpoint after every message (#5995) - Save checkpoints after every assistant message, not just when files are modified - Save checkpoints after user messages to preserve manual edits - Ensures user's manual changes between messages are always preserved - Addresses issue #5995 requesting automatic checkpoints after every message --- src/core/assistant-message/presentAssistantMessage.ts | 10 +++------- src/core/task/Task.ts | 3 +++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index ee3fa148b41..55aba57a921 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -527,13 +527,9 @@ export async function presentAssistantMessage(cline: Task) { break } - const recentlyModifiedFiles = cline.fileContextTracker.getAndClearCheckpointPossibleFile() - - if (recentlyModifiedFiles.length > 0) { - // TODO: We can track what file changes were made and only - // checkpoint those files, this will be save storage. - await checkpointSave(cline) - } + // Save checkpoint after every message, not just when files are modified + // This ensures user's manual edits between messages are preserved + await checkpointSave(cline) // Seeing out of bounds is fine, it means that the next too call is being // built up and ready to add to assistantMessageContent to present. diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 53b8ef5b87d..fb30dc1ef34 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1245,6 +1245,9 @@ export class Task extends EventEmitter { await this.addToApiConversationHistory({ role: "user", content: finalUserContent }) TelemetryService.instance.captureConversationMessage(this.taskId, "user") + // Save checkpoint after user message to preserve any manual edits + await checkpointSave(this) + // Since we sent off a placeholder api_req_started message to update the // webview while waiting to actually start the API request (to load // potential details for example), we need to update the text of that