-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add automatic checkpoint at task creation #8096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1673,6 +1673,14 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike { | |||||
| // Kicks off the checkpoints initialization process in the background. | ||||||
| getCheckpointService(this) | ||||||
|
|
||||||
| // Create an initial checkpoint at the very beginning of task execution | ||||||
| // This allows users to completely reset to the initial state before any changes | ||||||
| // Use allowEmpty=true to ensure checkpoint is created even with no file changes | ||||||
| // Use suppressMessage=true to avoid cluttering the UI with this automatic checkpoint | ||||||
| if (this.enableCheckpoints) { | ||||||
| await this.checkpointSave(true, true) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good implementation for adding an initial checkpoint. Consider whether a try/catch wrapper around the await this.checkpointSave(true, true) call might be beneficial to prevent a checkpoint failure from blocking task execution.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this implementation works and follows the existing patterns, consider adding a test to verify that the initial checkpoint is actually created when a task starts. You could add a test in that mocks the checkpoint service and verifies is called with and during task initialization.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is error handling intentional here? The function already handles errors gracefully by logging them and disabling checkpoints, but you might want to consider if a failed initial checkpoint should log a warning or affect task startup in any way. The current approach (silent failure) is probably fine since checkpoints are a nice-to-have feature. |
||||||
| } | ||||||
|
|
||||||
| let nextUserContent = userContent | ||||||
| let includeFileDetails = true | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider expanding this comment slightly to explain why is essential here: