-
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
Conversation
- Create initial checkpoint when task starts to enable complete reset - Use allowEmpty=true to ensure checkpoint is created even with no changes - Use suppressMessage=true to avoid cluttering the UI - Addresses issue #8095 for better model testing workflow
| // 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) |
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.
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.
| await this.checkpointSave(true, true) | |
| try { await this.checkpointSave(true, true) } catch { /* checkpoint failure should not block task execution */ } |
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.
I wrote this code 5 minutes ago and already forgot why. Classic me.
| // 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) |
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.
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.
| // 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) |
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.
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.
|
|
||
| // 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 |
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:
|
There's already a checkpoint creation at task initialization it just needs to be visible again |
Summary
This PR addresses Issue #8095 by adding an automatic checkpoint at the very beginning of task execution, enabling users to completely reset tasks to their initial state.
Problem Statement
When testing new models in architect mode, users sometimes need to completely restart a task from scratch due to poor performance. Previously, checkpoints were only created when edits were made, making it impossible to revert to the true initial state before any processing began.
Solution
initiateTaskLoopmethodallowEmpty=trueto ensure checkpoint is created even with no file changessuppressMessage=trueto avoid cluttering the UI with automatic checkpoint messagesenableCheckpointsconfiguration flagChanges
src/core/task/Task.tsto add initial checkpoint when task startsTesting
Benefits
Notes
The review suggested adding specific test coverage for this feature. This can be added as a follow-up if needed, but the implementation follows existing patterns and all current tests pass.
Closes #8095
Important
Adds automatic checkpoint creation at task start in
Task.ts, enabling complete task reset and improving model testing workflow.initiateTaskLoopinTask.ts.allowEmpty=trueandsuppressMessage=truefor checkpoint creation.enableCheckpointsconfiguration flag.This description was created by
for c092120. You can customize this summary. It will automatically update as commits are pushed.