Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Nov 14, 2025

Summary

History View with gear icon settings popover

Adds automatic task history cleanup to help manage disk space and keep your task history tidy.

What's New

Auto-Delete Task History (User-Configurable)

You can now set Roo Code to automatically delete old tasks when VS Code starts. Access this setting from the History view via the new gear icon in the header.

Retention options: Never (default), 90 days, 60 days, 30 days, 7 days, or 3 days

  • Tasks older than your selected period are permanently removed on startup
  • A confirmation dialog warns you before enabling to prevent accidental data loss
  • When tasks are deleted, you'll see a notification: "Roo Code deleted X tasks older than Y days"

Task Count Display

The settings popover shows how many tasks are in your history with a refresh button to update the count on demand.

Automatic Checkpoint Cleanup

Checkpoint data (used for restore points) from tasks not touched in 30 days is automatically removed. This runs silently in the background and preserves your conversation history - only the checkpoint files are removed to save storage space.

How to Use

  1. Open the History view
  2. Click the gear icon in the header
  3. Choose your preferred retention period from the dropdown
  4. Confirm when prompted

Notes

  • Default is "Never" - your existing behavior is unchanged until you opt-in
  • Deleted tasks cannot be recovered
  • Checkpoint cleanup is always on and not configurable (30-day retention)
  • Full internationalization support for 17 languages

Closes #10850


Important

Introduces automatic task history cleanup and checkpoint data removal with user-configurable settings and internationalization support.

  • Behavior:
    • Adds automatic task history cleanup with user-configurable retention in global-settings.ts and vscode-extension-host.ts.
    • Implements automatic checkpoint data removal for tasks not accessed in 30 days in task-history-retention.ts.
    • Displays task count in settings popover with refresh option in HistoryView.tsx.
  • Settings:
    • Adds TASK_HISTORY_RETENTION_OPTIONS and TaskHistoryRetentionSetting in global-settings.ts.
    • Updates ExtensionState in vscode-extension-host.ts to include taskHistoryRetention and taskHistorySize.
  • Internationalization:
    • Updates i18n files for 17 languages to support new task history and checkpoint cleanup features.
  • Testing:
    • Adds tests for task history retention and checkpoint cleanup in task-history-retention.spec.ts and task-storage-size.spec.ts.

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

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Nov 14, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 14, 2025

Oroocle Clock   See task on Roo Cloud

Re-review complete for 30f2aa25. Previously flagged items are largely resolved; remaining work is the deterministic unit test update.

TODO

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 14, 2025
@hannesrudolph hannesrudolph force-pushed the chore/retention-purge-checkpoint-cleanup branch from 784a70d to 67c7629 Compare November 19, 2025 08:57
@hannesrudolph hannesrudolph force-pushed the chore/retention-purge-checkpoint-cleanup branch from d9b68d5 to 42d73fe Compare November 26, 2025 19:47
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Nov 26, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 26, 2025
@hannesrudolph hannesrudolph force-pushed the chore/retention-purge-checkpoint-cleanup branch from 84853c9 to cc67f71 Compare January 7, 2026 16:38
Copy link
Contributor

@heyseth heyseth left a comment

Choose a reason for hiding this comment

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

Executive Summary

This PR introduces an auto-delete task history feature that purges old tasks on extension reload. The implementation is well-architected, type-safe, and thoroughly tested. The code demonstrates solid engineering practices with proper error handling, i18n support, and integration with existing deletion logic.

Strengths

  • Consistency: Excellent reuse of existing deleteTaskWithId() logic ensures checkpoints, shadow repos, and state are cleaned up alongside files.
  • Reliability: Sequential deletion prevents race conditions, and robust retry logic handles stubborn filesystem operations.
  • Quality: Full i18n support across 17 languages and type-safe schema validation with Zod.

Suggested Enhancements (Code Included)

I have included specific code snippets in the comments to address performance and user trust:

