Skip to content

fix(vscode): keep Agent Manager .kilo out of git in subdirectory workspaces - #14274

Merged
marius-kilocode merged 2 commits into
mainfrom
disable-kilo-folder-creation
Sep 18, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
disable-kilo-folder-creation

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The Agent Manager could leave a .kilo directory untracked in a project.

  • In a workspace that is a subdirectory of a git repository, the git exclude step failed (resolveGitDir required .git at the workspace root) and the anchored patterns never matched the nested path, so .kilo/worktrees/ showed up in git status.
  • In a folder that was not a git repository, the worktrees directory was created before exclusion was attempted, so a later git init and commit could include it.

Why This Change Was Made

  • ensureGitExclude now asks git for the exclude file and the repository-relative prefix (--path-format=absolute --git-path info/exclude and --show-prefix), so ignore patterns are anchored to the real .kilo location for subdirectory workspaces and linked worktrees.
  • reconcilePool and createWorktree exclude before creating .kilo/worktrees, so a repository that cannot be excluded leaves nothing behind.
  • addExcludeEntry matches whole lines instead of substrings, so a prefixed entry such as packages/app/.kilo/worktrees/ no longer suppresses the unprefixed repo-root entry.

Shared project config under .kilo/ (kilo.jsonc, agents, commands, rules) remains tracked.

User Impact

Opening the Agent Manager no longer pollutes git status in subdirectory workspaces and no longer creates .kilo in folders that are not git repositories.

Evidence

Behavior verified by driving the real WorktreeManager against fresh repositories:

Workspace state Before After
Repo root, clean clean clean
Repo with no commits clean clean
Repo with existing .git/info/exclude clean clean
Repo with .kilo/ in .gitignore clean clean
Linked worktree clean clean
Subdirectory of a repo ?? sub/.kilo/worktrees/.metadata_never_index clean (!! sub/.kilo/...)
Non-git folder .kilo/ created .kilo/ not created

Automated checks:

  • bun test tests/unit/worktree-manager.test.ts (134 tests, 2 new)
  • bun test tests/unit/agent-manager-arch.test.ts
  • bun run lint
  • bun run typecheck

Comment thread packages/kilo-vscode/src/agent-manager/WorktreeManager.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/kilo-vscode/src/agent-manager/WorktreeManager.ts
Previous Review Summary (commit d162846)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit d162846)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/agent-manager/WorktreeManager.ts 1101 git rev-parse echoes unrecognized options with exit code 0, so --path-format=absolute yields a contaminated/relative path on Git < 2.31; the exclude write then targets a bogus location and the original .kilo leak silently persists.
Files Reviewed (3 files)
  • .changeset/disable-kilo-folder-creation.md - no issues
  • packages/kilo-vscode/src/agent-manager/WorktreeManager.ts - 1 issue
  • packages/kilo-vscode/tests/unit/worktree-manager.test.ts - no issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

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