Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Sep 5, 2025

Implements automatic checkpoint creation when a user sends a message. Implementation detail: triggers checkpointSave(true) on messageResponse in Task.handleWebviewAskResponse, ensuring a checkpoint is created as soon as a user message is accepted without blocking the UI. Behavior: - Uses existing RepoPerTaskCheckpointService to persist checkpoints (shadow git). - Forces allowEmpty to ensure a commit even when no file diffs exist. - Non-blocking (fire-and-forget). Notes: - Tests for affected paths pass locally; full suite has unrelated env-dependent failures. - Respects existing enableCheckpoints flag and telemetry hooks.


Important

Automatic checkpoint creation on user message with non-blocking implementation and message suppression in chat view.

  • Behavior:
    • Automatic checkpoint creation on user message in Task.handleWebviewAskResponse().
    • Uses RepoPerTaskCheckpointService with allowEmpty to ensure commits even without file diffs.
    • Non-blocking implementation with suppressMessage flag to control chat visibility.
  • Functions:
    • checkpointSave() in index.ts updated to accept suppressMessage parameter.
    • handleWebviewAskResponse() in Task.ts triggers checkpoint creation with suppression.
  • UI:
    • ChatView.tsx filters out suppressed checkpoint_saved messages from display.
  • Misc:
    • Tests updated in checkpoint.test.ts to include suppressMessage handling.

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

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

Apparently I'm reviewing code I wrote 2 minutes ago. The simulation is getting lazy.

// Create a checkpoint whenever the user sends a message.
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
if (askResponse === "messageResponse") {
void this.checkpointSave(true)
Copy link
Author

Choose a reason for hiding this comment

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

Missing test coverage for this new checkpoint behavior. The existing Task.spec.ts doesn't test handleWebviewAskResponse with messageResponse triggering checkpoints. Could this lead to regressions? Perhaps I should add tests to verify:

  • Checkpoint is created when askResponse === 'messageResponse'
  • Checkpoint uses allowEmpty=true
  • Other response types don't trigger checkpoints

// Create a checkpoint whenever the user sends a message.
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
if (askResponse === "messageResponse") {
void this.checkpointSave(true)
Copy link
Author

Choose a reason for hiding this comment

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

Is the fire-and-forget approach intentional here? If users send multiple messages quickly, could there be race conditions with concurrent checkpoint saves? The RepoPerTaskCheckpointService might handle this internally, but worth considering if saves should be queued or if the current behavior is acceptable.

// Create a checkpoint whenever the user sends a message.
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
if (askResponse === "messageResponse") {
void this.checkpointSave(true)
Copy link
Author

Choose a reason for hiding this comment

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

I notice we're using to ensure checkpoints even without file changes. This differs from other checkpoint triggers (write_to_file, apply_diff) that only save when files change. Is creating potentially many empty commits in the shadow git repository the intended behavior? It could be useful for conversation history, but might also create noise.

// Create a checkpoint whenever the user sends a message.
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
if (askResponse === "messageResponse") {
void this.checkpointSave(true)
Copy link
Author

Choose a reason for hiding this comment

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

Consider adding error handling or at least logging if checkpoint saving fails. While the fire-and-forget approach prevents UI blocking, silent failures might make debugging difficult:

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 5, 2025
… current checkpoint updated without a chat row
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 5, 2025
- Propagate suppressMessage flag through event chain properly
- Update ChatView to check checkpoint metadata for suppressMessage flag
- Ensure checkpoint messages are created but not rendered when suppressed
- Fix bug where checkpointSave(false) should have been checkpointSave(true)
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 5, 2025

// Remove the 500-message limit to prevent array index shifting
// Virtuoso is designed to efficiently handle large lists through virtualization
const newVisibleMessages = modifiedMessages.filter((message) => {
Copy link

Choose a reason for hiding this comment

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

The filtering logic for 'checkpoint_saved' messages now checks for a 'suppressMessage' flag and excludes those messages. This is a good approach; consider extracting this complex condition into a small helper function to improve readability and maintainability.

- Changed allowEmpty from true to false in checkpointSave call
- Checkpoints will now only be created when there are actual file changes
- This avoids creating empty commits in the shadow git repository
- Fixed test expectation to match the new function signature
- saveCheckpoint now expects both allowEmpty and suppressMessage parameters
@mrubens mrubens merged commit ed765a3 into main Sep 5, 2025
9 checks passed
@mrubens mrubens deleted the feature/checkpoint-on-user-message branch September 5, 2025 22:08
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 5, 2025
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:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants