Repository navigation
fix(cli): keep sub-agents of a chat in use during session cleanup - #14502
Merged
marius-kilocode merged 2 commits intoSep 25, 2026
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
The new Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Collaborator
|
Thanks for the fix! |
marius-kilocode
approved these changes
Sep 25, 2026
This was referenced Sep 25, 2026
This was referenced Sep 26, 2026
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.
Issue
Fixes #14500
Context
Automatic session cleanup deleted sub-agent sessions from chats that were still in use. A sub-agent's timestamp stops changing when it finishes, and a new message in the chat updates only the chat. Cleanup judged each sub-agent on its own timestamp, so returning to an older chat left its earlier sub-agents to be deleted on the next pass. The sub-agent cards then showed no content, the sub-agent viewer stayed on "Initializing", and the agent could no longer resume those sub-agents.
Implementation
KiloSessionRetention.expiredRootsnow judges every session by its top-level chat, so a chat and all its sub-agents are kept, held back as busy, or deleted together.Screenshots / Video
Before
data-cleanup-bug.mp4
After
data-cleanup-fix.mp4
How to Test
Manual/local verification
bun run extension:isolatedon776d8b2c56using the reviewer steps below. The sub-agent was deleted, and its viewer stayed on "Initializing". After the fix, the same steps keep the sub-agent.expiredRootsover a read-only copy of a real profile. One chat resumed a day after its first sub-agents ran lost 7 of its 17 sub-agents at a 12-day limit, with no manual edits to the data.bun test ./test/kilocode/session/retention.test.tsandbun run typecheckinpackages/opencodepass.Reviewer test steps
Use an isolated instance. With a 1-day limit, cleanup deletes every chat in the profile older than a day.
bun run extension:isolated.1, and click Run Cleanup Now.Blocked checks and substitute verification
Checklist