fix(dev): name AFK worktrees without a tilde so edits auto-approve #72
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/lab-afk-worktree-path-8.3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Starting an AFK run stalls: the agent freezes on a
Do you want to make this edit to <file>?permission prompt and, with no one at the keyboard, never proceeds. Diagnosed against a live run (#63) frozen on exactly that prompt fortracker.go.Root cause
This is not the MCP/folder-trust prompt the earlier #69–#71 fixes addressed. Auto mode already auto-approves workspace edits — the problem is the worktree path itself.
worktreePathjoined the project name and issue number withinstanceSep(~), so an AFK run's working directory was e.g.…/cloonar-cloonar-nixos~63. The~63component matches the Windows 8.3 short-name pattern (PROGRA~1), which claude treats as a path-confusion risk and forces manual approval for every file edit, in any--permission-mode(auto included).Reproduced cleanly with
claude --permission-mode auto:tilde~1-named dir → refused with "…the working directory path containstilde~1, which matches a suspicious Windows short-name (8.3) pattern and requires manual approval. I can't override that."Fix
Give the worktree path its own filesystem-safe separator (
-) instead of reusing the tmux-orientedinstanceSep. Session names keep~— it's the one separator tmux's target-pane parser doesn't reserve, and a session name is never a filesystem path. The new directory name also matches what git already derives for the worktree's admin dir under.git/worktrees/.worktreePath("cloonar-cloonar-nixos", 63)→…/cloonar-cloonar-nixos-63Tests
TestWorktreePath_no83ShortNameguards the worktree name against any~(regression guard; would fail against the old~-joined path).go test ./...,go vet ./...,go build ./...pass locally — the pre-commit hook is eval-only and never compiles the Go, so these were run by hand.worktreePath joined project and issue with instanceSep ("~"), so an AFK run's working directory was e.g. ".../cloonar-cloonar-nixos~63". The "~63" component matches the Windows 8.3 short-name pattern (PROGRA~1), which claude treats as a path-confusion risk and forces manual approval for every file edit — silently stalling an unattended AFK run on its first edit, in any --permission-mode (auto included). Reproduced with a tilde-named cwd, which claude blocks citing exactly that 8.3 reason. Give the worktree path its own filesystem-safe separator ("-") instead of reusing the tmux-oriented instanceSep; session names keep "~" (the one separator tmux's target-pane parser doesn't reserve, and a session name is never a filesystem path). The new name also matches what git already derives for the worktree's admin dir under .git/worktrees/.