Skip to content

fix: proxy skill discovery and preflight checks to remote runtime when connected - #6938

Closed
croakingtoad wants to merge 5 commits into
stablyai:mainfrom
croakingtoad:fix/remote-skill-discovery
Closed

croakingtoad wants to merge 5 commits into
stablyai:mainfrom
croakingtoad:fix/remote-skill-discovery

Conversation

@croakingtoad

@croakingtoad croakingtoad commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

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:discover and preflight:check IPC 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 of activeRuntimeEnvironmentId.

Fix. In both handlers, read activeRuntimeEnvironmentId from the persisted settings. When set, forward the call to the server's corresponding RPC method (skills.discover / preflight.check) via callRuntimeEnvironment instead 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 environmentId field to SkillDiscoveryTarget for callers that want to explicitly target a specific environment.

Changes

  • src/main/ipc/skills.ts — proxy skills:discover to remote when activeRuntimeEnvironmentId is set
  • src/main/ipc/preflight.ts — proxy preflight:check to remote when activeRuntimeEnvironmentId is set; accepts store parameter
  • src/main/ipc/register-core-handlers.ts — pass store to registerPreflightHandlers
  • src/shared/skills.ts — add optional environmentId to SkillDiscoveryTarget
  • src/main/ipc/preflight.test.ts — update tests for new store parameter

Testing

  • pnpm run typecheck — passes clean
  • pnpm run build:electron-vite — builds successfully on v1.4.110 source base

Skills fix — validated end-to-end against a remote orca serve instance on Ubuntu 22.04 (Tailscale): skills installed on the server (orchestration, computer-use) correctly show as Installed in Settings after patching out/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 gh CLI detection fix. The fix follows the identical pattern as the validated skills fix and targets the same activeRuntimeEnvironmentId → callRuntimeEnvironment path, but reviewer validation against a live remote connection would be appreciated.

Fixes #6789 (partial — the selector_not_found path was fixed in #6816; this addresses the remaining "Not installed" status issue after successful installation)


Open in Stage

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.

@ghost

ghost commented Jun 30, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Add environmentId to SkillDiscoveryTarget
2 Proxy skill discovery to remote runtime
3 Proxy preflight checks to remote runtime
4 Update preflight tests for store dependency
Open in Stage

Chapters generated by Stage for commit f09051adf9828bf121c1b6b9bf6feac1aedf5e9a on Jun 30, 2026 8:56pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change updates main-process IPC preflight and skills handlers to proxy selected checks to an active remote runtime environment when activeRuntimeEnvironmentId is set. registerPreflightHandlers now takes a store, registerCoreHandlers passes that store through, and the preflight and skills tests were expanded for remote proxy behavior. The landing component now swallows rejected preflight check promises during refresh and polling.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and testing, but omits several required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing sections and include the required AI review/security details, screenshots or “No visual change,” and a fuller testing checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title matches the main change: routing skills discovery and preflight checks to the remote runtime when connected.

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

🧹 Nitpick comments (1)
src/main/ipc/preflight.test.ts (1)

90-91: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for the active remote runtime branch.

The shared mockStore always returns activeRuntimeEnvironmentId: null, so the new callRuntimeEnvironment('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.ts
  • src/main/ipc/preflight.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/skills.ts
  • src/shared/skills.ts

Comment thread src/main/ipc/preflight.ts Resolved
Comment thread src/main/ipc/skills.ts Outdated
Comment on lines +39 to +58
// 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() }
}

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.

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

Suggested change
// 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() }
}

@nwparker
nwparker force-pushed the fix/remote-skill-discovery branch from f09051a to 629e4cb Compare July 3, 2026 21:27
nwparker added a commit to croakingtoad/orca that referenced this pull request Jul 3, 2026
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]>
@nwparker

nwparker commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Maintainer takeover — thanks @croakingtoad for the original fix and the clear write-up. I've taken ownership, rebased onto latest main, hardened the failure paths, added test coverage, and pushed to this branch. Not merging — this awaits final human review.

Description

The bug. When a desktop client is paired to a remote Orca runtime (orca serve), two main-process IPC handlers scanned the local client filesystem instead of the server:

  • skills:discover → discoverSkills(...) (local), so server-installed skills showed Not installed in Settings → Skills.
  • preflight:check → runPreflightCheck(...) (local), so the Landing banner reported git/gh/glab status for the client, not the server.

