Repository navigation
Fix deleted remote worktree reappearing due to host ID mismatch - #16039
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 6bbbf38e16d2c6fe241ee3f69d8a74904c28967e and 0acf4a3. 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds repository-aware paired caller host-ID resolution. Runtime worktree removal and preserved-branch deletion now use the resolved host ID. Force-delete requests validate and normalize Merge Risk: 🟡 Moderate · up to The change updates worktree removal and branch cleanup host-ID resolution, but both renderer cleanup paths still access a runtime-only host identifier without narrowing, and the supplied typecheck reports build failures. The PR is not merge-ready until the typing issue and failed checks are fixed. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e93a18f2-d4bb-42ca-a9a1-0bab8c31f1ee
📒 Files selected for processing (8)
src/main/runtime/rpc/methods/paired-caller-host-id.test.tssrc/main/runtime/rpc/methods/paired-caller-host-id.tssrc/main/runtime/rpc/methods/worktree-rm-host-qualification.test.tssrc/main/runtime/rpc/methods/worktree-schemas.tssrc/main/runtime/rpc/methods/worktree.tssrc/renderer/src/store/slices/worktrees-remote-runtime-removal.test.tssrc/renderer/src/store/slices/worktrees/teardown/dispatch-worktree-removal.tssrc/renderer/src/store/slices/worktrees/teardown/force-delete-preserved-branch.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
fe4bc58 to
6bbbf38
Compare
|
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. |
Paired clients and servers may use different spellings for execution hosts (e.g., client 'runtime:env-1' vs server 'local'). Resolve these spellings before worktree.rm and worktree.forceDeleteBranch to prevent failures and orphaned worktrees.
Ensure parsed host IDs are actually runtime environments before accessing their environmentId property. Fixes incorrect host ID matching during worktree cleanup that caused deleted remote worktrees to reappear.
When a surviving host has the same ID as the deleted worktree's original host, use the hostId directly instead of qualifying it through the runtime call host. This prevents worktrees from reappearing due to host ID mismatch.
6bbbf38 to
0acf4a3
Compare
…lyai#16039) * Fix deleted remote worktree reappearing due to host ID mismatch Paired clients and servers may use different spellings for execution hosts (e.g., client 'runtime:env-1' vs server 'local'). Resolve these spellings before worktree.rm and worktree.forceDeleteBranch to prevent failures and orphaned worktrees. * Validate runtime kind before comparing environment IDs Ensure parsed host IDs are actually runtime environments before accessing their environmentId property. Fixes incorrect host ID matching during worktree cleanup that caused deleted remote worktrees to reappear. * Use hostId directly when same-ID surviving host exists When a surviving host has the same ID as the deleted worktree's original host, use the hostId directly instead of qualifying it through the runtime call host. This prevents worktrees from reappearing due to host ID mismatch. --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain> (cherry picked from commit 1a7934c)
…lyai#16039) * Fix deleted remote worktree reappearing due to host ID mismatch Paired clients and servers may use different spellings for execution hosts (e.g., client 'runtime:env-1' vs server 'local'). Resolve these spellings before worktree.rm and worktree.forceDeleteBranch to prevent failures and orphaned worktrees. * Validate runtime kind before comparing environment IDs Ensure parsed host IDs are actually runtime environments before accessing their environmentId property. Fixes incorrect host ID matching during worktree cleanup that caused deleted remote worktrees to reappear. * Use hostId directly when same-ID surviving host exists When a surviving host has the same ID as the deleted worktree's original host, use the hostId directly instead of qualifying it through the runtime call host. This prevents worktrees from reappearing due to host ID mismatch. --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
…lyai#16039) * Fix deleted remote worktree reappearing due to host ID mismatch Paired clients and servers may use different spellings for execution hosts (e.g., client 'runtime:env-1' vs server 'local'). Resolve these spellings before worktree.rm and worktree.forceDeleteBranch to prevent failures and orphaned worktrees. * Validate runtime kind before comparing environment IDs Ensure parsed host IDs are actually runtime environments before accessing their environmentId property. Fixes incorrect host ID matching during worktree cleanup that caused deleted remote worktrees to reappear. * Use hostId directly when same-ID surviving host exists When a surviving host has the same ID as the deleted worktree's original host, use the hostId directly instead of qualifying it through the runtime call host. This prevents worktrees from reappearing due to host ID mismatch. --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
Problem
When a paired client (e.g., running in a remote environment) deletes a worktree, it passes its own host ID spelling (like
runtime:env-1). The host machine may store the same worktree under a different host ID spelling (likelocal). This mismatch prevented cleanup from finding and removing the worktree, causing deleted worktrees to reappear.Solution
Added
resolvePairedCallerHostId()to translate the client's host ID to what the host actually uses for that repo. Worktree removal and branch deletion now resolve the host ID before cleanup operations. When there's ambiguity (same repo stored under multiple host IDs), the call fails safely rather than removing the wrong worktree.Also optimized: omit host ID from RPC calls when the target environment already matches, reducing unnecessary qualifiers.
Testing
Checklist
Notes
Fixes worktrees reappearing after deletion due to host ID mismatch in paired environments.