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
13 changes: 8 additions & 5 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@ export async function presentAssistantMessage(cline: Task) {

switch (block.name) {
case "write_to_file":
await checkpointSaveAndMark(cline)
await writeToFileTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
// Save checkpoint AFTER file edit
await checkpointSaveAndMark(cline)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good fix! Moving the checkpoint save to AFTER the file edit operations ensures we capture the successful state rather than the pre-edit state. This directly addresses the user's first concern about reverting to the state immediately after a successful edit.

break
case "update_todo_list":
await updateTodoListTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
Expand All @@ -430,10 +431,8 @@ export async function presentAssistantMessage(cline: Task) {
}

if (isMultiFileApplyDiffEnabled) {
await checkpointSaveAndMark(cline)
await applyDiffTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
} else {
await checkpointSaveAndMark(cline)
await applyDiffToolLegacy(
cline,
block,
Expand All @@ -443,15 +442,19 @@ export async function presentAssistantMessage(cline: Task) {
removeClosingTag,
)
}
// Save checkpoint AFTER file edit
await checkpointSaveAndMark(cline)
break
}
case "insert_content":
await checkpointSaveAndMark(cline)
await insertContentTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
// Save checkpoint AFTER file edit
await checkpointSaveAndMark(cline)
break
case "search_and_replace":
await checkpointSaveAndMark(cline)
await searchAndReplaceTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
// Save checkpoint AFTER file edit
await checkpointSaveAndMark(cline)
break
case "read_file":
await readFileTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
Expand Down
Loading
Loading