The renderer store slice already routed these to the remote RPC via callRuntimeRpc, and the web client already routed them in web-preload-api.ts. But Landing.tsx and SkillsPage.tsx call window.api.preflight.check / window.api.skills.discover directly, hitting the main-process handlers — which had no awareness of activeRuntimeEnvironmentId. That's the gap this PR closes.

The fix. Both handlers now read activeRuntimeEnvironmentId from persisted settings and, when set, proxy to the server RPC (skills.discover / preflight.check) through the existing callRuntimeEnvironment transport, so the check runs against the correct filesystem/shell.

What I changed on top of the original diff (629e4cb):

  • Handled the unreachable-host case. callRuntimeEnvironment rejects on an unreachable host (it only resolves {ok:false} for a structured RPC error). The original diff handled only ok:false, so a network drop propagated an unhandled rejection and surfaced the pre-existing (now-mislabeled) "Could not scan local skills" toast. Both handlers now handle the throw identically to ok:false.
  • Removed the misleading local fallback. On a remote failure preflight:check previously fell back to the local scan — re-introducing exactly this bug in the failure case (local gh/git warnings while remote). It now fails loud (mirrors the web client's createPreflightApi().check, which throws). skills:discover returns an empty result on failure (mirrors createSkillsApi().discover). Both now log the failure.
  • Hardened Landing.tsx — added .catch() to its two direct preflight.check callers so the now-possible rejection can't become an unhandled rejection; the banner keeps its last-known state.
  • Dropped the speculative SkillDiscoveryTarget.environmentId field — it had no caller and the handler already reads the persisted active environment, so this made the two handlers consistent.
  • Added unit coverage for both remote branches (success, ok:false, unreachable-reject, and the no-environment local path) in skills.test.ts and preflight.test.ts — the original diff shipped the remote branch untested.

Evidence

Reproduction (unit). Reverted only the two handler source files to the pre-fix base (01070198fa) while keeping the new tests. The remote-proxy tests fail because the handlers ignore activeRuntimeEnvironmentId and scan locally — the bug:

BEFORE (source reverted to pre-fix base 01070198fa):
 × skills.test.ts  › remote runtime proxying › proxies discovery to the active remote runtime and returns its result
 × skills.test.ts  › remote runtime proxying › returns an empty result (never a local scan) when the remote returns ok:false
 × skills.test.ts  › remote runtime proxying › returns an empty result when the remote host is unreachable
 ✓ skills.test.ts  › remote runtime proxying › runs the local scan when no remote runtime is active
 × preflight.test.ts › preflight:check remote runtime proxying › proxies to the active remote runtime and returns its status
 × preflight.test.ts › preflight:check remote runtime proxying › fails loud on ok:false and never falls back to the local scan
 × preflight.test.ts › preflight:check remote runtime proxying › propagates the rejection when the remote host is unreachable
 ✓ preflight.test.ts › preflight:check remote runtime proxying › runs the local scan when no remote runtime is active
 Test Files  2 failed (2)
      Tests  6 failed | 40 passed (46)
AFTER (fix + polish restored):
 ✓ skills.test.ts  › remote runtime proxying › proxies discovery to the active remote runtime and returns its result
 ✓ skills.test.ts  › remote runtime proxying › returns an empty result (never a local scan) when the remote returns ok:false
 ✓ skills.test.ts  › remote runtime proxying › returns an empty result when the remote host is unreachable
 ✓ skills.test.ts  › remote runtime proxying › runs the local scan when no remote runtime is active
 ✓ preflight.test.ts › preflight:check remote runtime proxying › proxies to the active remote runtime and returns its status
 ✓ preflight.test.ts › preflight:check remote runtime proxying › fails loud on ok:false and never falls back to the local scan
 ✓ preflight.test.ts › preflight:check remote runtime proxying › propagates the rejection when the remote host is unreachable
 ✓ preflight.test.ts › preflight:check remote runtime proxying › runs the local scan when no remote runtime is active
 Test Files  2 passed (2)
      Tests  46 passed (46)

Gates (after rebase onto main):

  • pnpm tc (tsgo node + cli + web) — clean, exit 0
  • oxlint on changed files + repo pre-commit hook (oxlint + react-doctor + oxfmt) — clean
  • pnpm vitest run src/main/ipc/skills.test.ts src/main/ipc/preflight.test.ts — 46 passed

The original author validated the skills half end-to-end against a live remote orca serve on Ubuntu 22.04 (Tailscale) — server-installed skills correctly showed Installed. I did not have an affected remote host to re-run the live gh/git preflight exercise, so this takeover proves the routing + failure semantics at the unit level; the code path is identical to the author's validated skills path.

ELI5

When 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

  • No change to the common local (non-remote) path — the proxy is behind if (environmentId); with no active runtime environment, everything runs locally exactly as before (covered by a regression test).
  • Behavior change only on remote failure: previously preflight:check silently showed local git/gh status when the remote call failed; it now fails loud and the Landing banner keeps its last-known state (no false local warnings). skills:discover shows "no skills" rather than throwing the mislabeled local-scan toast. Both log the failure for diagnosis.
  • Provider-agnostic: the git-provider preflight logic (GitLab/Bitbucket/Azure/Gitea) is unchanged — it just runs on the server now, so remote provider status is reported correctly.
  • No new dependencies, no new network endpoints, no secret/token reads — reuses the existing paired-runtime transport and the persisted activeRuntimeEnvironmentId.

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

♻️ Duplicate comments (1)
src/main/ipc/preflight.ts (1)

287-299: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remote preflight payload still drops WSL/project-runtime context.

The ok:false fallback-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 }, dropping wslDistro, wslDefault, and projectRuntime from args before proxying to the remote runtime. If the remote preflight.check RPC 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 win

Silently swallowed rejections lose observability and also mask .then handler bugs.

.catch(() => {}) here catches both the intended case (remote host unreachable) and any error thrown inside the preceding .then handler (e.g., a bug in getLandingPreflightIssues), with no logging either way. The main-process side of this same "remote unreachable" scenario (src/main/ipc/preflight.ts) logs via console.warn before 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

📥 Commits

Reviewing files that changed from the base of the PR and between 99d61b1 and 629e4cb.

📒 Files selected for processing (6)
  • src/main/ipc/preflight.test.ts
  • src/main/ipc/preflight.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/skills.test.ts
  • src/main/ipc/skills.ts
  • src/renderer/src/components/Landing.tsx

@nwparker

nwparker commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Reviewed this end-to-end and verified it against the source (server RPCs, the web-client contract, and the activeRuntimeEnvironmentId routing semantics). The approach is sound: skills.discover / preflight.check exist server-side, are registered unconditionally, accept the params sent, and return the expected shapes; the empty-on-error (skills) vs fail-loud (preflight) split mirrors the web client exactly; and the activeRuntimeEnvironmentId?.trim() gate is the same predicate the renderer's getActiveRuntimeTarget already uses to route these calls to a remote runtime. Rebased onto current main it cherry-picks cleanly, typechecks (node + web), lints, and the suites pass.

I pushed one follow-up commit (a3d80c4) closing a gap in the same bug class: preflight:detectAgents / preflight:refreshAgents still scanned the local filesystem while a remote runtime was active, so a remote user's installed-AI-CLI list (claude/codex/cursor) was as wrong as the skills/gh status this PR fixes. They now proxy to the server's preflight.detectAgents / preflight.refreshAgents RPCs with the web client's empty-on-error fallback. To stay under max-lines without a disable, I extracted the three proxy helpers (check/detect/refresh) into preflight-remote-runtime.ts. Added 6 tests (52 passing total).

Minor: the PR description says it adds environmentId to SkillDiscoveryTarget in src/shared/skills.ts, but that file isn't in the diff and no such field exists (the server ignores unknown fields anyway) — worth trimming from the description so reviewers aren't misled.

@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

Marty and others added 5 commits July 20, 2026 14:54
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]>
@brennanb2025
brennanb2025 force-pushed the fix/remote-skill-discovery branch from a3d80c4 to 333900d Compare July 20, 2026 22:26
@brennanb2025

Copy link
Copy Markdown
Contributor

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.

@AmethystLiang AmethystLiang added the orca-remote-server Remote Orca Server / orca serve / paired remote runtime label Jul 22, 2026
@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for digging into this — your root-cause writeup is correct, and the end-to-end check you did against a real Ubuntu orca serve was genuinely useful.

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:

  1. The renderer cache is invisible to a main-side proxy. useInstalledAgentSkills keys its module cache purely on the local target, with no environment id. Proxying inside skills:discover leaves that key unchanged, so after switching environments the renderer serves the previous host's cached list — and vice versa. Fixing that requires the renderer change anyway.
  2. No protocol-compat gate. callRuntimeEnvironment dispatches straight to the peer, while the renderer's callRuntimeRpc first gates on ensureRuntimeEnvironmentCompatible and pins the pairing revision. Against an older server the main-side path surfaces a raw unknown-method error instead of degrading.
  3. The forwarded target describes the wrong machine. skills.ts forwards parsedTarget as-is, so a Windows client's { runtime: 'wsl', wslDistro: ... } reaches a Linux server that cannot resolve it. fix(skills): read installed skills from the connected remote runtime #6887 drops the client-host target for remote calls.

There's also a subtlety we hit ourselves in review: activeRuntimeEnvironmentId alone is not the right host signal. Skill install terminals route through getSingleFocusedRuntimeEnvironmentId, which refuses to guess while several runtimes are saved — so keying discovery off the raw preference makes the badge scan a host the install cannot reach.

Your preflight half is the part we'd like to keep, and it's untouched by #6887 — registerPreflightHandlers() still takes no store. Please consider reopening it as its own PR limited to preflight:check / detectAgents / refreshAgents. Two things to address there:

  • preflight:detectAgents / refreshAgents also feed the local PATH used to spawn local terminals, so proxying them has a wider blast radius than the skills fix — worth being explicit about which surfaces should follow the remote.
  • The Landing.tsx change (retaining last-known banner state on error) is a separate user-visible behavior change and would be cleaner split out.

Leaving this open for now pending a maintainer decision on how to land the preflight work.

@croakingtoad

Copy link
Copy Markdown
Contributor Author

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.

preflight.check is already runtime-aware on main: slices/preflight.ts routes to callRuntimeRpc when runtimeTarget.kind === 'environment'. The only surface still bypassing it is Landing.tsx, which calls window.api.preflight.check(...) directly — so that's the whole remaining gap, and #11390 fixes just that.

On the wider blast radius you raised for detectAgents / refreshAgents: those are already runtime-aware too, via the AgentDetectionTarget union (local | ssh | runtime) in useDetectedAgents and the runtime-detected-agents slice. Proxying them in main actively regresses local callers — OrchestrationSkillAgentCoverage.tsx hard-codes { kind: 'local' } and would receive the remote host's agents whenever activeRuntimeEnvironmentId is set, which also feeds the wrong PATH to locally-spawned terminals. So I've withdrawn that half rather than reopen it; your instinct on the blast radius was right, and it turned out to be a reason not to do it at all.

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.

@brennanb2025

Copy link
Copy Markdown
Contributor

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 orca serve, every skill badge was scanning the client's disk instead of the server's, because src/main/ipc/skills.ts resolved only native-host or wsl and never read activeRuntimeEnvironmentId.

Three things decided it in favour of the other approach, all about where the routing lives rather than whether the fix was right:

  1. Renderer cache scoping. Proxying inside the main-process handler leaves the renderer cache unaware of which runtime produced a result. Since main's cache key contained no environment id, switching environments would serve a cached local result for a remote target. fix(skills): read installed skills from the connected remote runtime #6887 keys the cache by runtime scope, so that can't happen.
  2. Protocol compatibility. callRuntimeRpc awaits ensureRuntimeEnvironmentCompatible and pins the pairing revision. callRuntimeEnvironment does neither, so against an older server this surfaces a raw unknown-method error instead of degrading.
  3. parsedTarget is forwarded verbatim, so a Windows client's {runtime:'wsl', wslDistro} could reach a Linux server that can't resolve it.

The preflight half is worth keeping, and nothing has superseded it — registerPreflightHandlers() still takes no store. If you're up for it, please open it as its own PR. Two things to know going in:

  • Proxying detectAgents / refreshAgents also feeds the local PATH used to spawn local terminals, so the blast radius is wider than the skills fix was. Worth being explicit about which callers should follow the remote runtime and which must stay local.
  • The Landing.tsx change (retaining last-known banner state on error) is a separate user-visible behaviour change and would be easier to review split out.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working orca-remote-server Remote Orca Server / orca serve / paired remote runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

selector_not_found error when installing skills via IDE on remote server connection

4 participants