Skip to content

fix(projects): refuse project setup on a paired server's SSH host with a clear reason - #33284

Merged
nwparker merged 7 commits into
mainfrom
nwparker/ssh-project-setup-refusal
Oct 25, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/ssh-project-setup-refusal

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155 $\color{#cf222e}{\Huge{\mathbf{−}}}$​61 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​64 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​48

ELI5

Suppose your Orca server runs headless and owns an SSH host. Trying to add a project on that SSH host from a paired browser or desktop used to fail with a confusing error ("Cannot read properties of undefined (reading 'repo')", or "not connected" while the server said it was connected). This isn't supported yet, so Orca now says so plainly before trying.

What Changed

Before:

  • Paired client: an ssh:<target> host has no route of its own, so project setup fell through to this client's local API.
    • On a web client that API is a fallback that returns nothing, which caused the TypeError.
    • Cloning threw a misleading "not found or not connected".
  • orca CLI on the server: it also said "not connected".

After:

  • Renderer (assertNotSshProjectHost): add-folder and clone on an ssh: host are refused before anything is dispatched.
    • On a web client, or for a target that only a paired server lists, the message is the existing "This Orca server can't add projects on its SSH hosts. Add the SSH host on your computer to open its projects."
    • A desktop's own SSH host keeps its previous "SSH connection … not found or not connected" message.
  • Server runtime controller: the server's project-setup RPC, used by the orca CLI, now gives the same refusal for ssh: hosts.
  • Desktop IPC: the desktop's own IPC handler is unchanged.

Why

Why refuse instead of making it work: the paired client cannot route this to the server today. The server reaches the SSH host's managed runtime (runtime:<env>) over its own loopback tunnel. Clients have no route to that tunnel, and no RPC forwards project setup to it. Supporting it means the server either forwards projectHostSetup.*/browse/clone for its SSH hosts to their managed runtimes and re-stamps the results, or publishes the ssh-to-runtime alias with a proxy. Either needs a new capability gate. That is the client half of #29593, too large for this fix, so this PR gives an honest refusal.

Gaps left for follow-ups:

  • The CLI clone refusal on the server still suggests "clone on the host, then set up the existing folder". The second step is refused too, so that advice leads nowhere.
  • On a paired desktop the server-specific copy appears once the server's SSH target list has loaded. Before that it still refuses, with the desktop copy.

This builds on @MokiMeow's #33225; their commit is kept with authorship. On top of it:

  • The desktop's own IPC message stays as it was (the desktop is not "this Orca server").
  • The renderer copy is chosen by who owns the SSH host, so a standalone desktop isn't told to "add the SSH host on your computer".
  • A re-export is dropped.
  • A headless paired e2e is added.

Linked Issue

Fixes #33124

Thanks to @JargeZ for the precise report and source pointers.

Visual Proof

N/A: the change is the toast text. Before: "Cannot read properties of undefined (reading 'repo')". After: "This Orca server can't add projects on its SSH hosts. Add the SSH host on your computer to open its projects." Both are covered by the e2e below.

Testing

  • src/renderer/src/store/slices/repos.test.ts:

    • Web-client refusal through the real web fallback API. It fails on origin/main with the reported TypeError.
    • Copy selection for a paired server's target versus the desktop's own target.
  • Runtime controller tests: refusal code, connection id and message.

  • New tests/e2e/headless-paired-ssh-host-project-setup.spec.ts: a headless Electron serve host with an SSH target and a paired web client. Add-folder and clone both report the refusal. On origin/main it fails with the reported TypeError (run 40135428374); with the fix it passes (run 40135430097).

  • Local checks: pnpm tc, the full static job (except the Node-18 process-host smoke and the orcad terminal smoke, which need a Node 18 runtime and a mobile-web build this machine lacks), and 432 unit files under store/slices, store/projects and the runtime controller pass. The only failures are 2 pre-existing macOS /private/var realpath cases in orca-runtime.test.ts.

  • Automated tests added/updated

Review

Codex (pinned base) and an independent Opus review are clean on the final head.

Agent skill upstream boundary

  • Not applicable

Notes

  • Mixed versions: no wire change. Old clients paired to a new server still hit their own local fallback; the server can't fix that.
  • Mobile: no project-setup call sites.
  • Folder and git kinds: both covered.

MokiMeow and others added 5 commits October 24, 2026 14:41
The desktop's own project-setup IPC is not an Orca server, so it keeps
saying the SSH connection is not connected; the renderer now refuses SSH
setup before reaching it. Callers import the shared refusal message
directly instead of through the controller. Adds a headless paired e2e
that sets up a project on the server's SSH host from a web client.

Refs #33124
… host

A desktop's own SSH host keeps its 'not connected' copy; the server
refusal shows on a web client, or for a target only a paired server lists.

Refs #33124
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds a shared refusal message for project setup on server-owned SSH hosts. Renderer setup actions now classify SSH hosts and reject setup before selecting a runtime target. Runtime and renderer tests cover the errors and setup outcomes. A new end-to-end test checks existing-folder setup and cloning from a paired client.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Low · up to d1290

Project setup now gives a refusal on paired-server SSH hosts, but the message may remain English for users of other locales. The test and source routing also leave gaps in checking that users see the refusal. These are bounded follow-ups rather than a demonstrated failure of the setup workflow.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: refusing project setup on a paired server's SSH host and providing a clear reason.
Description check Passed The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, testing, visual proof, compatibility notes, and follow-up gaps.
Linked Issues check Passed #33124 allows either routing or a clear unsupported-feature error. The renderer calls assertNotSshProjectHost before add-folder and clone dispatch. Paired-server SSH targets receive `SERVER_SSH_PROJ…
Out of Scope Changes check Passed The changes stay within #33124. Production changes add SSH-host refusal, target ownership selection, and shared error handling. The runtime and renderer tests verify these behaviors. The e2e routing e…
Full details: Linked Issues check

Explanation

#33124 allows either routing or a clear unsupported-feature error. The renderer calls assertNotSshProjectHost before add-folder and clone dispatch. Paired-server SSH targets receive SERVER_SSH_PROJECT_ADD_UNAVAILABLE_MESSAGE. The runtime controller rejects SSH existing-folder setup with the same message and ssh_host_not_served. The paired e2e and unit tests cover the refusal paths. The PR does not claim to implement routing, worktree support, or discovery, so those features are not required under the selected clear-error alternative.

Full details: Out of Scope Changes check

Explanation

The changes stay within #33124. Production changes add SSH-host refusal, target ownership selection, and shared error handling. The runtime and renderer tests verify these behaviors. The e2e routing entry supports the new headless paired SSH project-setup test. No unrelated product behavior is established by the supplied evidence.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • 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.

@JargeZ

JargeZ commented Oct 25, 2026

Copy link
Copy Markdown

Insane speed, love you guys!

…setup-refusal

# Conflicts:
#	src/main/runtime/orca-runtime-tests/repository-project-operations.spec.ts
#	src/shared/project-host-setup-target.ts

@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: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76d8d5f8-fd6d-4e02-9f6a-eba021381bdb
Commits

Reviewing files that changed from the base of the PR and between 7dfae5e and d1290c5.

Files selected for processing: 9
  • config/scripts/pr-e2e-source-routing.mjs
  • src/main/runtime/orca-runtime-tests/repository-project-operations.spec.ts
  • src/main/runtime/runtime-project-host-setup-controller.test.ts
  • src/main/runtime/runtime-project-host-setup-controller.ts
  • src/renderer/src/store/projects/project-host-routing.ts
  • src/renderer/src/store/projects/project-host-setup-actions.ts
  • src/renderer/src/store/slices/repos.test.ts
  • src/shared/project-host-setup-target.ts
  • tests/e2e/headless-paired-ssh-host-project-setup.spec.ts

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

Comment on lines +104 to +105
/^src\/(?:renderer\/src\/store\/projects\/project-host-setup-actions|main\/runtime\/runtime-project-host-setup-controller|shared\/project-host-setup-target)\.ts$/.test(
file

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.

Minor · Functional Correctness · Quick win

Route changes to the SSH guard to this E2E test.

If a later change touches only src/renderer/src/store/projects/project-host-routing.ts, this route does not select the paired-host test. That file contains the refusal classification the test is meant to protect. Add project-host-routing to the renderer path alternative.

Comment on lines +3 to +4
export const SERVER_SSH_PROJECT_ADD_UNAVAILABLE_MESSAGE =
"This Orca server can't add projects on its SSH hosts. Add the SSH host on your computer to open its projects."

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.

Minor · Functional Correctness · Quick win

Localize the client-facing refusal.

The renderer passes this English message to toast.error without translation. Users with another locale therefore receive an English-only explanation for the new refusal. Give the renderer message an intent-named localization ID while retaining an appropriate English fallback for the runtime error. Based on learnings, newly added user-facing TypeScript strings should use intent-named localization IDs with named interpolation placeholders.

Source: Learnings

Comment on lines +55 to +58
expect(errors.messages).toHaveLength(2)
for (const message of errors.messages) {
expect(message).toContain(REFUSAL)
}

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.

Minor · Functional Correctness · Quick win

Assert the refusal in the rendered UI.

If the error toast stops rendering, both actions can still return null and log this message. This test then passes without verifying the clear reason that the user must see. Assert the toast through a DOM locator for each action instead of using console.error as the only message check. As per coding guidelines, “Use window.__store for setup; assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText).”

Source: Coding guidelines

@nwparker
nwparker merged commit 92fd257 into main Oct 25, 2026
48 checks passed
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.

[Bug]: Headless server (Electron host): projects cannot be set up on its SSH hosts from a paired client

3 participants