Skip to content

feat(cli): reload the whole project from /reload - #14103

Merged
marius-kilocode merged 2 commits into
mainfrom
reload-project-from-worktree
Sep 14, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
reload-project-from-worktree

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

/reload (editor chat slash command, settings reload button, CLI palette, JetBrains) only rebooted the instance for the directory the request came from. In an Agent Manager worktree that meant the worktree instance reloaded while the main checkout and sibling worktrees kept their cached config, so a project config change appeared to apply in only one place.

Why This Change Was Made

Instances are keyed per directory on the server, so a reload scoped to the request directory cannot refresh the rest of the project. Project config changes normally affect the whole project, including linked worktrees. The endpoint is now project-scoped: it reboots every loaded instance whose project id matches and leaves unloaded directories untouched, so no worktree is started only to be reloaded.

The 409 guard moved from the per-directory session list to the project-wide status store, so a busy session anywhere in the project blocks the reload instead of producing a partial reload. The shared InstanceStore change is limited to a generic list() accessor; project selection and the reload loop live in packages/opencode/src/kilocode/project/reload.ts.

All callers share the endpoint, so the chat slash command, the settings reload button, the CLI palette, and JetBrains all become project-scoped with no client-side enumeration.

User Impact

  • A reload started in a worktree refreshes the main checkout and every loaded worktree of the same project.
  • The reload is refused with 409 while any session in the project is running.
  • VS Code refreshes config, agents, skills, and commands after a successful reload so the palette and settings reflect the reloaded state.
  • Unopened worktrees are not started by the reload.

Evidence

  • Backend end-to-end against the local server: created a git repo with a remote and a linked worktree, loaded both instances, and called POST /instance/reload?directory=<worktree>. The response was 200 true and the global event stream emitted server.instance.disposed for both the worktree directory and the main directory, both with the same project id.
  • bun test ./test/kilocode/instance-store-project-reload.test.ts ./test/kilocode/instance-reload.test.ts passes (7 tests), including the case where another project's loaded instance is left alone.
  • POST /instance/reload httpapi exercise scenario passes.
  • opencode typecheck, check-opencode-annotations.ts --worktree, VS Code typecheck, lint, and unit tests pass.

Reload now reboots every loaded instance of the current project instead of only the directory the request came from. A reload started in an Agent Manager worktree therefore also refreshes the main checkout and sibling worktrees, which is what users expect after a project config change.

The 409 guard now checks sessions across the whole project, so a busy session in any loaded instance of the project blocks the reload. The endpoint stays project-scoped for every caller, so the chat slash command, the settings button, the CLI palette, and JetBrains behave the same.

The VS Code provider refreshes config, agents, skills, and commands after a successful reload so the UI reflects the reloaded state.
@kilo-code-bot

kilo-code-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

Both previously reported findings are resolved in the latest commit:

  • The request directory's reload now propagates failures instead of being swallowed by catchCause, so the endpoint returns an error when the caller's own instance fails to reboot.
  • InstanceStore.list() no longer blocks on in-flight boots; it uses Deferred.isDone to include only booted instances, so a reload is not coupled to unrelated projects' startup.

The new behavior is covered by unit tests for the request-directory failure and the sibling-failure skip paths.

Files Reviewed (4 files)
  • packages/opencode/src/kilocode/project/reload.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/instance-reload.ts
  • packages/opencode/src/project/instance-store.ts
  • packages/opencode/test/kilocode/instance-store-project-reload.test.ts
Previous Review Summary (commit 3a2c5d5)

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

Previous review (commit 3a2c5d5)

Status: 2 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

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

WARNING

File Line Issue
packages/opencode/src/kilocode/project/reload.ts 12 catchCause swallows all reload failures, so the endpoint returns success even when a matched instance (including the request directory) fails to reboot. Previously this failure propagated to the client.

SUGGESTION

File Line Issue
packages/opencode/src/project/instance-store.ts 231 list() awaits every cached instance's boot across all projects, coupling a reload to unrelated projects' startup; consider Deferred.poll/project filtering.
Files Reviewed (8 files)
  • .changeset/project-scoped-reload.md
  • packages/kilo-docs/pages/code-with-ai/platforms/cli.md
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/opencode/src/kilocode/project/reload.ts - 1 issue
  • packages/opencode/src/kilocode/server/httpapi/groups/instance-reload.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/instance-reload.ts
  • packages/opencode/src/project/instance-store.ts - 1 issue
  • packages/opencode/test/kilocode/instance-store-project-reload.test.ts

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

The request directory's reload failure now propagates so callers still see a failed reboot; sibling failures stay logged and isolated. InstanceStore.list() only returns settled instances, so a reload is no longer blocked by another project's in-flight boot.
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