Skip to content

refactor(providers): an ssh: route carries no provider and throws one typed error - #27477

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-B2
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-B2

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​138 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1069 $\color{#cf222e}{\Huge{\mathbf{−}}}$​931
Prod 28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147 $\color{#cf222e}{\Huge{\mathbf{−}}}$​564 $\color{#cf222e}{\Huge{\mathbf{−}}}$​417

ELI5

The old way of driving an SSH host (the relay) is gone, but the code that routed git and file work to an "SSH provider" still pretended one might show up. None ever does. Now a request routed to an ssh: host stops straight away with one clear error, using the same words people already see, instead of carrying an empty provider around and checking it everywhere.

What Changed

  • Route shape. resolveGitRouteForHost / resolveFilesystemRouteForHost return { kind: 'ssh', hostId, connectionId } for an ssh: host — no provider field. requireReachableGitRoute / requireReachableFilesystemRoute now return only the local route and throw a new SshHostNotServedError (src/main/providers/ssh-host-not-served-error.ts) for ssh:, with today's text: "Remote connection dropped. Click Reconnect on the SSH target before retrying."
  • Callers. ~45 git IPC handlers (status, diff, index, commit, url, compare, sync, push/pull), GitHub lookups, the upstream-ref watch, hosted-review preflight, branch auto-rename, repo icon detection and the git remote-identity probe lose their unreachable SSH branches. The always-throwing requireGitProviderForHost / requireFilesystemProviderForHost are deleted (two @ts-nocheck runtime-file callers moved to requireSshFilesystemProvider, same error).
  • getActiveMultiplexer. Its resolver setter had no production caller, so every call threw the internal wiring error ssh_active_multiplexer_resolver_not_installed. It now throws the same typed "not served" error. This is the one accepted behaviour change: on paths that already failed (agent detection, remote preflight, port scanning, external-manager discovery, SSH worktree root registration, remote repo clone/scan), people see "Remote connection dropped…" instead of an internal code.
  • Left for later lane-B PRs on purpose. Derived routes that still carry their own SSH arm (runtime git/file commands, workspace cleanup, worktree removal and listing, workspace space scan) now look up the SSH provider themselves. Those arms go in B3–B6, which already own those files; this PR does not change their behaviour.

Before → after for a user: nothing changes on local, WSL, folder-workspace or paired-runtime (runtime:) work. On an ssh: row, the same operations fail as before with the same message; the only visible difference is the friendlier message where the wiring code used to leak.

Why

The provider field on an ssh: route was always null in production, yet every caller had to branch on it, and new git/file code kept copying that branch. Making the route provider-less and throwing at one place removes those branches, and the type system now stops new code from reaching for an SSH provider through the shared router. Considered: (a) keep the field and only add the typed error — leaves every dead branch; (b) also delete the derived SSH arms here — that pulls in the B3–B6 files and ~150 more test files, so it is split out.

Net lines (vs. main): production −417 (28 files), tests −931 (22 files).

Linked Issue

Phase 3.99, PR B2 (internal cleanup plan).

Visual Proof

N/A — no UI change; only the error text on already-failing SSH paths.

Testing

  • Characterization: execution-host-provider-dispatch.test.ts asserts every ssh: route throws SshHostNotServedError with the existing message, with and without a registered provider, and that an ssh: route never carries a local provider factory. ssh/ssh-target-registry.test.ts proves the wiring error is gone. Handler tests (git:status, git:abortMerge, git:abortRebase, git:commit, git:conflictOperation, upstream-ref watch, hosted review, native-chat artifact) assert the typed refusal and that nothing ran locally.

  • Tests that only exercised a registered SSH provider through these handlers (a state production cannot reach) were removed.

  • Dead-code proof: rg -w of requireGitProviderForHost|requireFilesystemProviderForHost|setSshActiveMultiplexerResolver|ReachableGitRoute|ReachableFilesystemRoute|detectRemoteImageIcon|detectRemotePackageHomepageIcon|requireHostedReviewSshProvider over src config scripts tests mobile packages .github → 0 hits (includes all @ts-nocheck files; the two @ts-nocheck callers were found this way and fixed). registerSsh{Git,Filesystem}Provider, setSshActiveMultiplexerResolver and setSshPlainSshMode have no production caller.

  • pnpm tc, pnpm lint, pnpm run check:code-quality:changed, build:electron-vite, build:cli, build:orcad pass; 253 related test files (4441 tests) pass.

  • macOS locally; Linux/Windows via CI.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

P0/P1 review: self + independent reviewer.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

SSH: an ssh: host never falls through to local — it throws, or keeps its structured "unavailable"/null result where the caller already had one. Wire: nothing a client and server exchange changes. Folder workspaces and WSL: local arms untouched.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 311ed615-4667-45ea-887c-72928dfa0edb

📥 Commits

Reviewing files that changed from the base of the PR and between d3417b2 and 0fe7fb6.


📒 Files selected for processing (50)
  • src/main/agent-hooks/first-work-branch-rename.test.ts
  • src/main/agent-hooks/first-work-branch-rename.ts
  • src/main/git/remote-url-probe.test.ts
  • src/main/github/client-ssh-provider-execution-boundary.test.ts
  • src/main/github/client-tracked-upstream-fork-owner.test.ts
  • src/main/github/client-tracked-upstream-snapshot.test.ts
  • src/main/github/client/lookup/pull-request-lookup-data.ts
  • src/main/github/client/lookup/tracked-upstream-branch.ts
  • src/main/github/github-repository-identity.ssh-host-alias.test.ts
  • src/main/ipc/filesystem-branch-compare-diff.test.ts
  • src/main/ipc/filesystem-conflict-operation-routing.test.ts
  • src/main/ipc/filesystem-git-commit-dispatch.test.ts
  • src/main/ipc/filesystem-git-status-staging.test.ts
  • src/main/ipc/filesystem/filesystem-git-commit-handlers.ts
  • src/main/ipc/filesystem/filesystem-git-diff-handlers.ts
  • src/main/ipc/filesystem/filesystem-git-index-handlers.ts
  • src/main/ipc/filesystem/filesystem-git-status-handlers.ts
  • src/main/ipc/filesystem/filesystem-git-url-handlers.ts
  • src/main/ipc/filesystem/git-remote/branch-mutation-handlers.ts
  • src/main/ipc/filesystem/git-remote/compare-handlers.ts
  • src/main/ipc/filesystem/git-remote/sync-handlers.ts
  • src/main/ipc/git-status-upstream-ref-watch-request.test.ts
  • src/main/ipc/git-status-upstream-ref-watch-request.ts
  • src/main/ipc/repos-remote.test.ts
  • src/main/ipc/workspace-cleanup-git-route.ts
  • src/main/providers/execution-host-provider-dispatch.test.ts
  • src/main/providers/execution-host-provider-dispatch.ts
  • src/main/providers/ssh-host-not-served-error.ts
  • src/main/repo-git-remote-identity.test.ts
  • src/main/repo-git-remote-identity.ts
  • src/main/repo-icon-autodetect.test.ts
  • src/main/repo-icon-autodetect.ts
  • src/main/repo-icon-file-detection.test.ts
  • src/main/repo-icon-file-detection.ts
  • src/main/repo-worktrees.ts
  • src/main/runtime/orca-runtime-files-terminal-artifact-io.test.ts
  • src/main/runtime/orca-runtime-test-mocks/setup.spec.ts
  • src/main/runtime/runtime-file-command-target.ts
  • src/main/runtime/runtime-file-commands-assert-remote-terminal-file-grant-path-still-canonical.ts
  • src/main/runtime/runtime-file-commands-resolve-allowed-terminal-artifact-path.ts
  • src/main/runtime/runtime-git-command-target.ts
  • src/main/runtime/runtime-worktree-filesystem.ts
  • src/main/source-control/hosted-review-creation-eligibility.test.ts
  • src/main/source-control/hosted-review-creation-git-state.ts
  • src/main/source-control/hosted-review-creation.test.ts
  • src/main/source-control/hosted-review-execution-host-routing.test.ts
  • src/main/ssh/ssh-target-registry.test.ts
  • src/main/ssh/ssh-target-registry.ts
  • src/main/workspace-space-repo-scan.ts
  • src/main/worktree-removal-execution-host-route.ts

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

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