feat(jetbrains): run configs from worktree editor - #13278
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (8 snapshots, latest commit c65cb69)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit c65cb69)Status: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
Previous review (commit 441fc80)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous review (commit 1747e05)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit ab7fca9)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (21 files)
Fix these issues in Kilo Cloud Previous review (commit 9162a87)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit 11ba989)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (28 files)
Fix these issues in Kilo Cloud Previous review (commit 0af7cd6)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit db41227)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (19 files)
Reviewed by grok-4.6 · Input: 179.4K · Output: 9.6K · Cached: 713.9K Review guidance: REVIEW.md from base branch |
Setting externalProjectPath/workingDirectory to the worktree root dropped nested project paths, so a subproject task such as :runIdeSplitMode configured against $PROJECT_DIR$/packages/kilo-jetbrains would run from the wrong project. Map the configured path onto the worktree instead, keeping paths that are already inside the worktree (managed worktrees live under <repo>/.kilo/worktrees/<name>) and paths outside the checkout untouched. Also treat a null clone() result as unsupported rather than crashing the run.
Resolve the backend project root before worktree run, stats, PR, and GitHub status calls so split-mode frontend paths are not sent to backend RPCs. Delegate worktree process stopping to the platform Stop action semantics and expose Kill only for handlers that support force termination.
Adds Build/Rebuild rows to the worktree Run popup that run the project's external-system build tasks against the worktree's own copy of each linked root, reusing the existing run tracking, Stop, and output pipeline. Also fixes worktree Run failing with 'System property idea.debugger.dispatch.port is not set' when the sandbox IDE itself was launched via Debug: the leaked DEBUGGER_ENABLED env is now explicitly cleared for transplanted and synthesized worktree executions.
…-agent-manager-run-feature # Conflicts: # bun.lock
Resolve the GitHub status probe root inside runCatching so a failed or blank resolution clears the busy flag instead of latching the probe loop. Share one transient settings slot per (root, worktree) for Build and Rebuild so switching between them restarts the sibling process instead of running two Gradle builds on the same worktree.
Review follow-ups on the worktree Run/Build feature and the split-mode project-root resolution. Correctness: - Stop a replaced clone's process before swapping in a fresh one. The platform's restart matches run settings by identity, so editing a source configuration between runs previously left the old process running and unreachable from the popup (for Gradle runIde* that means two sandboxes per checkout). - Re-establish the backend run-state stream with backoff. A completed or failed stream (backend project not resolved yet, reconnect) used to freeze the run indicator for the rest of the editor's life, while the rest of the popup kept working, so the failure was invisible. - Cache only a genuine backend resolution in ProjectRoot. The resolver fell back to the caller's hint, i.e. the synthetic JetBrains Client path in split mode, and cached it for the project lifetime, permanently breaking run/stats/PR/gh calls after one transient RPC failure. - Stop processes started in a worktree before it is removed, so git no longer deletes the working directory from under a live process. Threading and platform contracts: - Run configuration lookup, cloning, and serialization now happen inside a read action; third-party configurations touch the project model there. - Read the worktree name store on Dispatchers.IO instead of the RPC thread. - Serialize clone-cache mutation with a mutex so a double dispatch cannot create two clones that both execute and lose one process's tracking. Leaks and performance: - Drop the unbounded map of every clone ever executed in favour of an identity scan over the bounded clone cache, and prune entries on release. - Share one backend states subscription across all worktree editors via a new project-level WorktreeRunStatusService, instead of one stream each. - Register the session editor panel and the run control's cleanup before the resources they own, so a failure mid-construction cannot leak a coroutine scope or a stream reference. Also: rethrow CancellationException in KiloRunService instead of turning it into a failed result, route notifications through KiloNotifications, resolve projects with the same path normalization the workspace API uses, and drop the popup's test-only default arguments.
Add translations for the worktree run popup keys introduced by this PR across all JetBrains locale bundles. Remove the committed planning document from the PR so JetBrains changes follow the package guidance to keep .kilo/plans files out of commits.
…check Address PR review on the worktree run feature. release() no longer misses a run/build whose exec is already in flight. It now takes the clone lock, marks the worktree released, and keeps the cached clone so a delayed processStarted still resolves its key; that started process is stopped instead of tracked, so nothing keeps running against a directory about to be deleted. Terminated processes drop their released clones in the listener, and a fresh run/build clears its own worktree so a path recreated later works again. resolve() matches open projects with FileUtil.pathsEqual after a best-effort Path.normalize instead of the workspace URL decoder. The decoder returned null on a lone '%' (e.g. .../100%done) and compared case-sensitively, which broke every call for such roots and regressed Windows/macOS path identity.
…-agent-manager-run-feature
WorktreeController.remove calls service<KiloRunService>().release(...) to stop worktree run processes before removal. AgentManagerPanelTest never replaced that app service, so the call went through the real durable RPC path with no backend and the removal coroutine never reached service.remove(...), failing the merged-in "deleting a worktree closes and releases its worktree session editor" test. Replace KiloRunService with FakeRunRpcApi in setUp, matching the pattern already used for KiloWorktreeService/GhStatusCoordinator in this test and for KiloRunService in WorktreeRunControlTest.
…-agent-manager-run-feature
…-agent-manager-run-feature
…-agent-manager-run-feature
marius-kilocode
approved these changes
Aug 28, 2026
Make the build and run menu discoverable and keep the worktree header compact by placing Open next and showing Terminal as an icon.
kirillk
enabled auto-merge
August 28, 2026 19:45
kirillk
disabled auto-merge
August 28, 2026 20:01
WorktreeController now releases run processes before deletion, but its tests left KiloRunService connected to the real backend. Register the existing fake RPC so removal completes deterministically without a backend. Cover release-before-delete ordering and duplicate removal while release is pending.
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; requested directly in this development session.
Context
JetBrains Agent Manager worktree sessions need a more IDE-native way to run per-worktree processes than manually opening terminals. This adds a Run dropdown to the worktree editor header that lists supported IDE run configurations and starts them against the selected worktree while keeping output in the native Run tool window.
Implementation
The feature adds a split-mode RPC surface for run configurations and a backend project service that reuses IntelliJ's normal execution pipeline rather than reimplementing runners. Supported configurations are transplanted into transient per-worktree clones: Gradle/external-system configs are pointed at the worktree project path, and command-line-style configs get their working directory plus
WORKTREE_PATH/REPO_PATHenv vars set to the worktree context. Module-classpath configs are intentionally excluded because they would execute the main checkout's compiled classes.The worktree editor header now includes a Run button. Its popup lists currently running worktree processes with Stop and Show Output actions, supported startable run configs, and an Open in New Frame escape hatch. The popup includes the requested hint that full run/debug support should use a separate IDE frame. Process state is tracked through
ExecutionManager.EXECUTION_TOPIC, and stopping uses the recordedProcessHandlerso user-initiated stops from the Run tool window stay in sync.Tests cover backend filtering/transplant/caching/state transitions, RPC project resolution, and popup rows/actions.
Screenshots / Video
Manual/local verification
./gradlew typecheck testfrompackages/kilo-jetbrains/— passed.bun turbo typecheck --filter=!@kilocode/kilo-jetbrains— passed from cache.bun turbo typecheck --filter=@kilocode/kilo-jetbrains— passed.Reviewer test steps
Blocked checks and substitute verification
runIdeSplitModesmoke verification was not run in this agent session. Substitute verification was backend/frontend unit coverage plus./gradlew typecheck testfor the JetBrains plugin.Checklist
Get in Touch
N/A