fix(jetbrains): skip git and gh probes for removed worktrees - #13525
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 835c9f1)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 835c9f1)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 66e6871)Status: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 151.2K · Output: 8.1K · Cached: 306.7K Review guidance: REVIEW.md from base branch |
marius-kilocode
approved these changes
Aug 28, 2026
This was referenced Aug 31, 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 — reported from a user log where the JetBrains Agent Manager claimed git was not installed on a machine with a working git.
Context
When a worktree directory no longer exists, the backend still spawned
git/ghwith that directory as the working directory. IntelliJ fails the spawn withCannot start a process, the working directory '...' does not exist, and the probe classified that asGIT_MISSING:That surfaced a sticky "Git is not installed" notification/banner and pushed the probe loop into its slow 60s backoff, even though nothing was wrong with the environment.
A gone directory is normal: a frame or session can still be rooted at a worktree that was deleted (removal does not close that window), a worktree can be deleted outside the plugin (
rm -rf, terminalgit worktree remove), and git keeps the entry inworktree listasprunableuntil someone prunes.Implementation
All in
KiloWorktreeRpcApiImpl:sync(root)reconciles git metadata with the disk before any probe: bails out whenrootitself is gone, prunes when any listed entry isprunableor its checkout is missing, re-lists, and drops entries without a directory.stats()andprStatus()now source their worktrees from it, and inprStatus()the sync runs beforeghAvailable()so a deleted worktree is pruned rather than probed.ghAvailable()andprobeGh()check the directory first and returnOKwithout caching, so a dead directory reports nothing instead of poisoning the sharedghCachefor every caller.branchStatus()returns an empty DTO for a missing directory instead of running git there.badDir()covers the residual race where the directory disappears between the check and the spawn: a working-directory spawn failure is no longer evidence that git is uninstalled.Deliberately not in scope: the frontend still polls
project.basePathfor a project opened on a deleted worktree. This PR makes those probes harmless; stopping them (closing or rerouting such a project/session on removal) is a separate change.Screenshots / Video
N/A — no visual changes; the user-visible effect is the absence of a false notification.
How to Test
Manual/local verification
./gradlew typecheckfrompackages/kilo-jetbrains/— passed (agent)./gradlew :backend:testfrompackages/kilo-jetbrains/— passed (agent), including four new tests:statsprunes and drops a worktree deleted from disk,ghStatus/prStatuson a removed directory reportOK, andbadDirdistinguishes a dead working directory from a missinggitbinaryReviewer test steps
rm -rf .kilo/worktrees/<name>)gh probe skipped ... missing=true/worktree sync skippedinstead ofvalue=GIT_MISSINGgit worktree list --porcelainno longer lists the deleted worktree after a stats refreshBlocked checks and substitute verification
Checklist
Get in Touch
N/A