Skip to content

fix(vscode): remove missing stale worktree entries - #13874

Merged
marius-kilocode merged 2 commits into
mainfrom
intriguing-mail
Sep 7, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
intriguing-mail

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes #13826. Agent Manager could leave a stale worktree card permanently when the worktree directory had already been removed and terminal cleanup could not reach the backend.

Why This Change Was Made

Stale removal now checks whether the worktree path is missing after terminal cleanup fails. A confirmed missing path allows state cleanup to continue. Existing paths still fail closed and preserve the entry when terminal cleanup fails. Filesystem and branch deletion remain outside this action.

User Impact

Users can remove stale Agent Manager entries after external worktree deletion without editing .kilo/agent-manager.json.

Evidence

  • bun run compile passed in packages/kilo-vscode/.
  • 93 focused lifecycle and architecture tests passed.
  • Isolated VS Code self-test created a disposable worktree, removed it externally, removed the stale entry in the UI, and verified it remained absent after reload.

Stale Agent Manager worktree with removal action

Agent Manager after stale worktree removal

@kilo-code-bot

kilo-code-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/fix-stale-worktree-removal.md
  • packages/kilo-vscode/src/agent-manager/provider-lifecycle.ts
  • packages/kilo-vscode/tests/unit/agent-manager-provider-lifecycle.test.ts

Reviewed by grok-4.6 · Input: 170.7K · Output: 9.6K · Cached: 349.1K

Review guidance: REVIEW.md from base branch main

# Conflicts:
#	packages/kilo-vscode/tests/unit/agent-manager-provider-lifecycle.test.ts
@marius-kilocode
marius-kilocode merged commit 1f18922 into main Sep 7, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the intriguing-mail branch September 7, 2026 13:41
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.

[Bug][Agent Manager] Agent-deleted worktrees marked stale cannot be removed via "Remove Stale Worktree"

2 participants