Skip to content

fix(jetbrains): scope config warnings to the workspace directory - #13886

Merged
kirillk merged 3 commits into
mainfrom
fix-jetbrains-config-warning-scope
Sep 8, 2026
Merged

kirillk merged 3 commits into
mainfrom
fix-jetbrains-config-warning-scope

Conversation

@kirillk

@kirillk kirillk commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Issue

Fixes #

Context

JetBrains sessions were showing a stray "Configuration warnings" banner reading /Users/<you>: Automatic indexing is disabled in home and filesystem root directories..., attributed to $HOME instead of the real project. Clicking "Try again" restarted the whole CLI backend and re-showed the identical banner.

Root cause: KiloBackendAppService.fetchWarnings() called /config/warnings (a directory-scoped endpoint) from an app-scoped service (Service.Level.APP, one instance per IDE) with no directory. The CLI fell back to process.cwd(), and KiloBackendCliManager spawned kilo serve without setting a working directory, so it inherited the IDE JVM's cwd — $HOME on macOS. The CLI then built a real instance for $HOME, which trips the "no automatic indexing in home/root" safeguard and returns it as a config warning. Because warnings lived on KiloAppStateDto, that warning painted onto every session regardless of its actual directory, and genuine project-local .kilo/kilo.json warnings were never fetched for the right directory in the first place.

Implementation

