Skip to content

Update paired Orca servers from the active client - #9839

Merged
OrcaWin merged 15 commits into
mainfrom
propagate-updates
Jul 23, 2026
Merged

OrcaWin merged 15 commits into
mainfrom
propagate-updates

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds capability-gated remote updates for paired Remote Orca Servers so one active Orca client can review and update multiple servers without visiting each host individually.

  • advertises updater.remote-control.v1 with app version and safe install support in runtime status
  • adds updater status/check/download/install RPCs while keeping mobile-scoped credentials denied
  • inventories mixed current, legacy, offline, manual, and update-eligible servers
  • runs at most two server updates concurrently and persists progress/errors/completion globally
  • proves success only after a different runtime ID reconnects on the target-or-newer version
  • exposes the workflow in Settings > General > Updates, Settings > Remote Orca Servers, a global review dialog, and the status bar

Rollout and safety

Older servers do not advertise the capability, so the client directs users to update them manually once before remote updates become available. Direct foreground/service-managed headless servers remain manual unless launched by the existing update-capable supervisor; Orca never kills a server that it cannot safely replace. Development/source builds also remain manual.

RC clients request prerelease checks so they can propagate their own channel. Stable clients remain on stable checks.

No runtime protocol bump is required because all status fields and RPC usage are capability-gated and optional.

Validation

  • pnpm tc
  • changed-file oxlint, including type-aware switch exhaustiveness
  • pnpm run lint:react-doctor:changed
  • pnpm run verify:localization-catalog
  • pnpm run check:max-lines-ratchet
  • git diff --check
  • 55 focused tests across shared version logic, updater adapter/RPCs, mobile authorization, mixed inventory, bounded orchestration, reconnect proof, CLI status, and headless install safety
  • production desktop and web bundles built successfully
  • live dev Orca paired to a second real orca serve instance; runtime capability/status and both Settings surfaces were inspected
  • expanded the AppImage Docker pairing matrix to assert app version, capability, and safe manual-service fallback

The AppImage Docker matrix could not be executed locally because macOS-to-Linux ARM64 native dependency rebuilding failed before a current AppImage could be packaged. node --check passes for the updated matrix script.

Repository-wide pnpm lint reaches an unrelated existing exhaustive-switch error at src/renderer/src/components/skills/skill-freshness-group.tsx:101. Localization coverage likewise reports only three unrelated AI Vault strings.

Related work

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds remote server update contracts and capability metadata, shared version comparison utilities, main-process updater adapters and RPC methods, renderer-side update coordination with bounded concurrency, Zustand state, and integration tests. The renderer gains settings, per-server, dialog, and status-bar update interfaces, with update lifecycle and error messages added across supported locale catalogs.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, safety, validation, and related work, but it omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots or 'No visual change', an AI review report, a security audit, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: updating paired Orca servers from an active client.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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: 4

🧹 Nitpick comments (4)
src/shared/app-version.ts (1)

47-52: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Invalid version input silently resolves to "equal" with no explanatory comment.

When either input fails to parse, compareAppVersions returns 0 (treated as equal) rather than surfacing the failure. Since this comparator now backs remote-update eligibility/target-version reconciliation across paired servers, a malformed appVersion reported by a peer would silently be treated as "already up to date" instead of flagging an error. As per coding guidelines, non-obvious constraints like this fallback should have a short "why" comment; consider also whether callers should validate with isValidAppVersion first or whether this function should signal invalid input more explicitly.

Source: Coding guidelines

src/renderer/src/runtime/remote-server-update-coordinator.ts (1)

86-144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

inspectRemoteServerUpdate's offline error is unmapped/untranslated, unlike runRemoteServerUpdate's failures.

} catch (error) { return { ...base, phase: 'offline', error: error instanceof Error ? error.message : String(error) } } This surfaces a raw, potentially non-localized/technical error string (e.g. "connection refused") directly, whereas runRemoteServerUpdate's failures are consistently routed through remoteServerUpdateErrorMessage for localized copy. Consider mapping known offline causes through the same helper (or a generic localized "server unreachable" fallback) for consistency across locales.

src/renderer/src/App.tsx (1)

348-350: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Lazy dialog is mounted unconditionally, defeating the lazy split.

RemoteServerUpdateDialog is lazy()-loaded but mounted unconditionally at the App root (unlike shouldMountAddRepoDialog/shouldMountUpdateCard/shouldMountFloatingTerminalPanel, which gate their lazy Suspense children). Since Suspense triggers the dynamic import as soon as it renders — independent of the dialog's internal open prop — this chunk is fetched on every app launch, even for users with no paired remote servers.

Either gate the mount on some readiness signal (e.g. only mount once remoteServerUpdateDialogOpen has been true, or once remoteServerUpdates.size > 0) so the fetch is actually deferred, or drop lazy() since it's always mounted anyway.

Also applies to: 2541-2549

src/renderer/src/components/status-bar/RemoteServerUpdateStatusSegment.tsx (1)

18-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a brief "why" comment for the phase list.

