fix(jetbrains): harden agent manager worktrees - #13431
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summary (commit 2127b8b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 2127b8b)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (13 files)
Reviewed by grok-4.6 · Input: 170.3K · Output: 14.4K · Cached: 429.7K Review guidance: REVIEW.md from base branch |
johnnyeric
approved these changes
Aug 25, 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
No linked issue; fixes a JetBrains Agent Manager worktree data-loss regression discovered during worktree cleanup.
Context
JetBrains Agent Manager could create new worktrees under the currently opened linked worktree instead of the repository's main worktree storage. Deleting the parent worktree could then recursively remove nested child worktree directories and leave stale git worktree metadata behind.
This PR hardens creation, listing, removal, and missing-workspace handling so deleted or misplaced worktrees do not cause repeated backend errors or misleading Gateway advice.
Implementation
prunablemarker, hide dead managed worktrees from the list, constrain managed entries to direct children of.kilo/worktrees, and reconcile stale JetBrains worktree state.MISSINGworkspace state and frontend copy for deleted folders so users do not see unrelated JetBrains Gateway guidance.Screenshots / Video
N/A - backend/worktree safety and connection-state copy changes only; no visual layout changes.
How to Test
Manual/local verification
Agent-run verification:
./gradlew :backend:test --tests ai.kilocode.backend.rpc.KiloWorktreeRpcApiImplTest./gradlew :backend:test --tests ai.kilocode.backend.workspace.KiloBackendWorkspaceTest./gradlew :frontend:test --tests ai.kilocode.client.agentManager.WorktreeControllerTest --tests ai.kilocode.client.session.controller.ConnectionDelayTest./gradlew typecheck./gradlew testgit diff --checkReviewer test steps
<repo>/.kilo/worktrees/<slug>..kilo/worktrees, not under the linked worktree.Blocked checks and substitute verification
Checklist
Get in Touch
Available in the Kilo Code Discord.