1. Performance: Non-blocking Activation (Critical)
The current implementation awaits the purge process during the activate phase. On machines with large histories or slow disks, this will block the extension startup.

  • Fix: I provided a snippet to wrap the logic in a background "fire-and-forget" task (void (async ...)), ensuring the extension activates immediately.
  • Optimization: Added an early return check for retention === "never" to skip the logic entirely for the majority of users.

2. UX: Visibility & Trust
Silent deletion of user data can be alarming if a user expects to find a task.

  • Fix: I added a Toast Notification logic to the background task. It only triggers if files were actually deleted and provides a direct link to Settings.

3. Testing: Edge Case Coverage
Since we are permanently deleting files, I identified a gap in testing regarding "Orphan Checkpoints" and "Legacy Mtime Fallback."

  • Fix: I drafted 4 specific test cases to verify we strictly target garbage data and do not accidentally delete recent, valid tasks that lack metadata.

Conclusion

This is a high-value maintenance feature. Once the activation blocking issue is resolved (using the background task pattern I suggested), this logic is solid and ready for production!

@hannesrudolph hannesrudolph force-pushed the chore/retention-purge-checkpoint-cleanup branch from cc67f71 to ab6d3ab Compare January 20, 2026 01:43
- Remove expensive recursive getDirectorySize() that caused UI freeze with ~9000 tasks
- Now only counts top-level task directories via single fs.readdir() call
- Make task count on-demand (user must click refresh) instead of auto-trigger on settings load
- Update types, i18n strings, and tests accordingly
This PR was never merged, so no need for backwards compatibility.
Import formatBytes directly from its source file.
The formatBytes tests are not relevant since we no longer calculate size.
- Add parallel metadata reads with 50 concurrent operations
- Add parallel deletions with 10 concurrent operations
- Batch read all metadata first, then filter, then delete
- Reduce retry attempts from 3 to 1 (remove aggressive retries with sleeps)
- Extract helper functions for cleaner code (readTaskMetadata, pathExists, removeDir)

This significantly improves purge performance for users with many tasks (~9000+).
- Add purgeOldCheckpoints() function with hardcoded 30-day threshold
- Add startBackgroundCheckpointPurge() for fire-and-forget activation
- Culls only checkpoints/ subdirectory, preserves task history
- Runs silently on extension activation (no user notification)
- Coexists with existing taskHistoryRetention setting
- Add 6 new tests for checkpoint culling functionality
- Log number of tasks being scanned
- Log how many tasks have checkpoints
- Log how many need culling (older than 30 days)
- Log progress every 100 deletions during large culls
… popover

- Add Settings gear icon in HistoryView header with popover for retention settings
- Retention dropdown allows configuring auto-delete task history (never, 3-90 days)
- Settings are saved immediately via vscode.postMessage updateSettings
- Remove retention settings from About.tsx (Settings View)
- Update About.tsx props and tests to remove taskHistoryRetention
…aging

- Add confirmation dialog before changing retention settings to prevent accidental changes
- Move task count display from About tab to History View settings popover
- Combine redundant description/warning into single, clear warning message
- Update task count display to be more human-friendly ('X tasks in history')
- Update all 18 locale files with consistent messaging
- Revert About.tsx to original state (no retention UI there)
@hannesrudolph hannesrudolph changed the title Auto-delete task history on plugin load (retention + checkpoint cleanup) feat: auto-delete task history on extension load Jan 27, 2026
The file was left over after size calculation was removed from
task-storage-size.ts for performance reasons. Knip correctly detected
it as unused.
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jan 27, 2026
@hannesrudolph hannesrudolph changed the title feat: auto-delete task history on extension load feat: auto-delete old checkpoints + add optional auto task history removal Jan 29, 2026
- Improve calculateTaskStorageSize() logging to show actual error message
  instead of generic 'directory not found'
- Serialize task deletions when using provider-backed deleteTaskById to
  avoid taskHistory state race conditions (parallel deletion kept for
  filesystem-only operations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Preliminary Review size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Status: PR [Needs Prelim Review]

Development

Successfully merging this pull request may close these issues.

Auto-delete task history with configurable retention

5 participants