updateCohort's phase list is a non-obvious selection (excludes 'available'/'current'/'checking' and 'manual'/'offline') used to compute the "X/Y" progress ratio while running. A short comment on why these six phases specifically represent "this update batch" would help future maintainers.

As per coding guidelines: "**/*.{ts,tsx}: For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8d8c0d0e-1ee8-48cb-af2a-d2ceccc27071

📥 Commits

Reviewing files that changed from the base of the PR and between f9f3cd2 and 3214263.

📒 Files selected for processing (46)
  • config/scripts/run-headless-linux-pairing-docker.mjs
  • src/cli/runtime/client.ts
  • src/cli/runtime/status.ts
  • src/cli/runtime/websocket-transport.test.ts
  • src/main/index.ts
  • src/main/runtime/mobile-rpc-allowlist.test.ts
  • src/main/runtime/remote-server-updater.test.ts
  • src/main/runtime/remote-server-updater.ts
  • src/main/runtime/rpc/errors.test.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/index.ts
  • src/main/runtime/rpc/methods/status.ts
  • src/main/runtime/rpc/methods/updater.test.ts
  • src/main/runtime/rpc/methods/updater.ts
  • src/main/updater-fallback.ts
  • src/main/updater.headless-serve-install.test.ts
  • src/main/updater.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/components/settings/GeneralRemoteServerUpdates.tsx
  • src/renderer/src/components/settings/GeneralUpdateSettingsSection.tsx
  • src/renderer/src/components/settings/RemoteServerUpdateDialog.tsx
  • src/renderer/src/components/settings/RemoteServerUpdateStatus.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/components/status-bar/RemoteServerUpdateStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/remote-server-update-batch.ts
  • src/renderer/src/runtime/remote-server-update-coordinator.test.ts
  • src/renderer/src/runtime/remote-server-update-coordinator.ts
  • src/renderer/src/runtime/remote-server-update-errors.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/diffComments.test.ts
  • src/renderer/src/store/slices/remote-server-updates.integration.test.ts
  • src/renderer/src/store/slices/remote-server-updates.ts
  • src/renderer/src/store/slices/store-test-helpers.ts
  • src/renderer/src/store/types.ts
  • src/shared/app-version.test.ts
  • src/shared/app-version.ts
  • src/shared/execution-host-registry.ts
  • src/shared/protocol-version.ts
  • src/shared/remote-server-update.ts
  • src/shared/runtime-types.ts

Comment thread src/main/runtime/rpc/methods/updater.ts Resolved
Comment on lines +95 to +112
export function getRemoteServerManualUpdateHelp(entry: RemoteServerUpdateEntry): string {
if (entry.support?.reason === 'manual-service-update-required') {
return translate(
'auto.components.settings.RemoteServerUpdateStatus.serviceManagerHelp',
'Update Orca through the service manager that starts this server.'
)
}
if (entry.support?.reason === 'unpackaged-build') {
return translate(
'auto.components.settings.RemoteServerUpdateStatus.unpackedHelp',
'Development builds must be updated from their source checkout.'
)
}
return translate(
'auto.components.settings.RemoteServerUpdateStatus.legacyHelp',
'Update this server manually once to enable remote updates.'
)
}

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -A 20 "RemoteServerUpdateSupport" src/renderer/src/runtime/remote-server-update-coordinator.ts

Repository: stablyai/orca

Length of output: 1628


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== shared type =="
rg -n -A 80 -B 20 "type RemoteServerUpdateSupport|interface RemoteServerUpdateSupport|export .*RemoteServerUpdateSupport" src/shared src/renderer/src | sed -n '1,220p'

echo
echo "== manual help usages =="
rg -n -A 6 -B 2 "manual-service-update-required|unpackaged-build|legacyHelp|getRemoteServerManualUpdateHelp" src | sed -n '1,260p'

Repository: stablyai/orca

Length of output: 17392


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== RemoteServerUpdateStatus context =="
sed -n '1,180p' src/renderer/src/components/settings/RemoteServerUpdateStatus.tsx

echo
echo "== updater-unavailable occurrences =="
rg -n -A 6 -B 3 "updater-unavailable|legacyHelp|serviceManagerHelp|unpackedHelp" src/main src/renderer/src src/shared | sed -n '1,260p'

echo
echo "== manual phase condition =="
rg -n -A 10 -B 10 "phase === 'manual'|manual' :" src/renderer/src/components/settings src/renderer/src/runtime | sed -n '1,220p'

Repository: stablyai/orca

Length of output: 22615


Handle updater-unavailable explicitly

RemoteServerUpdateSupport.reason only has available, manual-service-update-required, unpackaged-build, and updater-unavailable. The current fallback text is misleading for updater-unavailable because it suggests a one-time manual update can enable remote updates, which may never be true here. Add a dedicated message for that reason.

Comment thread src/shared/app-version.ts
Comment on lines +30 to +44
function compareIdentifiers(left: string, right: string): number {
const leftNumeric = /^\d+$/.test(left)
const rightNumeric = /^\d+$/.test(right)

if (leftNumeric && rightNumeric) {
return Number(left) - Number(right)
}
if (leftNumeric) {
return -1
}
if (rightNumeric) {
return 1
}
return left.localeCompare(right)
}

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files src/shared/app-version.ts
wc -l src/shared/app-version.ts
cat -n src/shared/app-version.ts | sed -n '1,220p'

