Skip to content

Commit a6888c0

Browse files
committed
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
1 parent 9fce90b commit a6888c0

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,9 @@ export async function presentAssistantMessage(cline: Task) {
527527
break
528528
}
529529

530-
const recentlyModifiedFiles = cline.fileContextTracker.getAndClearCheckpointPossibleFile()
531-
532-
if (recentlyModifiedFiles.length > 0) {
533-
// TODO: We can track what file changes were made and only
534-
// checkpoint those files, this will be save storage.
535-
await checkpointSave(cline)
536-
}
530+
// Save checkpoint after every message, not just when files are modified
531+
// This ensures user's manual edits between messages are preserved
532+
await checkpointSave(cline)
537533

538534
// Seeing out of bounds is fine, it means that the next too call is being
539535
// built up and ready to add to assistantMessageContent to present.

src/core/task/Task.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,9 @@ export class Task extends EventEmitter<ClineEvents> {
12451245
await this.addToApiConversationHistory({ role: "user", content: finalUserContent })
12461246
TelemetryService.instance.captureConversationMessage(this.taskId, "user")
12471247

1248+
// Save checkpoint after user message to preserve any manual edits
1249+
await checkpointSave(this)
1250+
12481251
// Since we sent off a placeholder api_req_started message to update the
12491252
// webview while waiting to actually start the API request (to load
12501253
// potential details for example), we need to update the text of that

0 commit comments

Comments
 (0)