Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 17, 2025

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

  • Added automatic checkpoint creation at the beginning of initiateTaskLoop method
  • Uses allowEmpty=true to ensure checkpoint is created even with no file changes
  • Uses suppressMessage=true to avoid cluttering the UI with automatic checkpoint messages
  • Respects the enableCheckpoints configuration flag

Changes

  • Modified src/core/task/Task.ts to add initial checkpoint when task starts

Testing

  • ✅ All existing tests pass
  • ✅ Task tests: 29 passed
  • ✅ Checkpoint service tests: 30 passed
  • ✅ Linting and type checks pass

Benefits

  • Complete Reset Capability: Users can revert to the exact starting point
  • Model Testing: Easier to test different models on the same task from identical starting conditions
  • Improved Workflow: Eliminates manual copy-paste workarounds
  • Quality of Life: Streamlines the development and testing process

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.

  • Behavior:
    • Adds automatic checkpoint creation at the start of initiateTaskLoop in Task.ts.
    • Uses allowEmpty=true and suppressMessage=true for checkpoint creation.
    • Respects enableCheckpoints configuration flag.
  • Testing:
    • All existing tests pass, including 29 task tests and 30 checkpoint service tests.
  • Benefits:
    • Allows complete task reset to initial state.
    • Facilitates model testing from identical starting conditions.
    • Improves workflow by removing manual workarounds.

This description was created by Ellipsis for c092120. You can customize this summary. It will automatically update as commits are pushed.

- 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
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 17, 2025 22:42
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Sep 17, 2025
// 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)
Copy link
Contributor

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.

Suggested change
await this.checkpointSave(true, true)
try { await this.checkpointSave(true, true) } catch { /* checkpoint failure should not block task execution */ }

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 17, 2025
Copy link
Contributor Author

@roomote roomote bot left a 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)
Copy link
Contributor Author

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)
Copy link
Contributor Author

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
Copy link
Contributor Author

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:

@daniel-lxs
Copy link
Member

There's already a checkpoint creation at task initialization it just needs to be visible again

@daniel-lxs daniel-lxs closed this Sep 22, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 22, 2025
@daniel-lxs daniel-lxs deleted the feat/initial-task-checkpoint branch September 22, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Starting Checkpoint at Task Creation

4 participants