Skip to content

fix(automations): list a web client's paired server once, not again as Desktop - #33019

Merged
nwparker merged 4 commits into
mainfrom
nwparker/automations-dedupe-runtime-identity
Oct 24, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/automations-dedupe-runtime-identity

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​109 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84

ELI5

When you open Orca in a browser against a headless orca serve machine, 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.call goes 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:

  • A saved host filter that points at Desktop is moved to the server's matching host. Before, it stayed in "Loading host…" forever.
  • Workspace run links (hostId: 'local' or ssh:*) resolve to the server when they are matched, through getAutomationListedTargetFromHostId. Before, the run page waited forever, and a link opened before the environment list loaded also failed.
  • "Sole create host" now waits for the server's SSH targets to load before it picks a default destination.

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:

  • Comparing live 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.
  • fix: avoid duplicate automations in web client #32758 by @Pr1p. It drops Desktop whenever 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 serve on macOS:

  • Before (released 1.4.239 web client): dup-check listed twice, with host "Local Mac" and host "Orca Server".
  • After (this branch's web client served by Vite against the same server): dup-check, every-minute, and a newly created web-created each 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:

    • use-automation-host-catalog.test.tsx: a web client lists only the server, and no Desktop list request is made. A saved Desktop filter moves to the server's host.
    • automation-host-catalog.test.ts: SSH hydration follows the folded runtime.
    • automation-host-client.test.ts: web run-link hosts resolve to the server.
  • pnpm tc (all targets), the full static-analysis job locally (26 steps), and src/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

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

Notes

Remaining P3s, not addressed here:

  • On the web, the Runs dashboard's "Local" scope tab is now empty, because the server's runs are classified as "Remote". Before, the same runs showed in both tabs.
  • The in-memory list filter (hostStableKeys) is not folded. It is never persisted, and once the catalog folds, its menu offers only runtime keys.
  • A desktop Electron app that saved an environment pointing back at its own runtime would still list it twice. This has not been reported, and handling it needs a live identity probe.

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

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

nwparker and others added 4 commits October 23, 2026 19:43
…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]>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The automation catalog now treats a paired runtime as the desktop host authority and omits the duplicate desktop context. Saved desktop host filters resolve against that runtime. Pending automation navigation maps local host IDs to the paired runtime in web clients, while desktop clients retain local targets.

Priority: Normal

Severity of issue fixed: Low

Merge Risk: Low · up to c3ff2

Some saved Desktop host references may disappear, and unusual saved runtime IDs can disrupt host selection. These bounded cases merit fixes or owner acceptance before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 12 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 identifies the main change: preventing a paired web client’s server from being listed again as Desktop.
Description check Passed The description is complete and follows the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, scope, and checklist status.
Linked Issues check Passed Issue #32415 requires one Automations-page row per automation for a paired browser and headless orca serve host. The catalog now finds desktopAliasEnvironmentId, omits the duplicate Desktop author…
Out of Scope Changes check Passed The changes stay connected to issue #32415. Filter folding, SSH hydration, create-host selection, and run-link resolution support the folded host catalog and prevent stale or duplicate Desktop paths. …
Full details: Linked Issues check

Explanation

Issue #32415 requires one Automations-page row per automation for a paired browser and headless orca serve host. The catalog now finds desktopAliasEnvironmentId, omits the duplicate Desktop authority, and retains the paired runtime entry. The added tests verify one runtime entry, no Desktop list request, and saved Desktop filter resolution. The implementation also resolves local run links to the paired runtime, which keeps navigation consistent with the catalog.

Full details: Out of Scope Changes check

Explanation

The changes stay connected to issue #32415. Filter folding, SSH hydration, create-host selection, and run-link resolution support the folded host catalog and prevent stale or duplicate Desktop paths. The changes are renderer-only and add focused automated tests. No unrelated product area or protocol change is demonstrated.

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.

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

Reviewing files that changed from the base of the PR and between cedce2a and c3ff267.

Files selected for processing: 12
  • src/renderer/src/components/automations/automation-host-catalog-source.ts
  • src/renderer/src/components/automations/automation-host-catalog-types.ts
  • src/renderer/src/components/automations/automation-host-catalog.test.ts
  • src/renderer/src/components/automations/automation-host-catalog.ts
  • src/renderer/src/components/automations/automation-host-client.test.ts
  • src/renderer/src/components/automations/automation-host-client.ts
  • src/renderer/src/components/automations/automation-host-filter-resolution.ts
  • src/renderer/src/components/automations/use-automation-host-catalog-source-state.ts
  • src/renderer/src/components/automations/use-automation-host-catalog.test.tsx
  • src/renderer/src/components/automations/use-automation-host-catalog.ts
  • src/renderer/src/components/automations/use-automation-run-page-state.ts
  • src/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] : []),

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.

🎯 Functional Correctness | Minor | ⚡ Quick win

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.

Comment on lines +85 to +91
// 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]

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.

🎯 Functional Correctness | Minor | ⚡ Quick win

🔎 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

@nwparker
nwparker merged commit 71be80c into main Oct 24, 2026
32 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]: Automations on a headless orca serve host are listed twice in the web client (Local Linux + Orca Server)

1 participant