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
This commit is contained in:
Roo Code 2025-07-21 05:01:04 +00:00
parent 9fce90be9d
commit a6888c0c2e
2 changed files with 6 additions and 7 deletions

View file

@ -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.

View file

@ -1245,6 +1245,9 @@ export class Task extends EventEmitter<ClineEvents> {
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