Skip to content

Fix SSH worktree delete routing after host reconnect - #7997

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
timsuchanek:agent/fix-ssh-worktree-delete-routing
Jul 10, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
timsuchanek:agent/fix-ssh-worktree-delete-routing

Conversation

@timsuchanek

Copy link
Copy Markdown
Contributor

Summary

  • route workspace deletion using the workspace execution host, not only its project ID
  • select the correct host-scoped repo row in the main-process removal handler
  • use host-aware repo selection for disconnected and removed SSH host recovery

Root cause

Orca can retain repo rows with the same project ID on different execution hosts. The delete flow and desktop IPC handler selected a repo using only the project ID, so an older SSH workspace could resolve to a local repo row after a host disconnect and re-adoption.

That caused Orca to invoke local git with an EC2-only working directory. Node reported the missing working directory as spawn git ENOENT, leaving the workspace impossible to remove.

Impact

Older SSH workspaces now carry their host identity through the preload contract. Deletion selects the matching SSH repo/provider, while disconnected or removed targets reach the existing reconnect-or-forget recovery flow.

Legacy workspaces without host metadata retain the existing bare-ID fallback.

Validation

  • vitest focused suite: 193 tests passed
  • Node typecheck passed
  • Web typecheck passed
  • formatting and git diff --check passed
  • max-lines ratchet passed

@timsuchanek
timsuchanek marked this pull request as ready for review July 10, 2026 01:49
@AmethystLiang
AmethystLiang requested a review from Jinwoo-H July 10, 2026 01:49
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 01ed955f-666d-4f12-bf55-a21960949123

📥 Commits

Reviewing files that changed from the base of the PR and between 3426902 and b188b21.

📒 Files selected for processing (10)
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/sidebar/delete-worktree-flow.ts
  • src/renderer/src/lib/ensure-hooks-confirmed.test.ts
  • src/renderer/src/lib/ensure-hooks-confirmed.ts
  • src/renderer/src/runtime/runtime-hooks-client.ts
  • src/renderer/src/store/slices/worktrees.test.ts
  • src/renderer/src/store/slices/worktrees.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/sidebar/delete-worktree-flow.ts

📝 Walkthrough

Walkthrough

Worktree removal, local forgetting, and hook inspection now accept optional execution host identifiers. IPC and renderer logic resolve repositories by host, reject ambiguous identities, and isolate concurrent cleanup operations across hosts. Host IDs are forwarded through preload and local deletion APIs, while hook confirmation selects host-specific repositories and runtime settings. Tests cover duplicate repository IDs, fail-closed behavior, SSH removal, host-specific hook checks, and host-separated concurrent operations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, root cause, impact, and validation, but omits several required template sections. Add the missing Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes sections, and format Testing as the required checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the SSH worktree delete routing fix and stays concise.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@AmethystLiang
AmethystLiang requested review from AmethystLiang and removed request for Jinwoo-H July 10, 2026 07:46
@AmethystLiang
AmethystLiang requested review from Jinwoo-H and removed request for AmethystLiang July 10, 2026 16:47

@Jinwoo-H Jinwoo-H 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.

Thanks @timsuchanek. I tightened the fix so deletion, forget, archive-hook inspection, and in-flight deduplication all use the canonical execution host. Ambiguous legacy worktree identities now fail closed instead of risking deletion on the wrong host.

Validated with focused regression tests, typecheck, a production build, Electron assertions, and a live Linux SSH worktree deletion.

@Jinwoo-H
Jinwoo-H merged commit 8976bd9 into stablyai:main Jul 10, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Fix SSH worktree delete routing

* Harden host-scoped worktree deletion

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Jinwoo-H <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

2 participants