Skip to content

fix(agent-manager): log errors and trigger git refresh in worktree migration#8139

Merged
marius-kilocode merged 2 commits intomainfrom
casual-narwhal
Apr 2, 2026
Merged

fix(agent-manager): log errors and trigger git refresh in worktree migration#8139
marius-kilocode merged 2 commits intomainfrom
casual-narwhal

Conversation

@marius-kilocode
Copy link
Copy Markdown
Collaborator

Summary

  • fixGitWorktreeRefs silently swallowed errors during the .kilocode → .kilo migration (catch {} blocks). If the gitdir rewrite failed (permissions, file locks, race with VS Code's git extension), worktrees moved on disk but git internal refs still pointed to .kilocode/ paths — causing git worktree list to return stale paths and VS Code to stop showing worktrees in Source Control.
  • All catch blocks in fixGitWorktreeRefs now log errors instead of silently skipping
  • After writing a gitdir file, the fix reads it back to verify the write persisted (catches read-only mounts, silent FS failures)
  • Migration now returns a count of fixed refs so callers can react
  • When refs were rewritten, triggers git.refresh so VS Code re-discovers worktrees without requiring a manual restart

Context

User report: worktrees that used to appear in VS Code Source Control disappeared after updating. Root cause traced to commit 466644eb25 (.kilocode → .kilo rename) where the migration's error handling silently swallowed failures, leaving git worktree references permanently broken.

Test plan

  • bun run compile passes (typecheck + lint + build)
  • All 46 agent-manager unit tests pass
  • No new test failures introduced

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 2, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (12 files)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/WorktreeStateManager.ts
  • packages/kilo-vscode/src/agent-manager/constants.ts
  • packages/kilo-vscode/src/agent-manager/host.ts
  • packages/kilo-vscode/src/agent-manager/vscode-host.ts
  • packages/kilo-vscode/tests/unit/agent-manager-i18n-split.test.ts
  • packages/kilo-vscode/tests/unit/i18n-keys.test.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/tr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/uk.ts
  • packages/opencode/src/server/server.ts

Reviewed by gpt-5.4-20260305 · 706,732 tokens

…gration

fixGitWorktreeRefs silently swallowed errors when rewriting
.git/worktrees/*/gitdir during the .kilocode → .kilo migration.
If the rewrite failed (permissions, file locks, race with VS Code),
worktrees moved on disk but git refs still pointed to the old path,
causing VS Code to stop showing them in Source Control.

- Log all errors instead of empty catch blocks
- Verify gitdir writes by reading back after write
- Return count of fixed refs from migration
- Trigger git.refresh when refs were rewritten so VS Code
  re-discovers worktrees without requiring a restart
@marius-kilocode marius-kilocode merged commit 25092dd into main Apr 2, 2026
13 checks passed
@marius-kilocode marius-kilocode deleted the casual-narwhal branch April 2, 2026 10:25
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