anthropics / anthropics/claude-code
Desktop app: idle worktree reaper silently deletes a session's working folder; session then shows 'Working folder no longer exists' with no explanation
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
## Environment
- Claude desktop app 2.110.0 (macOS 26.6.2), Claude Code 2.1.272
- Code tab sessions using app-managed worktrees under `/.claude/worktrees/`
## What happened
Reopened a Code session that had been idle since 2026-08-24. The session pane shows only:
> Working folder no longer exists. Choose a different folder to continue. [Choose folder] [Archive]
The app's own log (`~/Library/Logs/Claude/main2.log`) shows the app deleted the folder itself, five days after the session's last activity, with no notice in the UI:
```
2026-08-29 14:29:34 [info] [WorktreePool] Reaping idle worktree hoodie-dataset-domo-access-126272 in
2026-08-29 14:29:34 [info] Removing worktree "hoodie-dataset-domo-access-126272" (leased by local_282caa08-…): /.claude/worktrees/hoodie-dataset-domo-access-126272
2026-08-29 15:02:15 [info] Removed worktree "hoodie-dataset-domo-access-126272"
```
The reaper has fired 58 times on this machine and runs roughly daily. The branch, commits and open PR were all intact (the tip matched the PR head), so no work was lost — but the user's first read of the prompt was that their folder had been deleted out from under them, and nothing in the UI says otherwise.
## Why it is a problem
1. **No attribution.** "Working folder no longer exists" reads as an external failure (moved, unmounted, user deleted). The app knows it deleted the folder; it should say so.
2. **No one-click recovery.** The session still knows its repo and branch (`fix/demote-insights-to-market-context`), yet the only offered action is a generic macOS folder picker with the user's home directory selected. Picking anything other than the repo root is an easy mistake. A "Re-create worktree from branch" button would resolve it without a dialog.
3. **Cadence is invisible and unconfigurable.** Settings › Desktop app › Storage exposes a manual "Clean up inactive sessions" at 30/60/90 days, but the automatic pool reaper fired after 5 days. There is no visible setting for it and no indication in the session list that a session's folder has been reaped.
## Suggested fix
- When the reaper removes a session's worktree, record that on the session and render a specific message: "Claude removed this session's worktree on to free disk space. Your branch `` is intact." with a primary action **Re-create worktree** that checks the branch out again.
- Show the reaper's idle threshold in Storage settings and let the user raise it or disable it for a repo.
- Optionally mark reaped sessions in the sidebar so the state is discoverable before the user clicks in.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the WorktreePool reaping entries in ~/Library/Logs/Claude/main2.log and the session pane state showing “Working folder no longer exists.” Trace how Storage settings, the session's repository and branch, and the sidebar represent an automatically reaped worktree. Done means the UI attributes the deletion, offers worktree recreation from the intact branch, and exposes the reaper threshold or disable option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100