Skip to content

fix(jetbrains): stabilize workspace reload state - #12044

Merged
kirillk merged 1 commit into
mainfrom
investigate-jetbrains-test-flakiness
Jul 8, 2026
Merged

fix(jetbrains): stabilize workspace reload state#12044
kirillk merged 1 commit into
mainfrom
investigate-jetbrains-test-flakiness

Conversation

@kirillk

@kirillk kirillk commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Make JetBrains backend app reloads observable even when global app data is unchanged by adding an internal Ready revision. Keep the app SSE watcher subscribed during reloads and tighten workspace reload tests to wait for concrete mock-server side effects and provider data changes.

Why

The flaky workspace SSE test could miss a fast Loading -> Ready cycle and then wait forever because StateFlow suppresses equal Ready values. Workspace RPC subscriptions also depend on observing those reloads so they can resubscribe to fresh workspace instances after the manager clears stale state.

Notes

The Ready revision stays internal to backend state; the RPC DTO shape is unchanged.

@kilo-code-bot

kilo-code-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/app/KiloAppState.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/app/KiloBackendAppService.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspaceTest.kt

Notes:

  • Verified _events in KiloBackendConnectionService is a single persistent MutableSharedFlow created once at construction, so dropping eventWatcher?.cancel() from load() does not risk the watcher outliving/orphaning a stale event source — it correctly keeps observing the same flow across reloads, matching the stated intent.
  • KiloAppState.Ready.rev is only ever constructed with an explicit value at its one production call site (setAppReady), so adding it to the data class correctly breaks StateFlow value-equality suppression for a fast Loading → Ready cycle without introducing dead paths.
  • New test assertions (awaitRequestCount, rev-based first) replace polling/delay-based waits with deterministic conditions, in line with this package's integration-test guidance.
  • packages/kilo-jetbrains/ is a Kilo-owned package, so no upstream fork-hygiene concerns apply; no changeset needed since this is an internal stability/test fix with no user-visible behavior change.

Reviewed by claude-sonnet-5-20260630 · Input: 32 · Output: 18.4K · Cached: 1.3M

Review guidance: REVIEW.md from base branch main

@kirillk
kirillk enabled auto-merge July 8, 2026 15:31
@kirillk
kirillk merged commit 7e74559 into main Jul 8, 2026
24 checks passed
@kirillk
kirillk deleted the investigate-jetbrains-test-flakiness branch July 8, 2026 18:48
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…-test-flakiness

fix(jetbrains): stabilize workspace reload state
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