Skip to content

fix(sidebar): pin hostId when removing multi-host projects - #13536

Closed
bbingz wants to merge 3 commits into
stablyai:mainfrom
bbingz:fix/13071-remove-project-host-id
Closed

bbingz wants to merge 3 commits into
stablyai:mainfrom
bbingz:fix/13071-remove-project-host-id

Conversation

@bbingz

@bbingz bbingz commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removing a project from the sidebar only passed repoId, so when the same id existed on two hosts (or a twin vanished from the catalog) findRepoForHost could pick the wrong row.
  • Thread hostId through confirm-remove-folder (WorktreeList + main-worktree delete path), resolve dialog labels/repos by host, and make removeProject refuse unique-id-any-host fallback when hostId is omitted (focused-host match only).

Test plan

  • delete-worktree-flow + repos-cross-host-project-collisions + repos-host-identity-routing (36 passed)
  • Manual: two hosts share a project id; remove one from sidebar; other host row remains

Fixes #13071

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bbingz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e33bf91b-19fc-4d42-b51b-41fe30043465

📥 Commits

Reviewing files that changed from the base of the PR and between 4c69e45 and 9d8c55a.

📒 Files selected for processing (9)
  • src/renderer/src/components/sidebar/RemoveFolderDialog.tsx
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/delete-worktree-flow.test.ts
  • src/renderer/src/components/sidebar/delete-worktree-flow.ts
  • src/renderer/src/components/sidebar/worktree-delete-main-project-remove.ts
  • src/renderer/src/components/sidebar/worktree-delete-repo-resolve.ts
  • src/renderer/src/store/slices/repos-cross-host-project-collisions.test.ts
  • src/renderer/src/store/slices/repos.ts
  • src/renderer/src/store/slices/worktrees.ts
📝 Walkthrough

Walkthrough

Worktree deletion now resolves repositories with optional execution host IDs. Removal dialogs receive and use host-scoped repository information. Project removal supports explicit host selection and unique cross-host matches. Ambiguous or missing matches do not trigger removal. Contained projects and orphaned runtime-SSH repositories pass host-specific removal data. Tests cover modal payloads and cross-host repositories with duplicate IDs.

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug and tests, but it omits the required Screenshots, Testing, AI Review Report, Security Audit, and Notes sections. Add the required sections, report all required checks, state whether there is visual change, and include the mandated cross-platform AI review and security audit.
Linked Issues check ⚠️ Warning The sidebar paths pass hostId and tests cover collisions, but removeProject still allows unambiguous cross-host ID fallback when hostId is omitted. Make hostId mandatory for removal resolution, or reject omitted hostId before any cross-host fallback can select another host.
Out of Scope Changes check ⚠️ Warning The host-qualified orphan cleanup change in worktrees.ts is outside the directly linked sidebar removal issue, which explicitly scopes orphaned-workspace work separately. Remove the orphan cleanup changes from this PR or link a separate issue that explicitly requires host-qualified orphan repository cleanup.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that sidebar project removal now pins hostId, matching the primary multi-host removal fix.

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dee5a2e-6ded-4890-847a-bcd05ffd164f

📥 Commits

Reviewing files that changed from the base of the PR and between 66aed16 and 369d798a61870ad60ee05faa6c2f3961292de54d.

📒 Files selected for processing (7)
  • src/renderer/src/components/sidebar/RemoveFolderDialog.tsx
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/delete-worktree-flow.test.ts
  • src/renderer/src/components/sidebar/delete-worktree-flow.ts
  • src/renderer/src/components/sidebar/worktree-delete-repo-resolve.ts
  • src/renderer/src/store/slices/repos-cross-host-project-collisions.test.ts
  • src/renderer/src/store/slices/repos.ts

Comment thread src/renderer/src/components/sidebar/delete-worktree-flow.ts Outdated

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e45144b-ca16-4cf7-bf57-5c0fc56b6a3c

📥 Commits

Reviewing files that changed from the base of the PR and between 369d798a61870ad60ee05faa6c2f3961292de54d and bd9990ab652c56cf74e31d29d2cccac72a02f579.

📒 Files selected for processing (6)
  • src/renderer/src/components/sidebar/RemoveFolderDialog.tsx
  • src/renderer/src/components/sidebar/delete-worktree-flow.ts
  • src/renderer/src/components/sidebar/worktree-delete-main-project-remove.ts
  • src/renderer/src/store/slices/repos-cross-host-project-collisions.test.ts
  • src/renderer/src/store/slices/repos.ts
  • src/renderer/src/store/slices/worktrees.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/sidebar/RemoveFolderDialog.tsx
  • src/renderer/src/store/slices/repos.ts

Comment thread src/renderer/src/store/slices/worktrees.ts
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bbingz

bbingz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review (contributor priority pack)

  • Rebased / checked against current main where needed
  • Scoped bugfix; summary + test plan in the description
  • Community PR: please Approve and run workflows when convenient (fork CI stays off)
  • No maintainer merge expected from us — happy to iterate on review comments

Part of a short priority list for maintainers: P0 #13609 #13566 · hot #13710 #13692 #13691 #13536 #13572 #8072 #13237 · easy #13570 #13561 #13255.

bbingz added 3 commits August 12, 2026 03:26
Sidebar confirm-remove dropped host identity, so findRepoForHost fell back
to a unique survivor id and could destroy the wrong host's project. Pass
hostId from the opener, resolve labels/repos by host, and refuse bare-id
unique-id fallbacks on remove.

Fixes stablyai#13071.
Bare removeProject now uses findRepoForHost (unique any-host + focused
disambiguation) so unique SSH rows work under local/runtime focus.
Group delete and orphan purge pass hostId; main-worktree confirm refuses
when the host cannot be resolved.

Addresses review on stablyai#13536
Same repo id on two destroyed hosts must not let a purge of one suppress
cleanup of the other. Track purged keys as hostId+repoId.

Addresses review on stablyai#13536
@bbingz
bbingz force-pushed the fix/13071-remove-project-host-id branch from dea83c9 to 9d8c55a Compare August 11, 2026 19:26
@bbingz

bbingz commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing because #14359 has landed the original #13071 sidebar/modal host-routing fix. A current-main audit found that the remaining orphan-purge portion overlaps #13117, while this branch’s group-removal approach would remove every host copy sharing a repo id, including copies outside the deleted group. Recasting this PR would therefore be a different fix and would overlap #13117/#13229. The remaining orphan/group paths need host-qualified (hostId, repoId) targets in a separate narrow change.

@bbingz bbingz closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

removeProject without a hostId can delete the wrong host's project when repo IDs are duplicated across hosts

3 participants