Skip to content

feat(jetbrains): add From PR and From Branch tabs to New Worktree dialog - #13440

Merged
kirillk merged 4 commits into
mainfrom
bold-island
Aug 26, 2026
Merged

feat(jetbrains): add From PR and From Branch tabs to New Worktree dialog#13440
kirillk merged 4 commits into
mainfrom
bold-island

Conversation

@kirillk

@kirillk kirillk commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Issue

No linked issue — this is a follow-up refinement to the JetBrains Agent Manager New Worktree flow.

Context

The JetBrains plugin's New Worktree dialog previously used a single "Import" tab with a
radio pair to choose between importing a GitHub pull request and importing a local branch.
The radios were redundant chrome: the two inputs are mutually exclusive, so the choice is
better expressed as tabs. This PR splits the dialog into three top-level tabs — New,
From PR, and From Branch — and removes the radio buttons.

It also fixes a crash: opening the dialog on IntelliJ 2026.1 / JBR 25 could throw an NPE
from the platform's editable-combo layout code (BasicComboBoxUI.getDisplaySize dereferencing
a null editor), taking down the whole dialog.

Implementation

  • Three tabs. DialogTab becomes NEW | PR | BRANCH; the selected tab alone decides
    what OK does, so submit() is a direct dispatch to submitCreate() / submitPr() /
    submitBranch(). The radio pair, its ButtonGroup, and all the document/focus listeners
    that only existed to flip the radios are gone.
  • Tab-specific failure notifications. WorktreeController now carries a CreateKind
    (CREATE/BRANCH/PR) through the create/import path and reports failures via a
    CreateFailure payload, so the panel can show the right "couldn't import PR/branch" title.
  • Shared PR-URL parsing. parsePrUrl / PrRef moved from the backend RPC impl into
    packages/kilo-jetbrains/shared (ai.kilocode.rpc.parsePrUrl) so the frontend dialog and
    backend importPr use one parser.
  • BranchPicker + NPE fix. The base/branch combos are now a small BranchPicker
    (editable, fuzzy-matching branch combo). DarculaComboBoxUI tolerates a transient null
    editor everywhere it overrides, but the inherited BasicComboBoxUI.getDisplaySize
    dereferences it for editable combos. BranchPicker.getPreferredSize reinstalls the UI
    editor if the platform dropped it, before size computation reads it.

.kilo/plans/** intentionally excluded from this commit per repo policy.

Screenshots / Video

N/A — I can't capture the running IDE from here. The visible change is the New Worktree
dialog showing three tabs (New / From PR / From Branch) instead of one New tab plus an
Import tab with two radio buttons.

before after
New + Import (radio: PR / Branch) New / From PR / From Branch tabs

How to Test

Manual/local verification

  • ./gradlew :frontend:test --tests ai.kilocode.client.agentManager.worktree.NewWorktreeDialogTest — 19 tests pass (agent-executed), including the new three-tab routing test and the dropped-editor layout regression.
  • ./gradlew typecheck — passes (agent-executed).
  • ./gradlew test — full JetBrains suite passes (agent-executed).

Reviewer test steps

  1. Run the plugin (Run IDE (Split Mode) or ./gradlew runIde), open Agent Manager, trigger New Worktree.
  2. Confirm three tabs: New, From PR, From Branch; OK reads "Create Worktree" on New and "Import Worktree" on the others.
  3. From PR: paste a GitHub PR URL and confirm it imports; a non-PR URL shows a validation error.
  4. From Branch: pick/type a local branch and confirm it imports; an empty branch list disables the picker.
  5. Confirm the dialog opens without the previous NPE crash.

Blocked checks and substitute verification

  • Visual capture of the running IDE could not be produced in this environment; substitute verification is the frontend Swing tests that drive the real dialog tab tree and the layout regression test.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes (JetBrains plugin uses its own package.json versioning, not the monorepo changeset flow)
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

Split the New Worktree dialog into three tabs — New, From PR, From Branch —
replacing the radio-button import source picker. The selected tab alone
determines what OK does, so import failures now surface tab-specific
notifications.

Extract PR-URL parsing into shared ai.kilocode.rpc.parsePrUrl so both the
frontend dialog and backend importPr use one parser. Add BranchPicker, an
editable branch combo, and guard the platform BasicComboBoxUI.getDisplaySize
NPE by reinstalling the UI editor before size computation.
@kilo-code-bot

kilo-code-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • .changeset/jetbrains-worktree-pr-detection.md
  • .changeset/jetbrains-worktree-tab-artifacts.md
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorktreeRpcApiImpl.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/PrResolver.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloWorktreeRpcApiImplTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/PrResolverTest.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/AgentManagerPanel.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/worktree/NewWorktreeDialog.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/worktree/WorktreeController.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/AgentManagerPanelTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/WorktreeControllerTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/worktree/NewWorktreeDialogTest.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/KiloWorktreeRpcApi.kt
Previous Review Summary (commit 67b9629)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 67b9629)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (11 files)
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorktreeRpcApiImpl.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloWorktreeRpcApiImplTest.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/AgentManagerPanel.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/worktree/BranchPicker.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/worktree/NewWorktreeDialog.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/agentManager/worktree/WorktreeController.kt
  • packages/kilo-jetbrains/frontend/src/main/resources/messages/KiloBundle.properties
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/AgentManagerPanelTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/WorktreeControllerTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/agentManager/worktree/NewWorktreeDialogTest.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/PrUrl.kt

Reviewed by grok-4.6 · Input: 109.6K · Output: 20.6K · Cached: 848.8K

Review guidance: REVIEW.md from base branch main

@marius-kilocode

Copy link
Copy Markdown
Collaborator

@kirillk Interesting, would love a screeenshot.

@kirillk

kirillk commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@kirillk Interesting, would love a screeenshot.

there's nothing fancy, just split it into 3 views since they're exclusive to each other

GIF Recording 2026-08-26 at 3 35 52 PM

@kirillk
kirillk merged commit ee987f6 into main Aug 26, 2026
24 checks passed
@kirillk
kirillk deleted the bold-island branch August 26, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants