Skip to content

refactor(ipc): worktree handlers are local or runtime only - #27528

Merged
OrcaWin merged 4 commits into
mainfrom
OrcaWin/p399-B4
Oct 11, 2026
Merged

OrcaWin merged 4 commits into
mainfrom
OrcaWin/p399-B4

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 45 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​173 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6513 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6340
Prod 38 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​356 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2997 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2641

ELI5

Orca used to drive SSH hosts through an old "relay" connection. That relay is gone, so the code that created, removed and listed worktrees through it could never run again: every one of those paths already stopped at "Remote connection dropped. Click Reconnect…". This PR deletes that unreachable code. Worktree handlers now do two things only: work on this computer, or refuse an SSH target with the same message as today. (A managed SSH host is reached as a paired runtime, which this PR does not touch.)

What Changed

User-visible behaviour is the same before and after:

  • Removing a worktree on an SSH repo (desktop or CLI/runtime): before, it failed with "Remote connection dropped. Click Reconnect on the SSH target before retrying." After, the same text, thrown at the same point, now as the typed SshHostNotServedError. Nothing is listed, stopped or deleted on this machine. The forget/folder-workspace sweeps and metadata purge for SSH rows did not use the relay and are unchanged.
  • Creating a worktree on an SSH repo (desktop or runtime): before, createRemoteWorktree tagged the create event as ssh and then failed with the same reconnect text. After, the route refuses with the same text, and the failed-create event still carries execution_host: 'ssh'.
  • Listing worktrees and lineage for an SSH repo: before, each listing fell back to persisted metadata (non-authoritative), because there was never a provider. After, it takes that same metadata path directly. Lineage for an SSH host still answers unavailable, or stale when the authority has rotated.

How it works: getSshGitProvider / getSshFilesystemProvider always returned undefined, requireSshGitProvider always threw, and getActiveMultiplexer always threw (since #27477). Each caller in the worktree area now goes straight to the branch it already took:

  • Removal: the IPC removal path (removal/*, the preserved-branch force delete, nested preview) and the runtime removal route now cover only local repos. WorktreeRemovalRoute has a single local variant; ssh: throws SshHostNotServedError, and runtime: still throws ExecutionHostNotDispatchableError. Deleted: remove-registered-remote-worktree.ts, runtime-registered-remote-worktree-removal.ts, worktree-archive-hook.ts (the remote orca.yaml reader and remote hook runner), gateRemovalWhereArchiveHookCannotRun, and the SSH host-home resolver injection (it had no production setter).
  • Create: deleted createRemoteWorktree and every SSH-only helper in ipc/worktree-remote.ts (fetch caches, base plans, SSH push-target prepare/materialize/cleanup, remote setup-runner script). Also deleted the runtime remote-create trio (runtime-remote-{managed-worktree-create,worktree-create-request,worktree-create-result}.ts), the SSH arm of create-base prefetch, and ssh-worktree-create-root-registration.ts, which was the last getActiveMultiplexer caller in Lane B's worktree list.
  • Listing: listDetectedWorktreesForCapturedRepo loses its captured-provider parameter. The catalog handlers, host-qualified listing, lineage listing and repo-worktrees keep their existing metadata-fallback / unavailable answers.

Net lines: production −2,607 (+355 / −2,962, 34 files). Tests −6,362 (+173 / −6,535, 47 files). Config −12 (shard timings for deleted test files, one reliability-gate known gap that named the deleted create branch).

Why

New worktree work should not have to carry, or copy, an ssh provider branch that cannot run. B7 (deleting the SSH git and filesystem providers) needs these callers gone first. Alternatives considered:

  • Keeping the dead create pipeline and only removing its root-registration calls: this would leave about 1,200 lines that B7 would have to delete anyway, and would leave untested half-states.
  • Routing ssh: to a managed runtime: that is a behaviour change, and the design rules it out for this phase.

Every removed arm throws at the point where the old one threw, and none falls through to local (design P1-4).

Linked Issue

Phase 3.99 (runtime strategy cleanup), PR B4 of the reviewed design; no separate issue.

Visual Proof

N/A. No UI change: the only user-facing strings on these paths are unchanged.

Testing

  • pnpm tc, pnpm lint (all ratchets OK: ts-nocheck 159, max-lines, focus-read, reliability gates), pnpm run check:code-quality:changed (0 new findings), oxlint on changed files.
  • Bundler proof: build:electron-vite, build:cli, build:orcad all succeed.
  • Dead-symbol proof: rg -w of all 26 deleted exports (plus createManagedRemoteWorktree) over src, config, tests, e2e, mobile, packages and .github, and over each of the 168 @ts-nocheck files, finds no remaining reference.
  • Focused vitest: src/main/{ipc,runtime,providers,worktree*,repo-worktrees,agent-launch,git,workspace*,hooks}: 2,085 files / 21,487 tests, all green. Neighbours (memory, project-groups, automations, skills, source-control, github, gitlab, cli, renderer worktree listing and cleanup): 446 files green. Re-ran the core set after rebasing onto 7dfa4d6e54.
  • Test changes:
    • Deleted suites that only exercised a registered fake SSH provider: SSH create, base prefetch, local-base refresh, provider authority races, SSH archive hooks, SSH host-home guards.
    • Rewrote the SSH cases that guard the execution boundary as refusal characterizations: removal and create refuse with SshHostNotServedError and never list, stop or delete locally (IPC and runtime). Duplicate repo ids still pick the SSH owner and refuse. A percent-escaped row passes the host check and then refuses. The failed-create event still names ssh. Listing answers from metadata without local git. Lineage answers unavailable / stale.
    • Local, WSL, Windows-path, folder-workspace and runtime: cases are kept unchanged.

Notes

  • SSH: no path that touches execution falls back to local. Folder workspaces keep their host fence.
  • Wire: no RPC param, stream frame or published payload changes. The runtime error mapper sends the same runtime_error code with the same message.
  • Logging: the "SSH git provider unavailable; skipping worktree list" warn-once log is gone with the branch it described.
  • Left for other PRs:
    • ipc/worktrees/create/register-review-base-handlers.ts (PR-base resolution over SSH), hooks/filesystem/repos IPC: B3 and B7 territory.
    • The mixin class OrcaRuntimeWithCreateManagedRemoteWorktree keeps its name to avoid churn across the chain, but no longer contains a remote create.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ccd5e9c-fcc4-4521-9068-fb36d6350243

📥 Commits

Reviewing files that changed from the base of the PR and between 63d623fd9cf4141a3c10720b35683c87b54b8abe and bab5dc9.


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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 579eadba-528f-4919-8f74-b40598ab4dd5


📥 Commits

Reviewing files that changed from the base of the PR and between 5791f935a12f8e37096abbf90c91ff522471c564 and 63d623fd9cf4141a3c10720b35683c87b54b8abe.



📒 Files selected for processing (1)
  • src/main/runtime/managed-worktree-create-execution-host.test.ts


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

SSH worktree creation and removal no longer use SSH providers in this process. Create and removal requests for SSH hosts now reject with SshHostNotServedError. SSH-targeted worktree listings use persisted metadata instead of provider scans. SSH lineage requests no longer return direct-SSH snapshots. The diff also removes SSH-specific creation, removal, and provider test paths and updates related fixtures and timing records.



Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 63d62

This increment only tidies the SSH-refusal test while preserving coverage for both host metadata shapes; no merge-blocking risk remains.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 10.87% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 50 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the primary change: worktree handlers now support local or runtime execution and no longer use the removed SSH execution paths.
Description check Passed The description is detailed and covers the change, rationale, linked work, visual proof, testing, compatibility considerations, and remaining scope. The template checklist, Review section, and Agent s…
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.



✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR




🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

🧹 Nitpick comments (1)
src/main/runtime/orca-runtime-tests/ssh-worktree-lifecycle-part-02.spec.ts (1)

49-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the typed refusal error.

.rejects.toThrow() accepts any rejection. An unrelated failure, such as a TypeError in route resolution, also passes this test. The other refusal tests in this PR assert SshHostNotServedError. Without the typed check, this test does not confirm that the runtime path uses the not-served contract.

♻️ Proposed change
-    ).rejects.toThrow()
+    ).rejects.toThrow(SshHostNotServedError)

Add the import:

import { SshHostNotServedError } from '../../providers/ssh-host-not-served-error'

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c593f040-5d2d-44cd-9441-01b45697c386
📥 Commits

Reviewing files that changed from the base of the PR and between 7dfa4d6 and 5791f935a12f8e37096abbf90c91ff522471c564.

📒 Files selected for processing (83)
  • config/reliability-gates.jsonc
  • config/scripts/ci-shard-timings.json
  • src/main/agent-launch/agent-launch-executor.ts
  • src/main/ipc/ssh-worktree-create-root-registration.ts
  • src/main/ipc/workspace-create-error-classifier.ts
  • src/main/ipc/worktree-push-target-reconciliation.ts
  • src/main/ipc/worktree-remote-push-target-materialization.test.ts
  • src/main/ipc/worktree-remote-ssh-branch-conflict.test.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-canonical-ssh-listing.test.ts
  • src/main/ipc/worktrees-create-event-timing.test.ts
  • src/main/ipc/worktrees-delete-pty-teardown.test.ts
  • src/main/ipc/worktrees-discovery-metadata-backfill.test.ts
  • src/main/ipc/worktrees-forget-local.test.ts
  • src/main/ipc/worktrees-issue-command-overrides.test.ts
  • src/main/ipc/worktrees-lineage-hydration.test.ts
  • src/main/ipc/worktrees-listing-fallback-rows.test.ts
  • src/main/ipc/worktrees-mutation-scan-generation-order.test.ts
  • src/main/ipc/worktrees-orphan-directory-cleanup.test.ts
  • src/main/ipc/worktrees-remove-archive-hooks.test.ts
  • src/main/ipc/worktrees-remove-preflight.test.ts
  • src/main/ipc/worktrees-setup-launch-sparse-checkout.test.ts
  • src/main/ipc/worktrees-ssh-base-ref-resolution.test.ts
  • src/main/ipc/worktrees-ssh-create-base-prefetch.test.ts
  • src/main/ipc/worktrees-ssh-local-base-refresh-overlap.test.ts
  • src/main/ipc/worktrees-ssh-local-base-refresh.test.ts
  • src/main/ipc/worktrees-ssh-pr-head-fetch.test.ts
  • src/main/ipc/worktrees-ssh-provider-authority.test.ts
  • src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts
  • src/main/ipc/worktrees-test-harness.ts
  • src/main/ipc/worktrees/create/register-worktree-create-handlers.ts
  • src/main/ipc/worktrees/listing/detected-provider-listing-catalog-version.test.ts
  • src/main/ipc/worktrees/listing/detected-provider-listing-meta-index.test.ts
  • src/main/ipc/worktrees/listing/detected-provider-listing-overtaken-scan.test.ts
  • src/main/ipc/worktrees/listing/detected-provider-listing.ts
  • src/main/ipc/worktrees/listing/host-qualified-worktree-listing.ts
  • src/main/ipc/worktrees/listing/register-detected-worktree-handlers.ts
  • src/main/ipc/worktrees/listing/register-worktree-catalog-handlers.ts
  • src/main/ipc/worktrees/listing/worktree-listing-diagnostics.ts
  • src/main/ipc/worktrees/metadata/host-lineage-listing.ts
  • src/main/ipc/worktrees/removal/execute-worktree-removal.ts
  • src/main/ipc/worktrees/removal/nested-worktree-removal.ts
  • src/main/ipc/worktrees/removal/register-worktree-forget-handlers.ts
  • src/main/ipc/worktrees/removal/remove-registered-remote-worktree.ts
  • src/main/ipc/worktrees/removal/remove-unregistered-worktree-host-home.test.ts
  • src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts
  • src/main/ipc/worktrees/removal/worktree-archive-hook.test.ts
  • src/main/ipc/worktrees/removal/worktree-archive-hook.ts
  • src/main/ipc/worktrees/removal/worktree-removal-filesystem.ts
  • src/main/providers/ssh-worktree-catalog-authority.test.ts
  • src/main/repo-worktrees.test.ts
  • src/main/repo-worktrees.ts
  • src/main/runtime/managed-worktree-create-execution-host.test.ts
  • src/main/runtime/managed-worktree-create-telemetry.test.ts
  • src/main/runtime/orca-runtime-create-managed-remote-worktree.ts
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/main/runtime/orca-runtime-remove-managed-worktree.ts
  • src/main/runtime/orca-runtime-tests/ssh-worktree-lifecycle-part-02.spec.ts
  • src/main/runtime/orca-runtime-tests/ssh-worktree-lifecycle.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-02.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-04.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-execution-host.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-setup-and-startup-part-05.spec.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/runtime-registered-remote-worktree-removal.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.test.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.ts
  • src/main/runtime/runtime-remote-worktree-create-request.ts
  • src/main/runtime/runtime-remote-worktree-create-result.ts
  • src/main/runtime/runtime-unregistered-worktree-removal-host-home.test.ts
  • src/main/runtime/runtime-unregistered-worktree-removal.ts
  • src/main/runtime/runtime-worktree-filesystem.ts
  • src/main/runtime/worktree-removal-route-listing.ts
  • src/main/worktree-archive-hook-cannot-run.test.ts
  • src/main/worktree-archive-hook-gate.ts
  • src/main/worktree-create-base-prefetch.test.ts
  • src/main/worktree-create-base-prefetch.ts
  • src/main/worktree-create-execution-host-route.test.ts
  • src/main/worktree-create-execution-host-route.ts
  • src/main/worktree-removal-execution-host-route.test.ts
  • src/main/worktree-removal-execution-host-route.ts
  • src/main/worktree-removal-test-ssh-host-home.ts
💤 Files with no reviewable changes (31)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/worktree-archive-hook-cannot-run.test.ts
  • src/main/ipc/worktrees-ssh-base-ref-resolution.test.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.test.ts
  • src/main/ipc/worktrees-ssh-create-base-prefetch.test.ts
  • src/main/ipc/worktrees/removal/remove-unregistered-worktree-host-home.test.ts
  • src/main/ipc/ssh-worktree-create-root-registration.ts
  • src/main/runtime/orca-runtime-tests/worktree-setup-and-startup-part-05.spec.ts
  • src/main/ipc/worktrees-ssh-provider-authority.test.ts
  • src/main/ipc/worktrees-ssh-local-base-refresh.test.ts
  • src/main/ipc/worktrees-ssh-local-base-refresh-overlap.test.ts
  • src/main/ipc/worktrees/removal/worktree-archive-hook.test.ts
  • src/main/ipc/worktrees/listing/worktree-listing-diagnostics.ts
  • src/main/worktree-removal-test-ssh-host-home.ts
  • src/main/runtime/runtime-unregistered-worktree-removal-host-home.test.ts
  • src/main/ipc/worktrees-mutation-scan-generation-order.test.ts
  • src/main/ipc/worktrees/removal/remove-registered-remote-worktree.ts
  • src/main/ipc/worktrees-remove-preflight.test.ts
  • src/main/runtime/runtime-remote-managed-worktree-create.ts
  • src/main/ipc/worktrees/removal/worktree-archive-hook.ts
  • src/main/ipc/worktrees-test-harness.ts
  • src/main/runtime/runtime-remote-worktree-create-request.ts
  • src/main/ipc/worktree-push-target-reconciliation.ts
  • src/main/runtime/runtime-registered-remote-worktree-removal.ts
  • src/main/ipc/worktrees-remove-archive-hooks.test.ts
  • src/main/runtime/runtime-remote-worktree-create-result.ts
  • src/main/ipc/worktrees/listing/detected-provider-listing-catalog-version.test.ts
  • src/main/worktree-archive-hook-gate.ts
  • src/main/runtime/orca-runtime-create-managed-remote-worktree.ts
  • config/scripts/ci-shard-timings.json
  • src/main/ipc/worktree-remote-ssh-branch-conflict.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@OrcaWin
OrcaWin merged commit 3359fd2 into main Oct 11, 2026
38 checks passed
@AmethystLiang AmethystLiang mentioned this pull request Nov 12, 2026
9 tasks
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.

1 participant