Add prompt enhancement to JetBrains - #11165
Conversation
| @RequiresEdt | ||
| private fun syncEnhance() { | ||
| enhance.isEnabled = ready && !busy && !enhancing | ||
| enhance.icon = if (enhancing) AnimatedIcon.Default() else WAND_ICON |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (19 files)
Fix these issues in Kilo Cloud Reviewed by claude-4.6-sonnet-20260217 · 1,727,488 tokens Review guidance: REVIEW.md from base branch |
Add prompt enhancement to JetBrains
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.