Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

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

A new checkpoint is saved after processing a user message. Please ensure that this call respects the 'enableCheckpoints' flag and consider wrapping 'await checkpointSave(this)' in a try/catch block to log errors rather than interrupting the task flow.


// 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
Expand Down