Skip to content

Add prompt enhancement to JetBrains - #11165

Merged
marius-kilocode merged 1 commit into
mainfrom
occipital-element
Jun 12, 2026
Merged

Add prompt enhancement to JetBrains#11165
marius-kilocode merged 1 commit into
mainfrom
occipital-element

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

The JetBrains composer cannot currently improve a draft before submission, even though the bundled CLI already provides the same prompt-enhancement capability used by the VS Code extension.

This adds a localized wand action to the JetBrains prompt panel and routes requests through the split-mode RPC boundary to the existing CLI endpoint. Enhancements use the configured small model and active workspace directory, preserve the draft on failure, reject stale results after edits, and support cancellable requests with a bounded timeout.

The small-model settings description now reflects prompt enhancement, and the behavior is covered across the backend HTTP layer, frontend service/controller boundary, and retained Swing composer.

file-2451a80d9fa49dd88a8892c9ab8efc78 dyn-9ac58ae4b2780f1db1358f7ca3bbb29a file-d0d0b01a5f1856e545ecee61849f5b3c

@marius-kilocode
marius-kilocode requested a review from kirillk June 12, 2026 15:24
@RequiresEdt
private fun syncEnhance() {
enhance.isEnabled = ready && !busy && !enhancing
enhance.icon = if (enhancing) AnimatedIcon.Default() else WAND_ICON

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: A new AnimatedIcon.Default() instance is created on every syncEnhance() call while enhancing == true. In the current flow this happens only once per enhancement, but it's a fragile pattern — if syncEnhance() is called again while still enhancing (e.g. from a future code path), multiple animation objects will be created and not explicitly stopped.

Consider caching a single instance:

private val enhancingIcon = AnimatedIcon.Default()

Then use enhancingIcon instead of AnimatedIcon.Default() in syncEnhance().


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Result.failure(e)
}
edt {
if (disposed) return@edt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: When the controller is disposed mid-enhancement, complete is never called, leaving the panel's enhancing flag stuck as true — the enhance button stays disabled and shows the spinner indefinitely if the panel is still visible.

The panel has no way to detect that the controller was disposed and the request was silently dropped. Consider delivering a Result.failure(CancellationException()) to complete on disposal, or having the panel subscribe to a disposal event so it can call invalidateEnhancement() to reset its state.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/controller/SessionController.kt 211 Controller disposal silently drops the complete callback, leaving the panel's enhance button stuck in loading state if the panel outlives the controller

SUGGESTION

File Line Issue
packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/prompt/PromptPanel.kt 347 AnimatedIcon.Default() is instantiated on each syncEnhance() call rather than cached as a field
Files Reviewed (19 files)
  • .changeset/bright-wands-improve.md
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/app/KiloBackendChatManager.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloCliDataParser.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloSessionRpcApiImpl.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/app/KiloBackendChatManagerTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/testing/MockCliServer.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/KiloNotifications.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/app/KiloSessionService.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/SessionUi.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/controller/SessionController.kt
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/ui/prompt/PromptPanel.kt
  • packages/kilo-jetbrains/frontend/src/main/resources/icons/wand-sparkles.svg
  • packages/kilo-jetbrains/frontend/src/main/resources/icons/wand-sparkles_dark.svg
  • packages/kilo-jetbrains/frontend/src/main/resources/messages/KiloBundle.properties + 16 locale variants
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/app/KiloSessionServiceTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/controller/PromptEnhancerTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/ui/PromptPanelTest.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/testing/FakeSessionRpcApi.kt
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/KiloSessionRpcApi.kt

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 1,727,488 tokens

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 35a7080 into main Jun 12, 2026
20 checks passed
@marius-kilocode
marius-kilocode deleted the occipital-element branch June 12, 2026 15:40
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
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