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
5 changes: 5 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,11 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {

// Task starting

// Create a checkpoint at task start to allow reverting to the beginning
// Use allowEmpty=true to ensure checkpoint is created even with no file changes
// Suppress the checkpoint_saved chat row to keep the timeline clean
await this.checkpointSave(true, true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P2 — Avoid blocking the task loop: checkpointSave() is designed to run in the background; awaiting here delays the first API call. Fire-and-forget to keep startup responsive.

Suggested change
await this.checkpointSave(true, true)
void this.checkpointSave(true, true)


await this.initiateTaskLoop([
{
type: "text",
Expand Down
5 changes: 5 additions & 0 deletions src/core/tools/attemptCompletionTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export async function attemptCompletionTool(

cline.consecutiveMistakeCount = 0

// Create a checkpoint when task is completed
// Use allowEmpty=true to ensure checkpoint is created even with no file changes
// Suppress the checkpoint_saved chat row to keep the timeline clean
await cline.checkpointSave(true, true)

// Command execution is permanently disabled in attempt_completion
// Users must use execute_command tool separately before attempt_completion
await cline.say("completion_result", result, undefined, false)
Expand Down
5 changes: 5 additions & 0 deletions src/core/tools/switchModeTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export async function switchModeTool(
return
}

// Create a checkpoint before switching modes
// Use allowEmpty=true to ensure checkpoint is created even with no file changes
// Suppress the checkpoint_saved chat row to keep the timeline clean
await cline.checkpointSave(true, true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P2 — UX latency: awaiting checkpoint here blocks the mode switch on git I/O. Consider non-blocking; the checkpoint will still be recorded, and the mode switch remains snappy.

Suggested change
await cline.checkpointSave(true, true)
void cline.checkpointSave(true, true)


// Switch the mode using shared handler
await cline.providerRef.deref()?.handleModeSwitch(mode_slug)

Expand Down