Unclear It is not shown how the wording of the resume hint changes when the worktree was removed.
What
A worktree is a separate working copy of your git repository that a Claude Code session can work in. When you leave a worktree session you can remove it, and a clean worktree can be removed automatically. That removal now runs during Claude Code's shutdown instead of inside the exit dialog.
- Choosing 'Remove worktree', or the automatic removal of a clean worktree, no longer holds up the dialog for worktrees not created by a hook. The removal is handed off as a
removeWorktreestep that runs after the session ends. Before, the dialog waited for the removal and then showed the result. - Worktrees created by a hook are still removed right away, inside the dialog.
- During shutdown,
removeWorktreeAtExitprints "Removing worktree…" and runs with a time budget of at least 5 seconds. - Pressing Ctrl+C or receiving a stop or hang-up signal (SIGINT, SIGTERM, SIGHUP) interrupts the removal, and a message warns that the folder may be partly deleted.
- When a tmux session is being closed and
TMUXandCLAUDE_CODE_TMUX_SESSIONmatch, the removal ignores the hang-up signal. - If the session had switched away from that worktree, removal is refused with "Worktree not removed: this session had switched away from it before Claude Code exited".
- If a shutdown is already under way and a second request asks to remove a different worktree, a warning is logged that the worktree was kept. Before, this was silently dropped.
- The hint for resuming the session can now leave out the worktree once it has been removed (
resumeHintOmitsWorktree).
Why
Exiting is quicker, but the result of the removal now appears after the dialog closes. If a worktree is left behind, the new messages say why, and an interrupted removal can leave a partly deleted folder to clean up.
It is not shown how the wording of the resume hint changes when the worktree was removed.