Skip to content

fix(web): allow removing projects that still contain threads#1922

Open
rohankumawat wants to merge 1 commit intopingdotgg:mainfrom
rohankumawat:fix/allow-remove-project-with-threads
Open

fix(web): allow removing projects that still contain threads#1922
rohankumawat wants to merge 1 commit intopingdotgg:mainfrom
rohankumawat:fix/allow-remove-project-with-threads

Conversation

@rohankumawat
Copy link
Copy Markdown

@rohankumawat rohankumawat commented Apr 11, 2026

Summary

  • Removing 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.
  • The confirmation dialog now automatically deletes all threads before removing the project.
  • The dialog also clarifies that files on disk are not affected.

What changed

  • Replaced the blocking toast with a cascading delete: all threads are deleted before the project is removed.
  • Updated the native confirmation dialog message to include thread count (when applicable) and a reassurance that local files remain untouched.
  • Added deleteThread and projectThreads to the useCallback dependency array.

Before

Screenshot 2026-04-11 at 06 46 27

After

Screen.Recording.2026-04-11.at.06.47.27.mov

Test plan

  • Right-click a project with threads → "Remove project" → confirm → project and threads removed
  • Right-click an empty project → "Remove project" → confirm → project removed
  • Cancel the confirmation → nothing happens
  • Files on disk remain untouched after removal

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.delete command.

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 deleteThread and projectThreads.

Reviewed by Cursor Bugbot for commit 88532c1. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

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

Run ID: 701f2707-6ffd-48a2-8f87-d150126c1044

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 11, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 88532c1. Configure here.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 11, 2026

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant