feat(vscode): add searchable worktree references - #13512
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (40 files)
Previous Review Summary (commit 13a9673)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 13a9673)Status: No Issues Found | Recommendation: Merge Files Reviewed (38 files)
Reviewed by grok-4.6 · Input: 77.8K · Output: 7.4K · Cached: 259.3K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 27, 2026 13:31
johnnyeric
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Comparing work across Agent Manager worktrees currently requires copying directory paths or attaching a past conversation when only a reference is needed. A flat list of all worktrees in the main
@menu would also make file selection noisy.Why This Change Was Made
Add one Worktrees entry to the
@menu. It opens a searchable picker built with the same sharedListcomponent and row styling as Past chats. Selection inserts the absolute worktree path and attaches a small text record containing its branch, base branch, and session IDs/titles. It does not attach directory contents, diffs, or conversation history, change the agent's working directory, or bypass normal tool permissions.The implementation reuses the active project's existing worktree inventory and session projection. It adds no backend endpoint or discovery request. The custom search input, clear button, filter state, and search-key forwarding were removed. A one-line shared
Listfix routes clearing throughapplyFilter(""), so the actual results reset with the input. Past chats' session-fetching logic is unchanged.Sorting, quoted from the implementation
Source:
packages/kilo-vscode/webview-ui/agent-manager/worktree-references.ts:47.With an empty search:
Visit history is bounded to 100 absolute paths and stored in webview state. Path identity avoids collisions between project-local worktree IDs. The current worktree, missing worktrees, and worktrees undergoing a worktree operation are not offered. A running agent is not excluded just because it is generating.
A typed query uses the shared List's fuzzy ranking over names, branches, and session titles. Absolute directory prefixes are deliberately excluded from fuzzy matching so common path characters do not produce unrelated results. The full path remains available on hover and in the reference.
The experimental multi-project sidebar keeps its existing project/context insertion behavior. This change does not replace its sorting rules.
User Impact
Type
@, select Worktrees, then search and select with Enter, Tab, or the mouse. Escape closes the picker. Existing atomic deletion, native undo, and draft restoration remain available.Example with an anonymized path:
The receiving agent can inspect that directory with its normal filesystem/Git tools, or use the supplied session IDs with Agent Manager and recall. A reference is metadata, not a frozen copy of the other worktree; a directory removed later can therefore be stale.
Evidence
The final simplified build was exercised in isolated VS Code with three real managed worktrees. Checks covered recent-first ordering, current-worktree exclusion, session-title search, clearing an unmatched query, keyboard selection, undo, draft restoration, and visit-order persistence after a webview reload.
A live agent deliberately inverted one comparison in a disposable worktree. A second live agent selected it through the new picker, inspected its on-disk Git diff, and reported:
The reviewing worktree remained unchanged. The isolated environment was cleaned up afterward.
1. Open Worktrees from the main @ menu.
2. Search or choose a recent worktree. Logging refactor was visited most recently in this example.
Validation:
bun run typecheckpassed, including JetBrains.bun run lintcompleted with warnings and no errors.All screenshots were privacy-reviewed and hosted in the separate PR-assets repository; no PR media is added to this repository.