feat(cli): share codebase indexes across worktrees - #11182
Conversation
Code Review SummaryStatus: 8 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Incremental Review Notes (commit 019270e → HEAD)Changes since the previous review commit are housekeeping:
No new issues found. All 8 previous issues remain open on unchanged files. Files Reviewed (35 files — unchanged from previous review)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit 019270e)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 019270e)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Incremental Review NotesSince the previous review commit (
All other changes in the incremental diff (snapshot materialization, security fixes, work-style onboarding, JetBrains prompt enhancement, question routing, runner ordering) came from separate PRs merged into Previous Issues Status
Files Reviewed (PR diff — 35 files)
Fix these issues in Kilo Cloud Previous review (commit 0e735ba)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Resolved in Latest Commits
Files Reviewed (21 files)
Reviewed by deepseek-v4-pro-20260423 · 262,307 tokens Review guidance: REVIEW.md from base branch |
f4a7ad1 to
6e91560
Compare
# Conflicts: # packages/opencode/src/kilocode/indexing-worker-client.ts # packages/opencode/test/kilocode/indexing-worktree.test.ts
markijbema
left a comment
There was a problem hiding this comment.
Main asks from review (posting as line comments).
# Conflicts: # packages/kilo-indexing/test/kilocode/indexing/manager.test.ts
feat(cli): share codebase indexes across worktrees
Codebase indexing was disabled in Agent Manager worktrees because independently indexing every checkout duplicated embeddings and vector storage. Worktree sessions therefore could not use semantic search, even when the primary checkout already had a complete compatible index.
This change treats the primary checkout index as a shared baseline and keeps a small per-worktree overlay for modified, added, deleted, or ignored files. Worktree searches embed the query once, query the baseline and overlay together, mask stale baseline paths, and merge only results valid for the current checkout. Sibling worktree overlays remain physically separate and are never queried together.
Indexing workers are shared process-wide and native store initialization is serialized, avoiding Bun crashes when Agent Manager initializes several LanceDB-backed worktrees concurrently. Semantic search registration now follows the effective indexing configuration rather than index completion timing, so new Agent Manager sessions receive the tool while their worktree overlay initializes.