Repository navigation
Update paired Orca servers from the active client - #9839
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (4)
src/shared/app-version.ts (1)
47-52: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winInvalid version input silently resolves to "equal" with no explanatory comment.
When either input fails to parse,
compareAppVersionsreturns0(treated as equal) rather than surfacing the failure. Since this comparator now backs remote-update eligibility/target-version reconciliation across paired servers, a malformedappVersionreported 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 withisValidAppVersionfirst 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, unlikerunRemoteServerUpdate'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 throughremoteServerUpdateErrorMessagefor 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 winLazy dialog is mounted unconditionally, defeating the lazy split.
RemoteServerUpdateDialogislazy()-loaded but mounted unconditionally at the App root (unlikeshouldMountAddRepoDialog/shouldMountUpdateCard/shouldMountFloatingTerminalPanel, which gate their lazy Suspense children). Since Suspense triggers the dynamic import as soon as it renders — independent of the dialog's internalopenprop — 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
remoteServerUpdateDialogOpenhas been true, or onceremoteServerUpdates.size > 0) so the fetch is actually deferred, or droplazy()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 valueAdd 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
📒 Files selected for processing (46)
config/scripts/run-headless-linux-pairing-docker.mjssrc/cli/runtime/client.tssrc/cli/runtime/status.tssrc/cli/runtime/websocket-transport.test.tssrc/main/index.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/remote-server-updater.test.tssrc/main/runtime/remote-server-updater.tssrc/main/runtime/rpc/errors.test.tssrc/main/runtime/rpc/errors.tssrc/main/runtime/rpc/methods/index.tssrc/main/runtime/rpc/methods/status.tssrc/main/runtime/rpc/methods/updater.test.tssrc/main/runtime/rpc/methods/updater.tssrc/main/updater-fallback.tssrc/main/updater.headless-serve-install.test.tssrc/main/updater.tssrc/renderer/src/App.tsxsrc/renderer/src/components/settings/GeneralRemoteServerUpdates.tsxsrc/renderer/src/components/settings/GeneralUpdateSettingsSection.tsxsrc/renderer/src/components/settings/RemoteServerUpdateDialog.tsxsrc/renderer/src/components/settings/RemoteServerUpdateStatus.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/status-bar/RemoteServerUpdateStatusSegment.tsxsrc/renderer/src/components/status-bar/StatusBar.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/remote-server-update-batch.tssrc/renderer/src/runtime/remote-server-update-coordinator.test.tssrc/renderer/src/runtime/remote-server-update-coordinator.tssrc/renderer/src/runtime/remote-server-update-errors.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/remote-server-updates.integration.test.tssrc/renderer/src/store/slices/remote-server-updates.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/types.tssrc/shared/app-version.test.tssrc/shared/app-version.tssrc/shared/execution-host-registry.tssrc/shared/protocol-version.tssrc/shared/remote-server-update.tssrc/shared/runtime-types.ts
| 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.' | ||
| ) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n -A 20 "RemoteServerUpdateSupport" src/renderer/src/runtime/remote-server-update-coordinator.tsRepository: 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.
| 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) | ||
| } |
There was a problem hiding this comment.
🎯 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 . || trueRepository: 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);
JSRepository: 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.
| 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 | |
| } |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/settings/RuntimeEnvironmentsPane.tsx (1)
393-399: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDocument why the effect is keyed by joined IDs.
The derived string deliberately avoids rerunning on every recreated
environmentsarray; 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
📒 Files selected for processing (7)
src/renderer/src/components/settings/GeneralRemoteServerUpdates.tsxsrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/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
# 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
# Conflicts: # src/main/ipc/worktree-common-git-directory.ts # src/main/skills/skill-installation-topology.ts
# Conflicts: # src/shared/protocol-version.ts # src/shared/runtime-types.ts
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]>
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.
updater.remote-control.v1with app version and safe install support in runtime statusRollout 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 tcoxlint, including type-aware switch exhaustivenesspnpm run lint:react-doctor:changedpnpm run verify:localization-catalogpnpm run check:max-lines-ratchetgit diff --checkorca serveinstance; runtime capability/status and both Settings surfaces were inspectedThe 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 --checkpasses for the updated matrix script.Repository-wide
pnpm lintreaches an unrelated existing exhaustive-switch error atsrc/renderer/src/components/skills/skill-freshness-group.tsx:101. Localization coverage likewise reports only three unrelated AI Vault strings.Related work
orca updateandorca versioncommands #9406 adds overlappingupdater.*RPC names for CLI-driven local updates with a different response contract; these contracts should be reconciled before both PRs merge.