Summary
Auto Review can fail during worktree_prepare when it tries to reset or reuse a stale/corrupted reusable review worktree. The observed failure was:
Failed to reset reusable worktree: fatal: not a git repository: (null)
The primary repository was valid, so the user-facing hint to verify the current workspace was misleading. The failure appears to come from the reusable auto-review worktree state, not from the source checkout.
Expected behavior
When preparing an auto-review worktree:
- validate that the candidate reusable worktree path is a usable Git worktree before attempting reset
- if validation or reset fails because the reusable checkout is invalid, quarantine/remove that reusable checkout and create a fresh worktree
- run a safe
git worktree prune or equivalent cleanup for stale registry entries where appropriate
- surface an error that distinguishes source-repo failures from reusable-worktree failures
- add regression coverage for broken
.git pointers, missing worktree directories, and reset failure recovery
Notes
This was discovered while diagnosing an Auto Review failure. A separate Every Code runtime panic caused by UTF-8-unsafe exec stream truncation was fixed independently in PR #272.
Summary
Auto Review can fail during
worktree_preparewhen it tries to reset or reuse a stale/corrupted reusable review worktree. The observed failure was:The primary repository was valid, so the user-facing hint to verify the current workspace was misleading. The failure appears to come from the reusable auto-review worktree state, not from the source checkout.
Expected behavior
When preparing an auto-review worktree:
git worktree pruneor equivalent cleanup for stale registry entries where appropriate.gitpointers, missing worktree directories, and reset failure recoveryNotes
This was discovered while diagnosing an Auto Review failure. A separate Every Code runtime panic caused by UTF-8-unsafe exec stream truncation was fixed independently in PR #272.