Session metadata keeps a stale worktreePath/worktreeName after the worktree directory is removed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with the get_session and list_sessions entry points, then trace how EnterWorktree and clean_up_worktrees update session metadata. Reproduce the issue by removing a worktree and querying the session afterward. Done means sessions no longer report worktreePath or worktreeName when the directory has been removed, while existing worktree metadata remains available when valid.
Written by the indexing model from the issue text.
Description
Description
get_session (and the list_sessions entries) continue reporting a worktreePath/worktreeName for a session even after that worktree directory has been removed from disk (e.g. after the branch's PR merges and the worktree is cleaned up, either manually with git worktree remove or via the app's own cleanup). This was observed across multiple completed sessions in the same project:
- A session with a merged PR still reports
worktreePath: /path/.claude/worktrees/intelligent-wright-1c891a— directory confirmed absent on disk, branch confirmed deleted both locally and onorigin. - Same pattern for another session with a different merged PR.
- A third session (no PR, never touched the codebase — used only for scheduling a reminder via the
/scheduleskill) also still reports aworktreePathfor a directory that no longer exists.
By contrast, at least one other session in the same project (also a merged PR) correctly has no worktreePath field at all — so the metadata can get cleared, just not consistently.
Impact
Low severity — no data loss observed, since in every case the underlying git work was already safely merged (or, for the scheduling-only session, never existed). But it's misleading: reading session metadata suggests a worktree is still there to resume into, when in fact resuming would presumably need to recreate it from scratch (or silently fail if the branch is also gone).
Repro sketch
- Start a session with
EnterWorktree(or the app's normal per-task worktree flow). - Merge its PR and remove the worktree (
git worktree remove, or via the app'sclean_up_worktrees/ manual removal). - Call
get_sessionon that session later —worktreePathis still present and points at a now-nonexistent directory.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anthropics/claude-code
-
area:desktop bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anthropics/claude-code#95572 ·
-
area:agents area:docs bug
Difficulty 1/5 Under an hour Newbie friendliness 95/100
anthropics/claude-code#95540 · 2 comments ·
-
area:docs bug has repro platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#95526 ·
-
area:claude-code-web area:hooks bug has repro
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
anthropics/claude-code#95524 · 1 comment ·
-
area:mcp enhancement external
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#95435 ·
All issues in anthropics/claude-code
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·