Skip to content

Fix archived-only project deletion#1903

Open
SAKETH11111 wants to merge 2 commits intopingdotgg:mainfrom
SAKETH11111:fix-archived-project-delete
Open

Fix archived-only project deletion#1903
SAKETH11111 wants to merge 2 commits intopingdotgg:mainfrom
SAKETH11111:fix-archived-project-delete

Conversation

@SAKETH11111
Copy link
Copy Markdown

@SAKETH11111 SAKETH11111 commented Apr 10, 2026

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

  • reuse shared sidebar thread filtering before the delete check
  • keep the delete guard aligned with the visible thread list
  • add regression coverage for archived-only project deletion

Validation

  • reproduced the bug locally before the fix
  • verified archived-only projects can now be removed in the running app
  • ran bun fmt
  • ran bun lint
  • ran bun typecheck
  • ran bun run --cwd apps/web test -- src/components/Sidebar.logic.test.ts
  • ran bun run --cwd apps/server test -- src/provider/Layers/ClaudeAdapter.test.ts
  • ran git diff --check

Note

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_use content blocks like tool_use via a new getClaudeToolStartBlock validator, 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

  • SidebarProjectItem now checks visibleProjectThreads.length (non-archived threads) instead of projectThreads.length when deciding whether to block project deletion, so projects with only archived threads can be deleted.
  • Adds getSidebarThreadsByIds utility in Sidebar.logic.ts that maps thread IDs to threads, drops missing entries, and filters out archived threads by default (with an includeArchived option).
  • Fixes Claude adapter's content_block_start handler to recognize server_tool_use and mcp_tool_use block types via the new getClaudeToolStartBlock helper, so those tool blocks are tracked as runtime items.

Macroscope summarized a70e8f3.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 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: e7018193-2f2d-407d-847a-e3ac44eb0207

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:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 10, 2026
@SAKETH11111
Copy link
Copy Markdown
Author

Before removal:
t3code-issue1880-before-remove

After removal:
t3code-issue1880-after-remove

macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

Verdict: 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 getSidebarThreadsByIds utility function is dead code - it was intended to be used but never wired into production code, suggesting incomplete implementation.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp bot dismissed their stale review April 10, 2026 23:10

Dismissing prior approval to re-evaluate a70e8f3

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

Reviewed by Cursor Bugbot for commit a70e8f3. Configure here.

}

return threads.filter((thread) => thread.archivedAt === null);
}
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.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a70e8f3. Configure here.

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

Labels

size:M 30-99 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.

Cannot delete project with only archived threads

1 participant