Skip to content

Remote serve: agents installed in the serve user's package-manager bins aren't detected, and an empty detection result is pinned #6028

Closed

Description

@LesleyMurfin

Title: Remote serve: agents installed in the serve user's package-manager bins aren't detected, and an empty detection result is pinned

Summary

When the desktop client is paired to a remote orca serve over the SSH relay, the agent
picker shows only the client's local agents. Agent CLIs that ARE installed on the server
under the serve user's per-user package-manager bins (e.g. ~/.npm-global/bin, ~/.local/bin,
~/.cargo/bin, ~/.bun/bin) are not detected when those bins are added to PATH only by the
user's interactive shell config (~/.bashrc). Separately: once a remote detection returns
empty, fixing the server environment does not make the agent appear — only a full
disconnect/reconnect clears it.

Reported and diagnosed by @hufeide in #5899.

Two user-visible failures

  1. Correctness (D1) — a server-installed agent is never detected in the first place.
  2. Recoverability (D2) — after a server env fix, the agent still doesn't appear without a reconnect.

Root cause

D1 — relay PATH fallback omits the serve user's package-manager bins (login-vs-interactive PATH mismatch).
The relay probes agents with /bin/sh -lc 'command -v "$1"' (src/relay/preflight-handler.ts).
-lc is a login shell: it sources /etc/profile and ~/.profile, but not the
interactive ~/.bashrc. Meanwhile the user's real PTY sessions are interactive and DO source
~/.bashrc. So an agent the user can run in a terminal is invisible to the probe whenever its
bin is added to PATH only in ~/.bashrc. The POSIX fallback in src/relay/relay-command-env.ts
(['/usr/local/bin', '/opt/homebrew/bin', '/usr/bin', '/bin']) doesn't cover per-user bins
either → command -v finds nothing → the agent is reported missing.

D2 — an empty detection result is cached and pinned.
src/renderer/src/store/slices/detected-agents.ts stores the result unconditionally (even [])
and the guard short-circuits on any cached value (if (existing) return existing). Since [] is
truthy in JavaScript, an empty success is cached and detection never re-runs until the cache
is cleared — which only happens on disconnect. (A failed request is correctly NOT cached; this is
specifically the empty-success path.)

Note on the lookup mechanism (correcting the original report)

@hufeide's original suggestion was to switch from which to $SHELL -lc + command -v. That
mechanism is already in main (preflight-handler.ts uses /bin/sh -lc 'command -v "$1"'),
so that part is a no-op. The real gaps are that -lc is a login shell missing the interactive
~/.bashrc PATH (D1), and the truthy-[] cache pin (D2).

Reproduction (verified live)

Done on a WSL orca serve, against an agent installed to a bashrc-only bin:

  1. Install an agent CLI to ~/.npm-global/bin (npm global prefix), with that dir added to PATH
    only by ~/.bashrc — NOT ~/.profile. (In our repro: kilo.)
  2. Confirm a login probe finds nothing but an interactive shell finds it:
    • /bin/sh -lc 'command -v kilo' → (nothing)
    • bash -ic 'command -v kilo' → ~/.npm-global/bin/kilo
  3. Connect the desktop client → picker does not offer the server-side agent (failure 1).
  4. (D2) When the whole first remote detection comes back empty, add the bin to ~/.profile
    without disconnecting → agent still doesn't appear (failure 2 — the pinned empty cache).

Note: pick a bin that is genuinely bashrc-only on the test host. ~/.local/bin is added by the
stock Debian/Ubuntu ~/.profile, so it does not reproduce D1 there; ~/.npm-global/bin
(or any prefix added only in ~/.bashrc) does.

Proposed fix (see linked PR)

  • D1 — widen the relay POSIX fallback to include the serve user's package-manager bins,
    resolved at runtime from $HOME (.local/bin, .npm-global/bin, .cargo/bin, .bun/bin,
    go/bin, .deno/bin, .local/share/pnpm), and honor a relocated npm prefix via
    npm_config_prefix. Deduped against the inherited PATH; win32 path unchanged. This is the
    minimal, no-bridge change that covers the common package-manager prefixes. (A fuller fix —
    having the probe source the interactive config so it sees the exact PTY PATH — addresses the
    whole login-vs-interactive class but is a larger surface; called out as a follow-up.)
  • D2 — change the guard to if (existing?.length) so an empty result re-detects.

No new transport, no shell bridge.

Credit: @hufeide (#5899) for the report and diagnosis.

Activity

  1. Jinwoo-H commented on Jun 23, 2026

    @Jinwoo-H
    Contributor

    will be in next release, usually within 24 hours

  2. added theissue type on Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

orca-remote-serverRemote Orca Server / orca serve / paired remote runtimesize/mMedium PR (≤600 added lines, ≤25 files)

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions