fix(vscode): speed up settings saves - #12093
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The latest commit (
No new issues found in the incremental diff. Files Reviewed (2 files)
Previous Review Summary (commit 45ced29)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 45ced29)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (5 files)
Both findings are diagnosability gaps in otherwise sound bounded-concurrency implementations: the concurrency-bound design, Reviewed by claude-sonnet-5 · Input: 36 · Output: 8.8K · Cached: 856K Review guidance: REVIEW.md from base branch |
fix(vscode): speed up settings saves
VS Code settings saves currently scale with the number of mounted Agent Manager directories. Before a config write starts, the extension serially checks pending permissions, questions, suggestions, and network waits for every directory. Global writes then dispose loaded backend instances serially.
This change bounds both directory-level phases to four concurrent worktrees while preserving per-directory cleanup order and save failure behavior. Process-global suggestions are drained once, active prompt drains settle before errors are returned, and instance disposal still completes before the global config response. Concurrent instance disposal is all-settled and uninterruptible, so a failed notification listener or interrupted caller cannot strand sibling worktrees in a partially disposed cache state.
Profiling
The before/after profiles exercise the real
KiloConnectionService.drainPendingPrompts()andInstanceStore.disposeAll()implementations with controlled delays so the comparison is deterministic.The prompt-drain profile represents the high-worktree Agent Manager case that produced four-to-five-second saves. The disposal profile isolates the second serial fan-out in the backend. Both improvements come from bounded concurrency rather than skipping cleanup or acknowledging writes before config changes are effective.