fix(web): allow removing projects that still contain threads#1922
fix(web): allow removing projects that still contain threads#1922rohankumawat wants to merge 1 commit intopingdotgg:mainfrom
Conversation
Previously, attempting to remove a project with existing threads showed
a blocking warning toast ("Project is not empty") and refused to proceed,
forcing users to manually delete every thread first.
Now the confirmation dialog deletes all threads in the project
automatically before removing it. The dialog also clarifies that
files on disk are not affected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 88532c1. Configure here.
| // Delete all threads in the project first | ||
| for (const thread of projectThreads) { | ||
| await deleteThread(scopeThreadRef(thread.environmentId, thread.id)); | ||
| } |
There was a problem hiding this comment.
Cascading delete triggers per-thread worktree confirmation dialogs
High Severity
The loop calls deleteThread for each thread, but deleteThread internally shows a native confirmation dialog for every thread that has an orphaned worktree (asking "Delete the worktree too?"). After the user already confirmed the project removal, they can be bombarded with additional unexpected dialogs — one per qualifying thread. This also contradicts the parent confirmation message claiming "Your files on disk will not be affected," since deleteThread can actually remove worktrees from disk if the user clicks through those prompts.
Reviewed by Cursor Bugbot for commit 88532c1. Configure here.
| // Delete all threads in the project first | ||
| for (const thread of projectThreads) { | ||
| await deleteThread(scopeThreadRef(thread.environmentId, thread.id)); | ||
| } |
There was a problem hiding this comment.
Thread deletion before project validation risks data loss
High Severity
All threads are irreversibly deleted before validating that the project API is available and before attempting the project deletion command. If readEnvironmentApi returns null or dispatchCommand throws, the catch block shows a "Failed to remove project" toast — but the threads are already gone. This is a non-atomic cascading delete that can silently cause data loss while leaving the project intact.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 88532c1. Configure here.
ApprovabilityVerdict: Needs human review This PR changes project deletion from blocking (when threads exist) to cascading deletion of all threads. Two high-severity unresolved review comments identify potential data loss scenarios and UX issues with the non-atomic delete implementation. The behavioral change and substantive concerns warrant human review. You can customize Macroscope's approvability policy. Learn more. |


Summary
What changed
deleteThreadandprojectThreadsto theuseCallbackdependency array.Before
After
Screen.Recording.2026-04-11.at.06.47.27.mov
Test plan
Note
Medium Risk
Changes deletion behavior to automatically delete all threads before removing a project, which could cause unintended data loss or partial-failure states if thread deletions fail mid-sequence.
Overview
Removing a project from the sidebar no longer blocks when the project contains threads; it now confirms and then deletes all threads in the project before dispatching the
project.deletecommand.The confirmation dialog message is expanded to include the number of threads that will be deleted (when non-zero) and to clarify that files on disk are unaffected, and the callback dependencies are updated to track
deleteThreadandprojectThreads.Reviewed by Cursor Bugbot for commit 88532c1. Bugbot is set up for automated code reviews on this repo. Configure here.