feat: reclaim database space after session cleanup and add a stop button - #14540
marius-kilocode merged 6 commits into
Conversation
Session cleanup deleted rows but never shrank kilo.db, and a pass could not be stopped once started. A pass now vacuums the database when freed pages clear absolute and relative floors, and a new retention cancel endpoint lets clients stop the active pass; already-deleted sessions stay deleted and the partial result is recorded. The VS Code settings screen gains a Stop button plus cancelling progress and interrupted last-run states. docs-tmp regenerated visual-regression baselines (not part of the cleanup branch)
2291955 to
3b0f9b0
Compare
|
|
||
| Provide exactly one of `--prompt` or `--prompt-stdin`. For example, read a multiline prompt from a file with `kilo cloud start --repo owner/repo --prompt-stdin < prompt.txt`. | ||
|
|
||
| ### kilo cloud send |
There was a problem hiding this comment.
WARNING: Unrelated removal of accurate --prompt/--prompt-stdin documentation.
This PR deletes two sentences documenting --prompt/--prompt-stdin for kilo cloud start and kilo cloud send, which has nothing to do with session cleanup. The flag still exists (packages/opencode/src/kilocode/cli/cmd/cloud-stdin.ts) and is still documented on the cloud-agent page, so the note remains correct. This looks accidental (the commit message even carries a docs-tmp line); please restore it or move it to a separate docs change.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
There was a problem hiding this comment.
To be clear on where this came from: the deletion rode along with the SDK regeneration, which the contributing guide requires after adding an endpoint. Those two sentences were hand-added on main after the file was last generated, so the generator does not know them. I reran ./script/generate.ts after today's upstream sync and it produced no changes at all, the prose never comes back from generation. Leaving the file exactly as the generator emits it.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The previous findings are resolved at Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit 9f58f3a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 9f58f3a)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Resolved in Files Reviewed (5 files)
Fix these issues in Kilo Cloud Previous review (commit f010300)Status: 8 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (41 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
A cancelled pass now counts children removed by earlier root cascades (progress sampling also runs while cancelling), counts root removals that failed before the cancel, and keeps its cancelling phase instead of flipping back to deleting. Cancel is sealed once the deletion sweep finishes so it can not report success during the vacuum, and the vacuum no longer swallows interrupts. The settings poll can stop a pass while its run reply is still outstanding and forgets a stop once no progress remains.
|
The distinction is between using I changed this locally to Validation passed: 15 focused extension tests, 35 backend retention/reclaim tests including a new 90-day preservation test, extension compile/lint/typechecks, CLI typecheck, knip, and annotation guards. In isolated VS Code with 90-day retention and synthetic sessions, Stop recorded a partial result; rerunning removed only the remaining expired fixtures. Both 60-day and 89-day sessions survived. No real user database or settings were accessed. The generated-docs explanation checks out; restoring prose directly in generated output is not needed here. |
|
The fix and regression tests are now pushed in 3401413. The earlier push failure was specific to the SSH identity/transport used for Git LFS. Using the repository maintainer SSH alias succeeded without disabling hooks or checks. The local verification results above apply to this commit; waiting for its CI before merging. |
marius-kilocode
left a comment
There was a problem hiding this comment.
Reviewed the cleanup and cancellation changes, including the cancellation-result correction in 3401413. Focused regression tests and isolated VS Code Stop/rerun verification passed. The 90-day tests preserve younger sessions and parents with fresh or busy descendants. Approval is subject to required CI checks passing.
|
Thanks! |
|
you're right. i checked that requested was used and stopped there, didn't notice .then(() => true) makes it always true no matter what cancel returned. catch(() => false) it is. |
Issue
Fixes #14538
Fixes #14539
Context
cleanup never gave disk space back. My kilo.db stayed at 367MB after a pass that emptied 90% of it. And once a pass started there was no way to stop it.
Implementation
After the deleting phase the pass reads freelist_count vs page_count and vacuums when free space clears both floors, 16MB and 20% of the file, then truncates the wal. Skipped when cancelled or when the numbers don't justify a rebuild. A busy database logs and moves on, the pass can't fail because of the vacuum.
New POST /kilocode/retention/cancel. The pass checks a flag between removals, keeps what it already deleted, skips the rest, and records a partial result with cancelled: true. The spacing window still counts, so the daily trigger doesn't restart the whole job later. On cancel, failed counts only sessions that were actually attempted, not the ones never reached.
Extension side is a Stop button next to Run while a pass is live, a stopping phase in the progress text, and the last run line marking interrupted runs. All 21 locales plus the checkpoints docs page.
Left out on purpose: the event table (269MB of my 367MB) is untouched. Capping per-session event growth is a separate discussion.
Screenshots / Video
How to Test
Manual/local verification
Everything below was run by the coding agent on my machine, I haven't repeated the commands by hand yet.
Reviewer test steps
Blocked checks and substitute verification
Didn't run the full extension suite. The targeted unit tests, typecheck and the live backend run cover the changed paths. Haven't verified the UI by hand yet, screenshot still pending.
Checklist