Repository navigation
fix(projects): refuse project setup on a paired server's SSH host with a clear reason - #33284
Conversation
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
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
|
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
There was a problem hiding this comment.
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
Files selected for processing: 9-
config/scripts/pr-e2e-source-routing.mjssrc/main/runtime/orca-runtime-tests/repository-project-operations.spec.tssrc/main/runtime/runtime-project-host-setup-controller.test.tssrc/main/runtime/runtime-project-host-setup-controller.tssrc/renderer/src/store/projects/project-host-routing.tssrc/renderer/src/store/projects/project-host-setup-actions.tssrc/renderer/src/store/slices/repos.test.tssrc/shared/project-host-setup-target.tstests/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.
-
| /^src\/(?:renderer\/src\/store\/projects\/project-host-setup-actions|main\/runtime\/runtime-project-host-setup-controller|shared\/project-host-setup-target)\.ts$/.test( | ||
| file |
There was a problem hiding this comment.
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.
| 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." |
There was a problem hiding this comment.
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
| expect(errors.messages).toHaveLength(2) | ||
| for (const message of errors.messages) { | ||
| expect(message).toContain(REFUSAL) | ||
| } |
There was a problem hiding this comment.
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
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:
ssh:<target>host has no route of its own, so project setup fell through to this client's local API.orcaCLI on the server: it also said "not connected".After:
assertNotSshProjectHost): add-folder and clone on anssh:host are refused before anything is dispatched.orcaCLI, now gives the same refusal forssh:hosts.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 forwardsprojectHostSetup.*/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:
This builds on @MokiMeow's #33225; their commit is kept with authorship. On top of it:
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: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
Notes