feat: reintroduce automatic task cleanup for old task history - #14054
Open
vkeerthivikram wants to merge 6 commits into
Open
feat: reintroduce automatic task cleanup for old task history#14054vkeerthivikram wants to merge 6 commits into
vkeerthivikram wants to merge 6 commits into
Conversation
The legacy extension shipped an auto-cleanup setting that pruned old task history; it was never ported when the extension was rebuilt on the CLI backend. This brings it back as a TaskCleanupService in the VS Code extension: a daily pass (plus a manual Run Cleanup Now button in Settings > Checkpoints) deletes expired sessions through the backend, with retention buckets for regular and abandoned tasks. Safety rules: running sessions are never deleted, a failed status check skips the whole directory group (fail closed), and parents with fresh forks stay alive until the fork ages out, since the backend cascades child deletion. Snapshot storage keeps pruning itself via its hourly GC, so checkpoints of deleted tasks age out within the existing 7-day window. Includes settings keys (kilo-code.new.autoCleanup.*), a Checkpoints-tab settings card with last-run summary, webview message contracts, translations for all 21 locales, and unit tests for the retention and root-selection logic.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit 75b0230)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 75b0230)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit daccee9)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (33 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
- Stop the cleanup scheduler from re-arming after dispose(): an in-flight pass rescheduled in its finally block, leaving a live timer on a disposed service. - Reset the webview Run Cleanup Now button when the cleanup service is unavailable by always posting the state message. - Fix Bosnian typo zadake -> zadatke in two retention labels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14053
The old extension had an Auto-Cleanup setting under Settings → Checkpoints that deleted old task history on a schedule. It never made it into the rebuilt extension, so task history just grows forever now. This puts the feature back.
What it does
A daily pass (plus a Run Cleanup Now button with a last-run summary in Settings → Checkpoints) that deletes expired sessions through the backend. The toggle is off by default.
Two knobs: how long to keep regular tasks (30 days default) and how long to keep abandoned ones (7 days). "Abandoned" means the session never really got used — created and last touched within the same minute. The legacy feature also had separate buckets for completed and favorited tasks, but the new session model doesn't track completion or favorites, so those buckets have nothing to key off. Dropped them rather than guess.
Safety rules:
Only expired roots get delete calls. The backend cascades children with the parent, so calling delete on them just produces 404s that pollute the last-run stats.
Checkpoint data is left alone on purpose. Snapshot storage already runs an hourly GC that drops unreachable objects older than 7 days, so checkpoints of deleted tasks disappear on their own.
Testing
Ownership
I've reviewed the full diff, ran everything above, and tested the feature end to end in VS Code. Happy to explain any part of it.
