Repository navigation
fix(automations): list a web client's paired server once, not again as Desktop - #33019
Conversation
…s Desktop A paired web client's local runtime calls go to its server, so the desktop authority and the saved runtime are one runtime. The Automations catalog projected both and every automation appeared twice (Local <OS> + Orca Server). The catalog now folds the desktop authority into the saved runtime that getPairedWebClientEnvironmentId names, and a saved Desktop host filter falls back to All hosts instead of waiting forever for an entry that never comes. Co-authored-by: Chen <[email protected]>
…rver On a paired web client the Desktop host is the server, so a saved Desktop selection now names the server's matching host instead of being dropped with a fallback notice on every visit. Co-authored-by: Chen <[email protected]>
…e folded server Codex review: with Desktop folded into the paired server, a workspace run link carrying hostId 'local' never matched a row and the run page stayed loading, and the sole create host could be picked before the server's SSH targets loaded. Pending navigation on a paired web client now names the server's runtime, and desktop SSH hydration follows the runtime Desktop folded into. Co-authored-by: Chen <[email protected]>
…e time Resolving the pending navigation's host when it is matched, not when it is stored, also covers a link opened before the server environment list loads. Replaces the store-setter rewrite from the previous commit. Co-authored-by: Chen <[email protected]>
Walkthrough
Priority: Severity of issue fixed: Low Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2

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:
22f28eb8-5774-4de7-ac5c-94ccad4071c1
Files selected for processing: 12-
src/renderer/src/components/automations/automation-host-catalog-source.tssrc/renderer/src/components/automations/automation-host-catalog-types.tssrc/renderer/src/components/automations/automation-host-catalog.test.tssrc/renderer/src/components/automations/automation-host-catalog.tssrc/renderer/src/components/automations/automation-host-client.test.tssrc/renderer/src/components/automations/automation-host-client.tssrc/renderer/src/components/automations/automation-host-filter-resolution.tssrc/renderer/src/components/automations/use-automation-host-catalog-source-state.tssrc/renderer/src/components/automations/use-automation-host-catalog.test.tsxsrc/renderer/src/components/automations/use-automation-host-catalog.tssrc/renderer/src/components/automations/use-automation-run-page-state.tssrc/renderer/src/components/automations/use-automations-page-refresh.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
| referenced: referenced.get(automationAuthorityCatalogKey(desktopAuthority)) ?? EMPTY_SCOPE, | ||
| orphanCount: input.desktop.orphanCount | ||
| }, | ||
| ...(desktopAliasEnvironmentId === undefined ? [desktopContext] : []), |
There was a problem hiding this comment.
🎯 Functional Correctness |
Preserve referenced Desktop hosts when folding the catalog.
If referencedStableKeys contains a Desktop SSH key and the target is absent from the runtime SSH mirror, omitting desktopContext also removes that host entry. For example, a saved reference to a removed Desktop target no longer produces the ghost entry that the catalog previously showed. Fold Desktop reference keys into the runtime scope before projection. Keep the corresponding reference check in useAutomationHostCatalog consistent with that mapping.
| // A web client's local calls are its paired server's, so Desktop and that runtime are one authority. | ||
| const desktopAliasEnvironmentId = getPairedWebClientEnvironmentId({ runtimeEnvironments }) | ||
|
|
||
| // Memoized: consumers key whole-catalog rebuilds on this object's identity. | ||
| return useMemo( | ||
| () => ({ desktopSsh, runtimes, runtimeCatalogSettled }), | ||
| [desktopSsh, runtimes, runtimeCatalogSettled] | ||
| () => ({ desktopSsh, runtimes, desktopAliasEnvironmentId, runtimeCatalogSettled }), | ||
| [desktopSsh, runtimes, desktopAliasEnvironmentId, runtimeCatalogSettled] |
There was a problem hiding this comment.
🎯 Functional Correctness |
🔎 Supported by static analysis
-
🏁 Script executed:
set -eu printf '%s\n' '--- paired helper ---' nl -ba src/renderer/src/lib/paired-web-client-host.ts | sed -n '1,80p' printf '%s\n' '--- helper usages ---' rg -n -F --glob '*.ts' --glob '*.tsx' 'getPairedWebClientEnvironmentId' src printf '%s\n' '--- source-state block ---' nl -ba src/renderer/src/components/automations/use-automation-host-catalog-source-state.ts | sed -n '45,105p' printf '%s\n' '--- catalog alias handling ---' nl -ba src/renderer/src/components/automations/automation-host-catalog.ts | sed -n '235,295p' printf '%s\n' '--- filter folding ---' nl -ba src/renderer/src/components/automations/automation-host-filter-resolution.ts | sed -n '45,90p' printf '%s\n' '--- helper tests ---' rg -n -F --glob '*test*' --glob '*spec*' -e 'paired-web-client-host' -e 'getPairedWebClientEnvironmentId' src || test "$?" -eq 1
Repository: stablyai/orca
Length of output: 11808
Preserve the exact paired environment ID.
The persisted catalog keeps the exact ID, but getPairedWebClientEnvironmentId trims it. For an accepted ID such as " env-1 ", the alias becomes "env-1" and does not match the catalog runtime. Desktop remains projected, while the saved filter and pending navigation target the nonexistent trimmed ID.
Return the raw ID only when its trimmed form is nonblank:
Suggested fix
- return environments.length === 1 ? environments[0].id.trim() || null : null
+ const environmentId = environments.length === 1 ? environments[0].id : null
+ return environmentId?.trim() ? environmentId : null
ELI5
When you open Orca in a browser against a headless
orca servemachine, the Automations page showed every automation twice: once as "Local " and once as "Orca Server". Both rows were the same automation on the same machine. Now each automation is listed once, under the server.What Changed
Before: a paired web client's "local" calls are sent to its server (
window.api.runtime.callgoes to the active environment). The Automations host catalog projected two authorities anyway: the desktop authority, plus the saved runtime environment for the server. Both answered from the same automation store, so every row came out twice.After: the catalog source asks the existing helper
getPairedWebClientEnvironmentId(the same rule worktree and terminal routing already use: "on a web client, local is the server's own") which saved runtime is the desktop authority. It then folds Desktop into that runtime. Desktop is dropped only if that runtime is actually in the catalog. Every consumer of the catalog follows from that: rows, picker, create destination, external automation scopes.The fold also covers the places that still name Desktop:
hostId: 'local'orssh:*) resolve to the server when they are matched, throughgetAutomationListedTargetFromHostId. Before, the run page waited forever, and a link opened before the environment list loaded also failed.The Electron desktop app is unchanged: the helper returns null outside a web client. No wire or protocol changes.
Why
Runs were never duplicated, only the listing. I reproduced this on a headless
orca serve: a scheduler that fires every minute, with the web client open on the duplicated listing, produced exactly one run per slot over 11 slots. The scheduler is server-side (local_host_service), and the web client never dispatches.Two other options were considered:
runtimeIds. This needs status probes in a catalog that is projective by design. Identity is also unknown while the server is offline, so the duplicate rows would come back exactly when the server disconnects. On a web client the alias holds by construction, so the existing helper is the more reliable identity.isWebClientLocation()is true. This PR builds on that idea, and @Pr1p is credited as co-author. In fix: avoid duplicate automations in web client #32758, a persisted Desktop host filter stays in "Loading host…" forever (verified with the new test against their diff). The web run-link and sole-host paths are also left unfixed there.Linked Issue
Fixes #32415
Thanks to @Manuframil for the detailed report, including the CLI output that showed a single automation behind two rows.
Visual Proof
Screenshots were taken live, with a hidden headless browser against an isolated
orca serveon macOS:dup-checklisted twice, with host "Local Mac" and host "Orca Server".dup-check,every-minute, and a newly createdweb-createdeach appear once, with host "Orca Server". The create dialog defaults to Host "Orca Server", and saving from the browser creates one automation.Testing
Reproduced on a headless
orca serve(installed 1.4.239, isolated HOME and user data) with the web client in a hidden headless browser: duplicate rows confirmed, and duplicate runs ruled out (11 per-minute slots, 1 run each).Live check with this branch's web client against the same server: one row per automation, and creating an automation from the browser saves one record.
New tests, each failing on main:
pnpm tc(all targets), the full static-analysis job locally (26 steps), andsrc/renderer/src/components/automations(867 tests, single worker).I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Codex review is clean on the final head; earlier rounds' findings (run-link matching, sole-host SSH gate) were fixed. An independent Opus review was also run; its P3s are listed below.
Agent skill upstream boundary
Notes
Remaining P3s, not addressed here:
hostStableKeys) is not folded. It is never persisted, and once the catalog folds, its menu offers only runtime keys.Security: no new inputs or permissions. Cross-platform: renderer-only, no paths. SSH and remote: server SSH targets stay under the server runtime. Mixed versions: no wire changes. Mobile: no mobile code. Folder workspaces: unaffected (the catalog is keyed by host, not by project kind).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)