Skip to content

fix(agent-manager): speed up worktree session startup - #13447

Merged
marius-kilocode merged 1 commit into
mainfrom
enable-concurrent-worktree-creation
Aug 26, 2026
Merged

fix(agent-manager): speed up worktree session startup#13447
marius-kilocode merged 1 commit into
mainfrom
enable-concurrent-worktree-creation

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Creating an Agent Manager worktree waits on Git checkout and then keeps the successful setup overlay visible after the session is ready. Large repositories also spend unnecessary time enumerating remote-tracking branches during local branch collision checks.

Why This Change Was Made

Use Git's built-in parallel checkout with two workers when the repository has no explicit checkout.workers setting, while preserving explicit user configuration. Limit collision detection to local branch refs, which are the only refs that can conflict with a new local branch. Dismiss successful setup feedback immediately after readiness while retaining the error delay.

User Impact

The first usable Agent Manager session was measured at approximately 4.37 seconds before these changes and 2.65 seconds after them.

Measurement Before After Improvement
Complete startup to usable session 4.37 s 2.65 s 1.72 s, 39%
Git checkout 3.15 s 2.12 s 1.03 s, 33%
Local branch collision lookup 218 ms 25 ms 193 ms, 89%
Successful setup overlay delay 500 ms Immediate 500 ms

The measurements used a disposable repository with 9,640 tracked files and 424 Git LFS files. The total varies with repository size, Git LFS content, disk speed, hooks, setup scripts, remote latency, and host load.

Safety Validation

The checkout still uses a fresh remote commit, standard git worktree add, Git LFS, and post-checkout hooks. Explicit user-defined checkout.workers values remain unchanged. Branch collision tests cover local branches and remote-tracking refs.

  • Focused Agent Manager tests passed, including explicit worker configuration, branch collisions, post-checkout hook failure tolerance, and setup overlay timing.
  • Extension typecheck, lint, compile, formatting, and check-kilocode-change passed.

@kilo-code-bot

kilo-code-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/faster-agent-manager-worktree-start.md
  • packages/kilo-vscode/src/agent-manager/WorktreeManager.ts
  • packages/kilo-vscode/tests/unit/agent-manager-arch.test.ts
  • packages/kilo-vscode/tests/unit/worktree-manager.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx

Reviewed by grok-4.6 · Input: 140.1K · Output: 18K · Cached: 502.3K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit 7834f93 into main Aug 26, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the enable-concurrent-worktree-creation branch August 26, 2026 07:45
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