Repository: stablyai/orca

Length of output: 3196


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "compareAppVersions|isPrereleaseAppVersion|isValidAppVersion|compareIdentifiers" src test . || true

Repository: stablyai/orca

Length of output: 6842


🏁 Script executed:

node - <<'JS'
const pairs = [
  ['a', 'B'],
  ['B', 'a'],
  ['rc', 'beta'],
  ['RC', 'rc'],
  ['z', 'A'],
];
for (const [l, r] of pairs) {
  console.log(`${l} vs ${r}: < ${l < r}, > ${l > r}, localeCompare ${l.localeCompare(r)}`);
}
console.log('Intl default locale:', new Intl.DateTimeFormat().resolvedOptions().locale);
JS

Repository: stablyai/orca

Length of output: 390


Use ASCII comparison for prerelease identifiers

localeCompare is locale-sensitive, so it can diverge from semver’s required ASCII ordering for non-numeric prerelease parts and produce different version ordering across environments. Use a plain bytewise comparison here instead.

🔧 Proposed fix
-  return left.localeCompare(right)
+  return left < right ? -1 : left > right ? 1 : 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function compareIdentifiers(left: string, right: string): number {
const leftNumeric = /^\d+$/.test(left)
const rightNumeric = /^\d+$/.test(right)
if (leftNumeric && rightNumeric) {
return Number(left) - Number(right)
}
if (leftNumeric) {
return -1
}
if (rightNumeric) {
return 1
}
return left.localeCompare(right)
}
function compareIdentifiers(left: string, right: string): number {
const leftNumeric = /^\d+$/.test(left)
const rightNumeric = /^\d+$/.test(right)
if (leftNumeric && rightNumeric) {
return Number(left) - Number(right)
}
if (leftNumeric) {
return -1
}
if (rightNumeric) {
return 1
}
return left < right ? -1 : left > right ? 1 : 0
}

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

🧹 Nitpick comments (1)
src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx (1)

393-399: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document why the effect is keyed by joined IDs.

The derived string deliberately avoids rerunning on every recreated environments array; add a concise why-comment.

Proposed clarification
+  // Why: only paired-server membership changes require an update re-check;
+  // `environments` is recreated on every load.
   const environmentIdsKey = environments.map((environment) => environment.id).join('\n')

As per coding guidelines, “For non-obvious TypeScript code, add a concise comment explaining why the constraint exists, not how the code works.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fbfb2391-4720-402b-8fc8-275661861121

📥 Commits

Reviewing files that changed from the base of the PR and between 3214263 and cd2b88c.

📒 Files selected for processing (7)
  • src/renderer/src/components/settings/GeneralRemoteServerUpdates.tsx
  • src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json

OrcaWin added 3 commits July 21, 2026 22:56
# Conflicts:
#	src/main/runtime/rpc/errors.ts
#	src/main/runtime/rpc/methods/index.ts
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
#	src/shared/protocol-version.ts
# Conflicts:
#	src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx
@AmethystLiang AmethystLiang added the orca-remote-server Remote Orca Server / orca serve / paired remote runtime label Jul 22, 2026
@OrcaWin
OrcaWin merged commit 0326594 into main Jul 23, 2026
7 checks passed
@OrcaWin
OrcaWin deleted the propagate-updates branch July 23, 2026 01:53
scastanoh21 added a commit to scastanoh21/orca that referenced this pull request Jul 27, 2026
Reconcile three independent takes on the updater RPC:
- main (PR stablyai#9839) shipped `remote-server-updater` (snapshot with app version +
  install-mode support, wired for paired/remote runtimes).
- this branch (Brennan) added revision-based long-polling (`updater.wait`) plus
  server-side attach-to-in-progress-download and an install-readiness guard.
- earlier work added the SSH-aware `orca update`/`version` CLI.

Resolution keeps main's remote-server-updater as the base and folds Brennan's
efficiency + attach work onto it:
- `RemoteServerUpdaterSnapshot` gains a monotonic `revision`; add
  `RemoteServerUpdaterWaitResult` and a `wait` adapter method.
- `src/main/updater.ts`: track a status revision, add `waitForRemoteServerUpdate`
  (revision long-poll with abort), and attach to an in-flight download on check.
- `updater.wait` RPC method (registered as a long-poll) + adapter wiring in
  `index.ts`; drop the now-superseded `UpdateStatus{Snapshot,WaitResult}` types.
- CLI: event-driven `waitForStatus` over `updater.wait`, reading the snapshot
  first to gate on `support.automatic` (dev/headless-serve/unavailable get
  guidance instead of a thrown RPC), version from the snapshot's appVersion.

Verified: tc:cli, tc:node, tc:web, build:cli, oxlint, and the scoped updater
vitest suites pass. Pre-existing (main) updater.test.ts failures in this Node-26
sandbox are unrelated and reproduce on origin/main.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

orca-remote-server Remote Orca Server / orca serve / paired remote runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants