Repository navigation
Add remote server update advisor with detection and platform-specific guidance - #9602
AmethystLiang wants to merge 6 commits into
Conversation
Co-authored-by: Orca <[email protected]>
…on in runtime status Co-authored-by: Orca <[email protected]>
…fields Co-authored-by: Orca <[email protected]>
…date advisor Co-authored-by: Orca <[email protected]>
…me environments Co-authored-by: Orca <[email protected]>
- Fetch the server's electron-updater release manifest (latest-*.yml) via a main-process IPC handler, since renderer fetch() hits CORS on GitHub's release-asset redirect. - Parse the manifest in a shared, dependency-free module to derive latestVersion, updateAvailable, and exact deb/rpm asset URLs, which override the server's startup-stale updateInfo hints. - Wire a lazy React hook that only fetches while the advisor shows a server-too-old block, with a short in-memory cache per platform/arch.
📝 WalkthroughWalkthroughAdds a remote runtime update advisor for protocol compatibility blocks. Runtime status now includes cached installation and restart metadata, which is validated before client use. Shared guide generation covers platform-specific update and restart instructions. Release manifests are parsed and fetched through bounded main-process IPC. Compatibility errors retain verdict and status details, while the renderer displays validated guidance, optional release metadata, copyable commands, localized text, and a direct status recheck flow. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6673ddd2-473c-42d4-8c0a-981f4c90a2eb
📒 Files selected for processing (31)
docs/reference/remote-server-update-advisor.mdsrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/runtime-release-manifest.test.tssrc/main/ipc/runtime-release-manifest.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/runtime-install-detection.test.tssrc/main/runtime/runtime-install-detection.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/RuntimeEnvironmentsPane.tsxsrc/renderer/src/components/settings/RuntimeUpdateAdvisor.tsxsrc/renderer/src/components/settings/runtime-update-advisor-model.test.tssrc/renderer/src/components/settings/runtime-update-advisor-model.tssrc/renderer/src/components/settings/use-runtime-release-metadata.tssrc/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/runtime-protocol-compat.test.tssrc/renderer/src/runtime/runtime-protocol-compat.tssrc/shared/runtime-release-manifest.test.tssrc/shared/runtime-release-manifest.tssrc/shared/runtime-types.tssrc/shared/runtime-update-guide-templates.tssrc/shared/runtime-update-guide.test.tssrc/shared/runtime-update-guide.tssrc/shared/runtime-update-info-validation.test.tssrc/shared/runtime-update-info-validation.ts
| async function loadReleaseManifest( | ||
| platform: string | undefined, | ||
| arch: RuntimeUpdateGuideArch | undefined | ||
| ): Promise<ParsedReleaseManifest | null> { | ||
| const key = `${platform ?? ''}:${arch ?? ''}` | ||
| const cached = manifestCache.get(key) | ||
| if (cached && Date.now() - cached.at < CACHE_TTL_MS) { | ||
| return cached.manifest | ||
| } | ||
| const result = await window.api.runtimeReleaseManifest.fetch({ platform, arch }) | ||
| if (!result.ok) { | ||
| return null | ||
| } | ||
| const manifest = parseReleaseManifest(result.yaml) | ||
| if (!manifest) { | ||
| return null | ||
| } | ||
| manifestCache.set(key, { at: Date.now(), manifest }) | ||
| return manifest | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check which preload entrypoints expose runtimeReleaseManifest
rg -nP --type=ts -C2 'runtimeReleaseManifest' src/preload
fd -e ts . src/preload --exec rg -l 'runtimeReleaseManifest' {} \; 2>/dev/null || trueRepository: stablyai/orca
Length of output: 1011
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the release-metadata helper and its caller contract
ast-grep outline src/renderer/src/components/settings/use-runtime-release-metadata.ts --view expanded || true
echo '--- file ---'
sed -n '1,220p' src/renderer/src/components/settings/use-runtime-release-metadata.ts | cat -n
echo '--- advisor usage ---'
rg -n "useRuntimeReleaseMetadata|runtimeReleaseManifest|check\(" src/renderer/src/components/settings src/renderer/src/components -g '!**/dist/**' -g '!**/build/**'Repository: stablyai/orca
Length of output: 9567
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,220p' src/renderer/src/components/settings/use-runtime-release-metadata.ts | cat -nRepository: stablyai/orca
Length of output: 4131
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "window\.api\.(updater|runtimeReleaseManifest)|runtimeReleaseManifest\.fetch|updater\?\.check" src/renderer src/preload src/mobile 2>/dev/null || trueRepository: stablyai/orca
Length of output: 2512
Catch rejected IPC calls here
window.api.runtimeReleaseManifest.fetch(...) can reject, and this effect has no .catch, so the helper can violate its “any failure yields undefined” contract. Wrap the call in try/catch or add a catch so IPC errors fall back cleanly.
Source: Learnings
|
Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-07-22T17:40:01Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes. |
|
Closing as stale: the code it changes no longer exists on main. |
Summary
Implements a remote server update advisor that activates when protocol compatibility blocks a paired Orca server. The advisor detects the server's install kind (Linux AppImage/deb/rpm, macOS app, Windows installer, or source build) and restart method (systemd service, foreground serve, or desktop app) at startup, then provides copyable, platform-specific update guidance. Never executes commands on the remote machine — all guidance is written for the user to paste into their own SSH session.
Covers both block directions from
evaluateRuntimeCompat:server-too-old: shows detection, versions, and copyable update stepsclient-too-old: routes to the local update flow, never server commandsImplementation
Detection & Status
src/main/runtime/runtime-install-detection.ts(pure function core, caching wrapper)installKind,restartKind,serviceName, andinstallPathfrom signals:app.isPackaged,APPIMAGEenv, systemd cgroup, Windows install roots, optional startup package probe/procon the polled status.get pathupdateInfoin runtime status alongside existingruntimeProtocolVersion,capabilities,hostPlatformTrust Model
updateInfofield is untrusted; validated insrc/shared/runtime-update-info-validation.tsbefore useserviceNamematched to^orca[A-Za-z0-9@:._-]{0,75}\.service$(orca-prefixed to prevent steering at unrelated units)installPathvalidated for absolute path,.AppImagesuffix, no traversal, no shell metacharactersunknownClient-Side Guide Matrix
src/shared/runtime-update-guide.tsmapping(hostPlatform, installKind, restartKind, hostArch)to structured steps + linksmv, systemd restart or foreground proseapt installwith optional asset URL from release metadatadnf installwith optional asset URLRelease Metadata
latest-*.yml) in main process viasrc/main/ipc/runtime-release-manifest.ts(avoids CORS on GitHub redirects)src/shared/runtime-release-manifest.tsto extract version + asset filenamesRenderer UI
src/renderer/src/components/settings/RuntimeUpdateAdvisor.tsx: responsive card for blocked environmentsserver-too-oldrenders detection, versions, copyable command blocks, and docs linksRuntimeEnvironmentsPane.tsxbelow blocked row; also deep-linkable from host menu and compat-block errorsError Threading
src/renderer/src/runtime/runtime-protocol-compat.tsnow carries verdict and status on block errors so advisor can render guidance without re-probingTesting
pnpm typecheck: all new types verifiedpnpm test: comprehensive unit tests for all new modulesSecurity Audit
Input Handling & Command Construction:
serviceName,installPath,currentVersion,latestVersion,docsUrlvalidated with regexes before useinstallKind,restartKind) only accept known values, default tounknown/[\r\n]/) prevents newline smuggling in validated stringsNetwork & IPC:
fetch()would hit CORS on GitHub redirects)Authorization & Execution:
sudoinvocation by the app; user decides privilege escalationCross-Platform:
\, Unix/)Notes
updateInfo(cold-start) via client-only guide matrix; future servers benefit from server-supplied detectiondocs/reference/remote-server-update-advisor.mdcovers motivation, trust model, testing strategy, and deferred questions