fix(vscode): defer unused worktree watchers - #12865
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The two previous suggestions are resolved in
Files Reviewed (2 files, incremental)
Previous Review Summaries (2 snapshots, latest commit afdcf09)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit afdcf09)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
The previous warning is resolved: Fix these issues in Kilo Cloud Previous review (commit 35801cb)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (5 files)
The deferral design itself is sound: Reviewed by kimi-k3 · Input: 23.4K · Output: 10.7K · Cached: 328.5K Review guidance: REVIEW.md from base branch |
…-usage fix(vscode): defer unused worktree watchers
Problem
Agent Manager creates location-scoped services for sessions, PTYs, references, and file operations across many worktrees. The FFF search layer eagerly initialized a native index and filesystem watcher for every location, even when no file search was requested. Managed VS Code backends also retained a Core file watcher whose events are not consumed by the extension.
The previous watcher change, #12593, stopped Kilo bootstrap warmup but did not stop FFF from initializing inside each location scope. A later upstream refactor restored that eager FFF path.
Exact Fix
find,glob, orgrepis actually called.KILO_EXPERIMENTAL_DISABLE_FILEWATCHER=true.Measured Result
These measurements compare the live Kilo backend before and after reloading the packaged fix while multiple Agent Manager agents were active. CPU is workload-dependent, so the CPU values are sampled ranges rather than a controlled benchmark.
The remaining CPU is workload-driven agent execution, SQLite/event processing, and session handling. Codebase indexing is separate, consent-gated, and was not part of the 24-33 watcher fanout.
Merge Protection
The lifecycle tests fail if a future merge makes FFF eager again, creates duplicate concurrent pickers, skips the initial scan, or drops cleanup. The managed-backend test also verifies that VS Code always disables the unused Core watcher.