Skip to content

/exit in a --worktree session backgrounds it instead of quitting, skipping worktree cleanup, and the background sessions view offers no way out #82192

Description

Environment: Claude Code v2.1.220, macOS, terminal (session started with claude --worktree dashboard-navigation)

Steps: Start a session with claude --worktree <name>, finish the work, type /exit.

What happens:

  1. Instead of quitting, the conversation moves to the background and the background sessions view appears ("Your conversation moved to the background"). From there, esc returns to the backgrounded session and esc returns to the view again, so the two screens ping-pong with no visible way out. The only real exit, ctrl+c twice, appears once in a dense header line, and typing in the input box spawns a new background session instead of leaving.
  2. The documented worktree cleanup never runs. The worktrees docs say cleanup happens "when you exit an interactive worktree session" (auto-removal when clean, keep-or-remove prompt otherwise), and /exit is the explicit exit command, yet this clean worktree (no changes, no commits of its own) survived along with its worktree-<name> branch and had to be removed manually with git worktree remove --force and git branch -d. Nothing in the background sessions view says whether quitting from it will offer cleanup either.

Suggestions: /exit in a worktree session should quit and run the worktree cleanup flow, or at minimum say that it backgrounded the session instead; give the background sessions view a visible quit affordance; surface the worktree cleanup state or action on completed worktree sessions; document what quitting from the view does to worktree cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions