Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): improve batch thread deletion UX, ask for worktrees deletion confirmation once instead of going one by one #6594

Closedartieeg(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/6594/headopened View on GitHub

Fixes #7067

Selecting several threads in the sidebar and choosing Delete asks about each orphaned worktree in its own dialog, and the thread deletion for the previous row runs before the next one appears. Clearing ten threads means confirming the same question ten times, with a couple of seconds of dead air between each.

The batch now counts the worktrees the whole selection would orphan, asks once, and passes that single answer down to every deleteThread call. A worktree only counts when every thread pointing at it is inside the selection, which matches what the per-thread check would have concluded as the deletions ran. Deleting a single thread is untouched and still gets the per-thread prompt.

Before

Seven threads selected, each with its own worktree:

Multi-select context menu

Delete 7 threads confirmation

Then the same question, once per thread, with a deletion round trip in between:

Worktree prompt for wt-6

Worktree prompt for wt-5

Worktree prompt for wt-4

After

One dialog for the whole batch:

Bulk worktree prompt

All seven threads deleted

The orphan calculation is a pure function with unit tests covering shared worktrees, worktrees a surviving thread still holds, and threads with no worktree at all.


Written by Claude Opus 5 on Claude Code.


Note

Medium Risk Changes destructive delete/worktree cleanup behavior for multi-select; logic is tested but incorrect orphan detection could delete worktrees still in use or skip cleanup unintentionally.

Overview Batch thread deletion in the sidebar no longer prompts once per thread for orphaned worktrees. After the usual delete confirmation, the UI computes which worktrees would be left with no remaining threads (only when every thread pointing at a path is in the selection), shows one “Delete the worktrees too?” dialog, and passes that answer into each deleteThread call via a new worktreeBatch option.

deleteThread still prompts per thread when worktreeBatch is omitted (single delete) or when a worktree becomes orphaned mid-batch and was not part of the upfront count. Orphan logic is centralized in getOrphanedWorktreePathsForThreads and environment-scoped keys via scopedWorktreePathKey, with unit tests added.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7aa9133b977b99a09ff7ddf7da60581f5fda2be7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Ask once for worktree deletion confirmation when batch-deleting threads in the sidebar

  • When deleting multiple threads, the sidebar now shows a single worktree deletion confirmation dialog for all affected orphaned worktrees, instead of prompting once per thread.
  • Two new utilities in worktreeCleanup.ts compute which worktree paths would be orphaned by a batch deletion (getOrphanedWorktreePathsForThreads) and generate environment-scoped keys to correlate batch decisions (scopedWorktreePathKey).
  • deleteThread in useThreadActions.ts accepts an optional worktreeBatch parameter; if the thread's worktree path is covered by the batch decision, the per-thread dialog is skipped. Single deletions and uncovered paths continue to prompt as before.
Macroscope summarized 7aa9133.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 9140dbbb-49d1-4b02-b906-0c19b9cc13cf

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. artieeg(GitHub profile, opens in a new tab) changed the title

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved cdbfa95

      This UX improvement consolidates multiple worktree deletion confirmation dialogs into a single prompt. The changes are self-contained, well-tested, and don't alter what gets deleted—only when the user is prompted. No security or sensitive code is affected.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. artieeg(GitHub profile, opens in a new tab) changed the title

    6. artieeg(GitHub profile, opens in a new tab) changed the title

    7. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 751acd8d5b213454648fd31bbb13dd0ad7aec9f6. Configure [here](https://www.cursor.com/dashboard/bugbot).
    8. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      This adds a separate orphan-worktree calculation and passes its result through the thread deletion path. Batch deletion already works through the existing per-thread confirmation, so we do not want to carry the extra deletion state.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.