Two independent fixes:

  1. CLI working directoryKiloBackendCliManager now sets ProcessBuilder.directory(...) to a plugin-owned empty directory (<IDE system path>/kilo/cwd, via the new workDir() helper) before spawning kilo serve. Falls back to inheriting the IDE's cwd if that directory can't be created, so this can never break startup. This means any endpoint that omits directory in the future lands somewhere harmless instead of $HOME.

  2. Config warnings become workspace-scoped — moved warnings off KiloAppStateDto and onto KiloWorkspaceStateDto/KiloWorkspaceState.Ready, fetched per-directory via api.configWarnings(directory = directory) in KiloBackendWorkspace.load(), right after providers/agents/commands/skills finish loading. The fetch is sequential and outside the parallel launch block, and failures are swallowed (return empty list) so a slow or erroring warnings call can never fail the workspace load. A global.config.updated SSE handler refreshes just the warnings in place (via Ready.copy(warnings = ...)) without reloading the rest of the workspace data.

    SessionController now reads workspace.warnings instead of app.warnings for the banner, telemetry, and retry decision. The retry-with-warnings path now calls workspace.reload() instead of app.retryAsync() — restarting the backend never fixed a warning (it's derived from on-disk config, not connection state), so the old behavior just repeated the same banner after a full CLI restart.

    KiloBackendAppService.retry() no longer escalates to restartConnection("warnings remained after refresh") for a Ready app state, since warnings are no longer part of AppData at all.

Net effect: the false $HOME banner disappears, and real project-local config warnings (e.g. malformed .kilo/kilo.json) will now actually surface, scoped to the right directory — which they never did before this change, since warnings were always fetched for whatever directory kilo serve happened to inherit.

All changes are confined to packages/kilo-jetbrains/; no CLI (packages/opencode/, packages/core/) or SDK changes.

Screenshots / Video

N/A — no visual changes to the banner itself, only which directory's warnings it shows and whether "Try again" restarts the backend.

How to Test

Manual/local verification

  • ./gradlew typecheck — passes (also runs automatically via the pre-push hook).
  • ./gradlew test — full suite passes. One WorktreeSessionEditorManagerTest failure appeared in one full run; confirmed pre-existing/flaky by re-running it in isolation (passed) and re-running the full suite (passed clean) — unrelated to any file touched in this change.
  • Ran the new/updated tests directly:
    • ./gradlew :backend:test --tests "ai.kilocode.backend.cli.KiloBackendCliManagerEnvTest" --tests "ai.kilocode.backend.app.KiloBackendAppServiceTest" --tests "ai.kilocode.backend.workspace.KiloBackendWorkspaceTest" --tests "ai.kilocode.backend.rpc.KiloWorkspaceDtoMapperTest" — pass
    • ./gradlew :frontend:test --tests "ai.kilocode.client.session.controller.AppWatchingTest" --tests "ai.kilocode.client.session.controller.ConnectionDelayTest" --tests "ai.kilocode.client.session.ui.ConnectionPanelTest" — pass

Reviewer test steps

  1. ./gradlew --no-configuration-cache runIdeSplitMode from packages/kilo-jetbrains/, open a project that is not $HOME.
  2. Confirm no "Configuration warnings" banner appears, and kilo.log shows a CLI cwd: <IDE system path>/kilo/cwd line.
  3. Introduce a syntax error in that project's .kilo/kilo.json and save — confirm the banner now appears, scoped to that file's path.
  4. Click "Try again" — confirm the log shows a workspace reload, not a backend restart (no retry: restarted connection line).
  5. Fix the file and save — confirm the banner clears via the global.config.updated SSE path.

Blocked checks and substitute verification

  • Did not run the manual reviewer test steps above in a live IDE sandbox (agent has no GUI); substitute verification was the automated test suite covering the same code paths (workspace warnings loading into Ready, SSE refresh in place, failed/empty warnings not blocking Ready, retry reloading the workspace instead of restarting the app) plus ./gradlew typecheck/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 — @kilocode/kilo-jetbrains is "private": true and excluded from the changesets flow; no changeset needed.
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

Config warnings were fetched with no directory from an app-scoped
service, so the CLI resolved the omitted directory to process.cwd().
Since the plugin spawned the CLI without setting a working directory,
that cwd was the IDE's own cwd (typically $HOME on macOS), so every
session showed a stray 'Automatic indexing is disabled in home and
filesystem root directories' banner attributed to $HOME instead of
the real project, and genuine project-local .kilo/kilo.json warnings
were never surfaced at all.

- Set the kilo serve child process's working directory to a
  plugin-owned empty directory (KiloBackendCliManager.workDir()) so
  any endpoint that omits directory lands somewhere harmless instead
  of $HOME.
- Move config warnings from KiloAppStateDto (app-scoped, one instance
  per IDE) to KiloWorkspaceStateDto (directory-scoped), fetching them
  per-workspace via api.configWarnings(directory = directory) and
  refreshing them in place on the global.config.updated SSE event.
- Update SessionController to read workspace.warnings instead of
  app.warnings, and to reload the workspace instead of restarting the
  backend when warnings are present. Restarting never resolved a
  static warning, so 'Try again' just repeated it.
@kilo-code-bot

kilo-code-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloBackendCliManager.kt
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspace.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/cli/KiloBackendCliManagerEnvTest.kt
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspaceTest.kt
Previous Review Summary (commit 102761b)

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

Previous review (commit 102761b)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspace.kt 227 refreshWarnings() runs inside events.collect and can stall the global SSE bus
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspace.kt 154 Hung /config/warnings can block workspace Ready indefinitely

SUGGESTION

File Line Issue
packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloBackendCliManager.kt 626 mkdirs() returns false if the directory already exists, falling back to inherited cwd
Files Reviewed (18 files)
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/app/KiloAppState.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/app/KiloBackendAppService.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/cli/KiloBackendCliManager.kt - 1 issue
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloAppRpcApiImpl.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorkspaceDtoMapper.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/rpc/KiloWorkspaceRpcApiImpl.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspace.kt - 2 issues
  • packages/kilo-jetbrains/backend/src/main/kotlin/ai/kilocode/backend/workspace/KiloWorkspaceState.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/app/KiloBackendAppServiceTest.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/cli/KiloBackendCliManagerEnvTest.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloWorkspaceDtoMapperTest.kt - 0 issues
  • packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/workspace/KiloBackendWorkspaceTest.kt - 0 issues
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/session/controller/SessionController.kt - 0 issues
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/controller/AppWatchingTest.kt - 0 issues
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/controller/ConnectionDelayTest.kt - 0 issues
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/session/controller/SessionControllerTestBase.kt - 0 issues
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/KiloAppStateDto.kt - 0 issues
  • packages/kilo-jetbrains/shared/src/main/kotlin/ai/kilocode/rpc/dto/KiloWorkspaceStateDto.kt - 0 issues

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 85.1K · Output: 12K · Cached: 475.5K

Review guidance: REVIEW.md from base branch main

kirillk and others added 2 commits September 7, 2026 16:34
Address review feedback:

- Launch the global.config.updated refresh instead of awaiting it inside
  events.collect. connection.events is a shared MutableSharedFlow with
  SUSPEND overflow, so a slow fetch in the collector would stall chat and
  every other workspace. Matches KiloBackendAppService.
- Fetch config warnings through a bounded client. The workspace api has
  callTimeout(0)/readTimeout(0), so a hung /config/warnings never threw and
  left the workspace on Connecting even though the required catalog had
  loaded. Restores the 'hung warnings do not prevent Ready' coverage that
  moved over from the app-level test.
- Treat an existing cwd directory as success in workDir(). mkdirs() returns
  false when the directory already exists, so a concurrent spawn could make
  the CLI fall back to the inherited IDE cwd, reintroducing the $HOME
  resolution this helper prevents.
@kirillk
kirillk merged commit 74a9e2a into main Sep 8, 2026
22 checks passed
@kirillk
kirillk deleted the fix-jetbrains-config-warning-scope branch September 8, 2026 13:01
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