Repository navigation
fix: proxy skill discovery and preflight checks to remote runtime when connected - #6938
croakingtoad wants to merge 5 commits into
Conversation
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit f09051adf9828bf121c1b6b9bf6feac1aedf5e9a on Jun 30, 2026 8:56pm UTC. |
📝 WalkthroughWalkthroughThis change updates main-process IPC preflight and skills handlers to proxy selected checks to an active remote runtime environment when 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 2
🧹 Nitpick comments (1)
src/main/ipc/preflight.test.ts (1)
90-91: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for the active remote runtime branch.
The shared
mockStorealways returnsactiveRuntimeEnvironmentId: null, so the newcallRuntimeEnvironment('preflight.check', ...)path is untested. Add a test with a truthy runtime id that asserts the RPC params and returned status.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 991b817b-e17d-4a27-845d-3fe7371bec46
📥 Commits
Reviewing files that changed from the base of the PR and between e8f2994 and f09051adf9828bf121c1b6b9bf6feac1aedf5e9a.
📒 Files selected for processing (5)
src/main/ipc/preflight.test.tssrc/main/ipc/preflight.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/skills.tssrc/shared/skills.ts
| // Why: when connected to a remote Orca runtime the skill files live on | ||
| // the server, not on the local host. Proxy to the server's RPC method so | ||
| // discovery scans the correct filesystem. Prefer an explicit environmentId | ||
| // from the caller, then fall back to the persisted active environment. | ||
| const environmentId = | ||
| target?.environmentId?.trim() || store.getSettings().activeRuntimeEnvironmentId?.trim() | ||
| if (environmentId) { | ||
| const response = await callRuntimeEnvironment( | ||
| app.getPath('userData'), | ||
| environmentId, | ||
| 'skills.discover', | ||
| target, | ||
| 15_000 | ||
| ) | ||
| if (response.ok) { | ||
| return response.result as SkillDiscoveryResult | ||
| } | ||
| return { skills: [], sources: [], scannedAt: Date.now() } | ||
| } | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Remote proxy failures are silently swallowed with no logging.
When response.ok is false, the handler returns an empty SkillDiscoveryResult with no log/diagnostic of why the proxy call failed — this can reproduce the very symptom this PR fixes (skills/tools appearing "not installed") whenever the remote call fails transiently (auth, malformed response, server error), just for a different root cause. Additionally, callRuntimeEnvironment can reject on connection failures rather than resolve ok:false (per its own implementation), and that path isn't caught here, so the IPC call instead throws — an inconsistent failure mode compared to the swallowed ok:false branch.
🪵 Proposed fix: log failures and unify error handling
if (environmentId) {
- const response = await callRuntimeEnvironment(
- app.getPath('userData'),
- environmentId,
- 'skills.discover',
- target,
- 15_000
- )
- if (response.ok) {
- return response.result as SkillDiscoveryResult
- }
- return { skills: [], sources: [], scannedAt: Date.now() }
+ try {
+ const response = await callRuntimeEnvironment(
+ app.getPath('userData'),
+ environmentId,
+ 'skills.discover',
+ target,
+ 15_000
+ )
+ if (response.ok) {
+ return response.result as SkillDiscoveryResult
+ }
+ console.error('skills:discover remote proxy returned a non-ok response', response)
+ } catch (error) {
+ console.error('skills:discover remote proxy call failed', error)
+ }
+ return { skills: [], sources: [], scannedAt: Date.now() }
}📝 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.
| // Why: when connected to a remote Orca runtime the skill files live on | |
| // the server, not on the local host. Proxy to the server's RPC method so | |
| // discovery scans the correct filesystem. Prefer an explicit environmentId | |
| // from the caller, then fall back to the persisted active environment. | |
| const environmentId = | |
| target?.environmentId?.trim() || store.getSettings().activeRuntimeEnvironmentId?.trim() | |
| if (environmentId) { | |
| const response = await callRuntimeEnvironment( | |
| app.getPath('userData'), | |
| environmentId, | |
| 'skills.discover', | |
| target, | |
| 15_000 | |
| ) | |
| if (response.ok) { | |
| return response.result as SkillDiscoveryResult | |
| } | |
| return { skills: [], sources: [], scannedAt: Date.now() } | |
| } | |
| // Why: when connected to a remote Orca runtime the skill files live on | |
| // the server, not on the local host. Proxy to the server's RPC method so | |
| // discovery scans the correct filesystem. Prefer an explicit environmentId | |
| // from the caller, then fall back to the persisted active environment. | |
| const environmentId = | |
| target?.environmentId?.trim() || store.getSettings().activeRuntimeEnvironmentId?.trim() | |
| if (environmentId) { | |
| try { | |
| const response = await callRuntimeEnvironment( | |
| app.getPath('userData'), | |
| environmentId, | |
| 'skills.discover', | |
| target, | |
| 15_000 | |
| ) | |
| if (response.ok) { | |
| return response.result as SkillDiscoveryResult | |
| } | |
| console.error('skills:discover remote proxy returned a non-ok response', response) | |
| } catch (error) { | |
| console.error('skills:discover remote proxy call failed', error) | |
| } | |
| return { skills: [], sources: [], scannedAt: Date.now() } | |
| } |
f09051a to
629e4cb
Compare
Maintainer takeover of PR stablyai#6938: - Handle the unreachable-host rejection (callRuntimeEnvironment rejects rather than resolving ok:false) in both handlers. - Never fall back to the local scan while a remote runtime is active: skills returns an empty result; preflight fails loud. Both log the failure. Mirrors the web client's skills.discover/preflight.check. - Harden Landing.tsx preflight callers with .catch() now that preflight can reject. - Drop the speculative unused SkillDiscoveryTarget.environmentId field. - Add unit coverage for both remote branches (success, ok:false, unreachable, and no-environment local path) in skills.test.ts and preflight.test.ts. Co-authored-by: Orca <[email protected]>
|
Maintainer takeover — thanks @croakingtoad for the original fix and the clear write-up. I've taken ownership, rebased onto latest DescriptionThe bug. When a desktop client is paired to a remote Orca runtime (
The renderer store slice already routed these to the remote RPC via The fix. Both handlers now read What I changed on top of the original diff (
EvidenceReproduction (unit). Reverted only the two handler source files to the pre-fix base ( Gates (after rebase onto
The original author validated the skills half end-to-end against a live remote ELI5When your editor is "plugged into" another computer over the network, it was checking your own laptop for installed tools and skills instead of the computer it's plugged into — so things that were installed over there looked missing. Now it asks the right computer. And if that computer can't be reached, it quietly says "couldn't check" instead of lying that your local tools are the remote's. Trade-offs
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/main/ipc/preflight.ts (1)
287-299: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRemote preflight payload still drops WSL/project-runtime context.
The
ok:falsefallback-to-local issue from the earlier review was fixed (now throws instead of falling back), but the other half of that comment is still open: Line 293 forwards only{ force: args?.force }, droppingwslDistro,wslDefault, andprojectRuntimefromargsbefore proxying to the remote runtime. If the remotepreflight.checkRPC relies on this context (e.g., to select the correct shell/runtime for a specific worktree), the remote check may run with the wrong context or silently ignore it. This is the same root cause raised previously; the payload half of that fix wasn't applied.🐛 Proposed fix to forward full context
const response = await callRuntimeEnvironment( app.getPath('userData'), environmentId, 'preflight.check', - { force: args?.force }, + args ?? {}, 15_000 ).catch((error: unknown) => {Note:
preflight.test.ts(lines 182-188) asserts the current{ force: true }-only payload, so it would need updating alongside this fix.
🧹 Nitpick comments (1)
src/renderer/src/components/Landing.tsx (1)
244-257: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winSilently swallowed rejections lose observability and also mask
.thenhandler bugs.
.catch(() => {})here catches both the intended case (remote host unreachable) and any error thrown inside the preceding.thenhandler (e.g., a bug ingetLandingPreflightIssues), with no logging either way. The main-process side of this same "remote unreachable" scenario (src/main/ipc/preflight.ts) logs viaconsole.warnbefore failing; consider doing the same here for debuggability, and preferably only swallow the check-rejection case rather than the whole chain.♻️ Suggested logging addition (applies to both call sites)
.catch(() => {}) + .catch((error: unknown) => { + console.warn('[Landing] preflight check unavailable:', error) + })Also applies to: 289-302
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4475ebf5-8647-4091-baa6-4befd93b34fb
📒 Files selected for processing (6)
src/main/ipc/preflight.test.tssrc/main/ipc/preflight.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/skills.test.tssrc/main/ipc/skills.tssrc/renderer/src/components/Landing.tsx
|
Reviewed this end-to-end and verified it against the source (server RPCs, the web-client contract, and the I pushed one follow-up commit ( Minor: the PR description says it adds |
|
Taking a look! |
When a remote Orca server is active, skill files live on the server filesystem, not the local client. The skills:discover IPC handler was always scanning the local host, so skills installed on the server were never detected as installed in Settings. Fix: read activeRuntimeEnvironmentId from persisted settings and, when present, forward the discovery call to the server's skills.discover RPC method via callRuntimeEnvironment instead of scanning locally.
…nnected When a remote Orca server is active, git and gh are installed on the server, not the local Windows client. The preflight:check IPC handler was always running detection locally, so gh showed as not installed. Fix: read activeRuntimeEnvironmentId from persisted settings and, when present, forward the check to the server's preflight.check RPC via callRuntimeEnvironment. Also adds environmentId to SkillDiscoveryTarget to allow explicit per-call override in addition to the settings fallback.
Maintainer takeover of PR stablyai#6938: - Handle the unreachable-host rejection (callRuntimeEnvironment rejects rather than resolving ok:false) in both handlers. - Never fall back to the local scan while a remote runtime is active: skills returns an empty result; preflight fails loud. Both log the failure. Mirrors the web client's skills.discover/preflight.check. - Harden Landing.tsx preflight callers with .catch() now that preflight can reject. - Drop the speculative unused SkillDiscoveryTarget.environmentId field. - Add unit coverage for both remote branches (success, ok:false, unreachable, and no-environment local path) in skills.test.ts and preflight.test.ts. Co-authored-by: Orca <[email protected]>
detectAgents/refreshAgents still scanned the local filesystem while a remote runtime was active, so a remote user's installed-AI-CLI list was as wrong as the skills/gh/git/glab status this PR already fixes. Proxy both to the server's preflight.detectAgents/refreshAgents RPCs, mirroring the web client's empty-on-error fallback. Extract the three remote-runtime proxy helpers (check/detect/refresh) into preflight-remote-runtime.ts to keep preflight.ts under max-lines without a disable. Co-authored-by: Orca <[email protected]>
a3d80c4 to
333900d
Compare
|
Maintainer follow-up complete — thanks again for the original fix. I rebased the branch onto current main and resolved the skill-discovery conflicts while preserving main’s newer target validation and freshness inventory behavior. The active remote runtime now owns skills, CLI preflight, and agent detection; remote failures never fall back to misleading local state. I also applied the review nit so Landing logs only preflight transport failures instead of swallowing downstream processing bugs. Validation is clean: 58 IPC tests plus 6 RPC contract tests, full typecheck, touched-file oxlint/oxfmt, React Doctor, and the max-lines ratchet. Pushed to fix/remote-skill-discovery for final review; not merging. |
|
Thanks for digging into this — your root-cause writeup is correct, and the end-to-end check you did against a real Ubuntu We're consolidating the skills half onto #6887, which fixes the same bug from the renderer side. Not a knock on this patch; the two approaches diverge on three things that pushed us that way:
There's also a subtlety we hit ourselves in review: Your preflight half is the part we'd like to keep, and it's untouched by #6887 —
Leaving this open for now pending a maintainer decision on how to land the preflight work. |
|
Opened #11390 for the preflight half, but scoped differently than requested here — worth flagging why, since it turns on something not visible from this PR's diff.
On the wider blast radius you raised for Verified against the shipped v1.4.161 build, not just source. Happy for you to close this whenever #6887 lands — leaving it open since you mentioned a pending decision. |
|
Closing this as superseded by #6887, which landed the skill-discovery half. Your diagnosis was right and matched theirs independently — on a desktop client paired to Three things decided it in favour of the other approach, all about where the routing lives rather than whether the fix was right:
The preflight half is worth keeping, and nothing has superseded it —
You'd flagged that this wasn't end-to-end validated, so a smaller PR scoped to preflight would also be easier to get real evidence for. Thanks for the work here. |
Summary
When a client is connected to a remote Orca server via
orca serve, two key checks always ran against the local client's filesystem instead of the server — making installed skills and tools (gh, git, glab) appear as "Not installed" regardless of what's on the server.Root cause. Both the
skills:discoverandpreflight:checkIPC handlers are registered on the client's main process and call local functions (discoverSkills,runPreflightCheck). When a remote runtime is active, the relevant files live on the server, not on the client. Neither handler had any awareness ofactiveRuntimeEnvironmentId.Fix. In both handlers, read
activeRuntimeEnvironmentIdfrom the persisted settings. When set, forward the call to the server's corresponding RPC method (skills.discover/preflight.check) viacallRuntimeEnvironmentinstead of running locally. The existing server-side RPC methods already handle these checks correctly on the server's filesystem — they just weren't being called.Also adds an optional
environmentIdfield toSkillDiscoveryTargetfor callers that want to explicitly target a specific environment.Changes
src/main/ipc/skills.ts— proxyskills:discoverto remote whenactiveRuntimeEnvironmentIdis setsrc/main/ipc/preflight.ts— proxypreflight:checkto remote whenactiveRuntimeEnvironmentIdis set; acceptsstoreparametersrc/main/ipc/register-core-handlers.ts— passstoretoregisterPreflightHandlerssrc/shared/skills.ts— add optionalenvironmentIdtoSkillDiscoveryTargetsrc/main/ipc/preflight.test.ts— update tests for newstoreparameterTesting
pnpm run typecheck— passes cleanpnpm run build:electron-vite— builds successfully on v1.4.110 source baseSkills fix — validated end-to-end against a remote
orca serveinstance on Ubuntu 22.04 (Tailscale): skills installed on the server (orchestration,computer-use) correctly show as Installed in Settings after patchingout/main/index.js.Preflight fix — not end-to-end validated. Electron's asar integrity checks (SHA256 per-file hashes in the header) prevented us from patching a live client to test the
ghCLI detection fix. The fix follows the identical pattern as the validated skills fix and targets the sameactiveRuntimeEnvironmentId→callRuntimeEnvironmentpath, but reviewer validation against a live remote connection would be appreciated.Fixes #6789 (partial — the
selector_not_foundpath was fixed in #6816; this addresses the remaining "Not installed" status issue after successful installation)ELI5
When you use a remote Orca server, skill and tool checks were still looking at your local machine. This routes those checks to the remote server so installed skills and tools show up correctly.