feature: allow to run gateway plugin in IDEA/Remote Development (crw-11741)#340
feature: allow to run gateway plugin in IDEA/Remote Development (crw-11741)#340adietish wants to merge 4 commits into
Conversation
Signed-off-by: Andre Dietisheim <adietish@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR adds IntelliJ IDEA-specific Gradle execution support, documents IDEA feasibility, revises workspace and thin-client lifecycle handling, improves wizard disposal safety, and refactors kubeconfig file watching and cluster refresh coordination with expanded tests. ChangesIDEA build and feasibility
Workspace connection and wizard lifecycle
Kubeconfig monitoring
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #340 +/- ##
==========================================
+ Coverage 0.00% 33.16% +33.16%
==========================================
Files 4 111 +107
Lines 26 4640 +4614
Branches 0 880 +880
==========================================
+ Hits 0 1539 +1539
- Misses 26 2889 +2863
- Partials 0 212 +212 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…partial (crw-11741) Signed-off-by: Andre Dietisheim <adietish@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Late kubeconfig cluster updates raced dispose clearing steps; stop monitoring on dispose and skip nav updates when the step list is empty. Signed-off-by: Andre Dietisheim <adietish@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/kotlin/com/redhat/devtools/gateway/server/RemoteIDEServer.kt (1)
143-158: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winPod is re-resolved on every 500ms poll while waiting for readiness.
refreshPodBeforeCheck = isReadyStatecausesfindPod()/findContainer()(a K8s list call) on every poll iteration for up toreadyTimeout(120s) — up to ~240 extra API calls per connection attempt. Correctness-wise this is fine, but consider throttling the refresh (e.g., every few seconds instead of every poll) to reduce API load, especially under many concurrent users.As per path instructions, "Focus on major issues impacting performance."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/kotlin/com/redhat/devtools/gateway/server/RemoteIDEServer.kt` around lines 143 - 158, Throttle pod re-resolution in the readiness wait loop around isServerState instead of setting refreshPodBeforeCheck to isReadyState on every 500ms poll. Track elapsed time or poll count and refresh only at a multi-second interval, while continuing readiness checks every poll and preserving cancellation, timeout, and recycled-pod detection.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/kotlin/com/redhat/devtools/gateway/DevSpacesConnection.kt`:
- Around line 146-158: Update handleClientGone and both call sites in connect,
including the onDisconnectSignal handler and catch block, to pass the
connection’s captured workspace explicitly as the first argument. Ensure
handleClientGone uses that supplied workspace instead of re-reading
devSpacesContext.devWorkspace, so delayed callbacks tear down only the workspace
associated with their connection.
---
Nitpick comments:
In `@src/main/kotlin/com/redhat/devtools/gateway/server/RemoteIDEServer.kt`:
- Around line 143-158: Throttle pod re-resolution in the readiness wait loop
around isServerState instead of setting refreshPodBeforeCheck to isReadyState on
every 500ms poll. Track elapsed time or poll count and refresh only at a
multi-second interval, while continuing readiness checks every poll and
preserving cancellation, timeout, and recycled-pod detection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: dfccbbc5-db46-4819-bd27-e85ecaa5f67a
📒 Files selected for processing (19)
.run/Run Plugin (IDEA).run.xmlbuild.gradle.ktsdocs/crw-11741-iu-feasibility.mdgradle.propertiessrc/main/kotlin/com/redhat/devtools/gateway/DevSpacesConnection.ktsrc/main/kotlin/com/redhat/devtools/gateway/DevSpacesContext.ktsrc/main/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspace.ktsrc/main/kotlin/com/redhat/devtools/gateway/kubeconfig/FileWatcher.ktsrc/main/kotlin/com/redhat/devtools/gateway/kubeconfig/KubeConfigMonitor.ktsrc/main/kotlin/com/redhat/devtools/gateway/server/RemoteIDEServer.ktsrc/main/kotlin/com/redhat/devtools/gateway/view/DevSpacesWizardView.ktsrc/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesServerStepView.ktsrc/main/kotlin/com/redhat/devtools/gateway/view/steps/DevSpacesWorkspacesStepView.ktsrc/test/kotlin/com/redhat/devtools/gateway/DevSpacesContextTest.ktsrc/test/kotlin/com/redhat/devtools/gateway/devworkspace/DevWorkspaceTest.ktsrc/test/kotlin/com/redhat/devtools/gateway/kubeconfig/FileWatcherTest.ktsrc/test/kotlin/com/redhat/devtools/gateway/kubeconfig/KubeConfigMonitorTest.ktsrc/test/kotlin/com/redhat/devtools/gateway/server/RemoteIDEServerTest.ktsrc/test/kotlin/com/redhat/devtools/gateway/view/DevSpacesWizardViewDisposeTest.kt
💤 Files with no reviewable changes (1)
- gradle.properties
| val onDisconnectSignal: () -> Unit = { | ||
| finished.set(true) | ||
| // Ignore ephemeral closes during connect wait; teardown runs via catch. | ||
| if (sessionEstablished.get()) { | ||
| handleClientGone( | ||
| thinClient, | ||
| onDisconnected, | ||
| onDevWorkspaceStopped, | ||
| remoteIdeServer, | ||
| forwarder | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
handleClientGone reads the shared mutable devSpacesContext.devWorkspace instead of the connection's captured workspace.
connect() snapshots workspace at line 64 for this connection's lifetime, but handleClientGone (called from onDisconnectSignal and the catch block) ignores that and re-reads devSpacesContext.devWorkspace live. Since the thin-client's clientClosed/clientFailedToOpenProject callbacks are registered for Lifetime.Eternal (not scoped to this connect() call), a delayed disconnect signal from an earlier connection can fire after the user has already selected and connected to a different workspace. devSpacesContext.devWorkspace will then point at the new workspace, so the stale teardown calls removeWorkspace(newWorkspace) and can even stop() the wrong, currently-active DevWorkspace. This is made more likely now that isNextEnabled() no longer blocks starting a new connection while "already connected".
🐛 Proposed fix: thread `workspace` through instead of re-reading shared state
`@Suppress`("UnstableApiUsage")
private fun handleClientGone(
+ workspace: DevWorkspace,
client: ThinClientHandle? = null,
onDisconnected: () -> Unit,
onDevWorkspaceStopped: () -> Unit,
remoteIdeServer: RemoteIDEServer?,
forwarder: Closeable?
) {
if (!clientGoneHandled.compareAndSet(false, true)) {
return
}
- val workspace = devSpacesContext.devWorkspace
// Clear tracking + refresh UI before any remote wait so Connect is not stuck
// behind waitServerTerminated (up to 10s) when the wizard stays open in IDEA.
devSpacesContext.removeWorkspace(workspace)
runCatching { onDisconnected() }Update both call sites accordingly:
// onDisconnectSignal
handleClientGone(
workspace,
thinClient,
onDisconnected,
onDevWorkspaceStopped,
remoteIdeServer,
forwarder
)
// catch block
handleClientGone(workspace, client, onDisconnected, onDevWorkspaceStopped, remoteIdeServer, forwarder)As per path instructions, "Focus on major issues impacting performance, readability, maintainability and security."
Also applies to: 190-194, 228-252
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/kotlin/com/redhat/devtools/gateway/DevSpacesConnection.kt` around
lines 146 - 158, Update handleClientGone and both call sites in connect,
including the onDisconnectSignal handler and catch block, to pass the
connection’s captured workspace explicitly as the first argument. Ensure
handleClientGone uses that supplied workspace instead of re-reading
devSpacesContext.devWorkspace, so delayed callbacks tear down only the workspace
associated with their connection.
Source: Path instructions
Drop unused ThinClientSessionContext ahead of a later CRW-11119 rebase. Clear workspace tracking on disconnect before remote stop waits; gate Connect on Running only. Keep name/namespace bookkeeping and shorter status-exec probes (120s ready wait). Signed-off-by: Andre Dietisheim <adietish@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
fixes https://redhat.atlassian.net/browse/CRW-11741