Fix archived-only project deletion#1903
Conversation
|
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 |
ApprovabilityVerdict: Needs human review The PR mixes a bug fix (allowing deletion of projects with only archived threads) with an unrelated ClaudeAdapter refactor. An open review comment identifies that the new You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate a70e8f3
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a70e8f3. Configure here.
| } | ||
|
|
||
| return threads.filter((thread) => thread.archivedAt === null); | ||
| } |
There was a problem hiding this comment.
New exported function is unused in production code
Low Severity
getSidebarThreadsByIds is exported and tested but never imported or called in any production code. The PR description states "reuse shared sidebar thread filtering before the delete check," but Sidebar.tsx still uses inline projectThreads.filter((thread) => thread.archivedAt === null) at the existing call site. The function appears to have been intended as the shared utility but was never actually wired in.
Reviewed by Cursor Bugbot for commit a70e8f3. Configure here.




Closes #1880
What was broken
Projects with only archived threads could not be deleted, even though the sidebar showed them as empty.
Root cause
The delete guard checked all project thread IDs, while the sidebar filtered archived threads out of the visible project state.
What changed
Validation
bun fmtbun lintbun typecheckbun run --cwd apps/web test -- src/components/Sidebar.logic.test.tsbun run --cwd apps/server test -- src/provider/Layers/ClaudeAdapter.test.tsgit diff --checkNote
Medium Risk
Medium risk because it changes sidebar deletion guard behavior and adjusts Claude runtime event parsing for additional tool block types, which could affect UI state and provider event streams.
Overview
Fixes project deletion gating to match what the sidebar considers “non-empty” by basing the remove-project check on visible (non-archived) threads, allowing projects with only archived threads to be deleted.
On the server, expands Claude streaming handling to treat
server_tool_use/mcp_tool_usecontent blocks liketool_usevia a newgetClaudeToolStartBlockvalidator, and adds regression tests for server tool blocks plus the new sidebar thread-by-id filtering helper.Reviewed by Cursor Bugbot for commit a70e8f3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix project deletion to allow deleting projects that contain only archived threads
SidebarProjectItemnow checksvisibleProjectThreads.length(non-archived threads) instead ofprojectThreads.lengthwhen deciding whether to block project deletion, so projects with only archived threads can be deleted.getSidebarThreadsByIdsutility in Sidebar.logic.ts that maps thread IDs to threads, drops missing entries, and filters out archived threads by default (with anincludeArchivedoption).content_block_starthandler to recognizeserver_tool_useandmcp_tool_useblock types via the newgetClaudeToolStartBlockhelper, so those tool blocks are tracked as runtime items.Macroscope summarized a70e8f3.