Skip to content

[Feature]: how to use agent of remote Linux server. #5899

Closed

Description

@hufeide

Problem or use case

Currently, I am using a local Windows computer, and I also have a remote Linux server. How can I configure and use agents running on the remote server? Is it only possible to use agents on my local computer, or can I run and manage agents on the remote Linux server as well?

Proposed solution

method

Alternatives or additional context

No response

Activity

  1. added
    enhancement
    on Jun 20, 2026
  2. Jelloeater commented on Jun 20, 2026

    @Jelloeater

    I also would like this! I know agent-deck and https://github.com/NeuralNomadsAI/CodeNomad both work headless and remote.

  3. Jelloeater commented on Jun 20, 2026

    @Jelloeater

    Also #4501 and #4280

  4. LesleyMurfin commented on Jun 21, 2026

    @LesleyMurfin
    Contributor

    Yes — you can run the agents on the remote Linux server and drive them from your Windows client. The mechanism is Orca's headless runtime (orca serve) + the "Remote Orca Servers" pairing: the agents, terminals, and workspaces all live on the server, and the desktop client is just the front-end. Two open issues track this exact use case as P1 — #4501 (closest; also covers holding multiple remotes from the desktop) and #4280 — and it's actively progressing (serve-mode terminal persistence across reconnects already shipped in #4637 / PR #4656).

    What works today

    On the Linux server:

    orca serve --pairing-address <host-your-client-can-reach>
    

    Runs headless in the foreground and prints a pairing link (orca://pair?code=…). --pairing-address is the key bit for a remote box — set it to an address the client can reach (Tailscale IP, SSH-forwarded localhost, LAN IP, or public tunnel; the flag's own help lists those), and make sure that port is open. The examples use 6768; set it with --port. Register your project so it shows up as a workspace:

    orca repo add --path /path/to/your/project
    

    ⚠️ Caveat for a truly headless server: orca serve still inherits Electron's display dependency, so on a box with no X server you currently need a virtual display — xvfb-run orca serve …. A display-free, first-class headless mode is exactly what #4280 / #4501 are asking for and isn't fully there yet.

    On your local Windows client:

    orca environment add --name my-server --pairing-code "orca://pair?code=..."
    

    Then open that environment in the desktop app — workspaces, terminals, and agents all run on the remote Linux host; launching an agent spawns it server-side.

    No-install option: orca serve also prints a browser URL with the pairing data embedded — open that in any browser and the web client pairs with nothing to install.

    A couple of requirements worth calling out

    • Agent runtimes live on the server. Because agents spawn server-side, the agent CLI you want (e.g. claude) needs to be installed and on PATH on the Linux server, with its own auth/API key configured there — not on the Windows client.
    • Client and server settings are independent — in my experience Orca doesn't sync settings between them, so each side keeps its own. Your local terminal/shell preferences won't apply to the server runtime; configure runtime-side behavior on the server.
    • Reachability is the usual gotcha — see the --pairing-address note above; if the client can't reach the address in the pairing link, pairing silently won't connect.

    I've been running this setup (desktop client ↔ headless orca serve on a Linux box, under Xvfb) and the agents run and are managed entirely on the server.

  5. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    无头服务器如何安装orca,目前只看到桌面版的linux安装包

  6. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    无头服务器如何安装orca,目前只看到桌面版的linux安装包
    我安装了orca-ide_1.4.90-rc.0_amd64.deb,然后使用如下命令,可以运行在无头服务器上。

    export DISPLAY=:99
    export LIBGL_ALWAYS_SOFTWARE=1
    export ELECTRON_DISABLE_GPU=1
    orca-ide serve --pairing-address 192.168.1.210

  7. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。

    Image
  8. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。

    Image

    其他bug
    无法识别出远端的服务器的agent,框中的是本地的agent

    Image
  9. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。
    Image

    其他bug 无法识别出远端的服务器的agent,框中的是本地的agent

    Image

    问题可能是 在wsl中安装了opencode,但是没有加入powershell:
    需要 类似 以下命令添加:
    $userPath = [Environment]::GetEnvironmentVariable("Path", "User")

    if ($userPath -notlike "C:\Users\EDY.opencode\bin") {
    [Environment]::SetEnvironmentVariable(
    "Path",
    "$userPath;C:\Users\EDY.opencode\bin",
    "User"
    )
    }

  10. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。
    Image

    其他bug 无法识别出远端的服务器的agent,框中的是本地的agent
    Image

    问题可能是 在wsl中安装了opencode,但是没有加入powershell: 需要 类似 以下命令添加: $userPath = [Environment]::GetEnvironmentVariable("Path", "User")

    if ($userPath -notlike "C:\Users\EDY.opencode\bin") { [Environment]::SetEnvironmentVariable( "Path", "$userPath;C:\Users\EDY.opencode\bin", "User" ) }

    目前本地的agent可以通过这种方式解决,但是远程的agent无法加载。

  11. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。
    Image

    其他bug 无法识别出远端的服务器的agent,框中的是本地的agent
    Image

    问题可能是 在wsl中安装了opencode,但是没有加入powershell: 需要 类似 以下命令添加: $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
    if ($userPath -notlike "C:\Users\EDY.opencode\bin") { [Environment]::SetEnvironmentVariable( "Path", "$userPath;C:\Users\EDY.opencode\bin", "User" ) }

    目前本地的agent可以通过这种方式解决,但是远程的agent无法加载。

    1. 不要只依赖裸 which

    远程更稳的写法是走 login shell,并补充常见路径:

    const commonPaths = [
    '$HOME/.local/bin',
    '$HOME/.cargo/bin',
    '$HOME/go/bin',
    '$HOME/.bun/bin',
    '/opt/homebrew/bin',
    '/usr/local/bin',
    '/usr/bin',
    '/bin',
    ].join(':')

    const script = PATH="${commonPaths}:$PATH" command -v ${shellQuote(command)}

    然后检测返回值是否是绝对路径。

    比起 which,command -v 更通用,但注意它也可能返回 alias/function,所以你们已有的 path.isAbsolute() 思路仍然应该保留。

  12. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    Orca IDE 1.4.90-rc.0 内部的 gh:workItemDetails 功能有问题。
    Image

    其他bug 无法识别出远端的服务器的agent,框中的是本地的agent
    Image

    问题可能是 在wsl中安装了opencode,但是没有加入powershell: 需要 类似 以下命令添加: $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
    if ($userPath -notlike "C:\Users\EDY.opencode\bin") { [Environment]::SetEnvironmentVariable( "Path", "$userPath;C:\Users\EDY.opencode\bin", "User" ) }

    目前本地的agent可以通过这种方式解决,但是远程的agent无法加载。

    1. 不要只依赖裸 which

    远程更稳的写法是走 login shell,并补充常见路径:

    const commonPaths = [ '$HOME/.local/bin', '$HOME/.cargo/bin', '$HOME/go/bin', '$HOME/.bun/bin', '/opt/homebrew/bin', '/usr/local/bin', '/usr/bin', '/bin', ].join(':')

    const script = PATH="${commonPaths}:$PATH" command -v ${shellQuote(command)}

    然后检测返回值是否是绝对路径。

    比起 which,command -v 更通用,但注意它也可能返回 alias/function,所以你们已有的 path.isAbsolute() 思路仍然应该保留。

    1. 缓存会掩盖“刚装好 agent 后仍检测不到”的问题

    你这里的状态设计会缓存远程结果:

    remoteDetectedAgentIds[connectionId]

    所以如果第一次远程检测时 PATH 不完整,缓存了空结果,后面即使用户修好了环境,也可能仍然显示检测不到,除非:

    SSH 断开,触发清理缓存;
    重新连接;
    或增加一个 refreshRemoteAgents(connectionId);
    或在安装 agent 后主动 invalidate 该 connection 的检测缓存。

    建议加一个远程刷新 API,类似本地的:

    window.api.preflight.refreshRemoteAgents({ connectionId })

  13. hufeide commented on Jun 21, 2026

    @hufeide
    Author

    chatgpt说这么改:可以这样改:renderer 侧加“可刷新/不过度缓存空结果”,main 侧加 refresh IPC,真正的 PATH 修复放到 SSH relay 的 preflight.detectAgents 实现里。你贴的 useComposerState.ts 本身不是根因。


    1. useComposerState.ts:加 connectionId 保护,避免空连接误检测

    你现在这段基本可以保留,只建议加一个 remote guard:

    useEffect(() => {
      let cancelled = false
    
      if (isRemote && !connectionId) {
        return () => {
          cancelled = true
        }
      }
    
      const detect = isRemote
        ? ensureRemoteDetectedAgents(connectionId)
        : ensureDetectedAgents()
    
      void detect.then((ids) => {
        if (cancelled) {
          return
        }
    
        if (!newWorkspaceDraft?.agent && !settings?.defaultTuiAgent && ids.length > 0) {
          const firstInCatalogOrder = AGENT_CATALOG.find((a) => ids.includes(a.id))
          if (firstInCatalogOrder) {
            setTuiAgent(firstInCatalogOrder.id)
          }
        }
      })
    
      return () => {
        cancelled = true
      }
    
      // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [connectionId, isRemote])

    这层只是触发检测,不建议在这里塞 PATH 逻辑。


    2. detected-agents.ts:不要把远程空结果永久缓存

    你现在的问题之一是:

    const existing = get().remoteDetectedAgentIds[connectionId]
    if (existing) {
      return Promise.resolve(existing)
    }

    [] 在 JS 里也是 truthy,所以一旦远程第一次检测结果是空数组,就会一直返回空数组,直到 SSH 断开清缓存。

    建议改成支持 force,并且给远程缓存加 TTL。比如:

    const REMOTE_DETECTED_AGENTS_TTL_MS = 30_000
    
    const remoteDetectPromises = new Map<string, Promise<TuiAgent[]>>()

    store state 增加一个时间戳字段:

    remoteDetectedAgentIds: Record<string, TuiAgent[]>
    remoteDetectedAgentCheckedAt: Record<string, number>
    isDetectingRemoteAgents: Record<string, boolean>

    然后把 ensureRemoteDetectedAgents 改成:

    ensureRemoteDetectedAgents: (connectionId: string, options?: { force?: boolean }) => {
      if (!connectionId) {
        return Promise.resolve([] as TuiAgent[])
      }
    
      const force = options?.force === true
      const existing = get().remoteDetectedAgentIds[connectionId]
      const checkedAt = get().remoteDetectedAgentCheckedAt[connectionId] ?? 0
      const isFresh = Date.now() - checkedAt < REMOTE_DETECTED_AGENTS_TTL_MS
    
      if (!force && existing !== undefined && isFresh) {
        return Promise.resolve(existing)
      }
    
      if (force) {
        remoteDetectPromises.delete(connectionId)
      }
    
      const inflight = remoteDetectPromises.get(connectionId)
      if (!force && inflight) {
        return inflight
      }
    
      set((s) => ({
        isDetectingRemoteAgents: {
          ...s.isDetectingRemoteAgents,
          [connectionId]: true
        }
      }))
    
      const pending = window.api.preflight
        .detectRemoteAgents({ connectionId })
        .then((ids) => {
          const typed = ids as TuiAgent[]
    
          set((s) => ({
            remoteDetectedAgentIds: {
              ...s.remoteDetectedAgentIds,
              [connectionId]: typed
            },
            remoteDetectedAgentCheckedAt: {
              ...s.remoteDetectedAgentCheckedAt,
              [connectionId]: Date.now()
            },
            isDetectingRemoteAgents: {
              ...s.isDetectingRemoteAgents,
              [connectionId]: false
            }
          }))
    
          remoteDetectPromises.delete(connectionId)
          return typed
        })
        .catch(() => {
          remoteDetectPromises.delete(connectionId)
    
          set((s) => ({
            isDetectingRemoteAgents: {
              ...s.isDetectingRemoteAgents,
              [connectionId]: false
            }
          }))
    
          return [] as TuiAgent[]
        })
    
      remoteDetectPromises.set(connectionId, pending)
      return pending
    }

    然后 clearRemoteDetectedAgents 也要同时清时间戳:

    clearRemoteDetectedAgents: (connectionId: string) => {
      remoteDetectPromises.delete(connectionId)
    
      set((s) => {
        const { [connectionId]: _ids, ...remoteDetectedAgentIds } = s.remoteDetectedAgentIds
        const { [connectionId]: _checkedAt, ...remoteDetectedAgentCheckedAt } =
          s.remoteDetectedAgentCheckedAt
        const { [connectionId]: _detecting, ...isDetectingRemoteAgents } =
          s.isDetectingRemoteAgents
    
        return {
          remoteDetectedAgentIds,
          remoteDetectedAgentCheckedAt,
          isDetectingRemoteAgents
        }
      })
    }

    这个改动能解决:第一次远程检测为空后,后面一直不重新检测。


    3. src/main/ipc/preflight.ts:加远程 refresh IPC

    你现在只有:

    ipcMain.handle(
      'preflight:detectRemoteAgents',
      async (_event, args: { connectionId: string }): Promise<string[]> => {
        const mux = getActiveMultiplexer(args.connectionId)
        if (!mux || mux.isDisposed()) {
          throw new Error(`No active SSH connection for "${args.connectionId}"`)
        }
        const result = (await mux.request('preflight.detectAgents', {
          commands: KNOWN_AGENT_COMMANDS
        })) as { agents: string[] }
        return result.agents
      }
    )

    建议保留它,再加一个 refresh handler:

    ipcMain.handle(
      'preflight:refreshRemoteAgents',
      async (_event, args: { connectionId: string }): Promise<string[]> => {
        const mux = getActiveMultiplexer(args.connectionId)
        if (!mux || mux.isDisposed()) {
          throw new Error(`No active SSH connection for "${args.connectionId}"`)
        }
    
        const result = (await mux.request('preflight.detectAgents', {
          commands: KNOWN_AGENT_COMMANDS,
          force: true
        })) as { agents: string[] }
    
        return result.agents
      }
    )

    然后 preload / IPC 类型里也要暴露:

    detectRemoteAgents(args: { connectionId: string }): Promise<string[]>
    refreshRemoteAgents(args: { connectionId: string }): Promise<string[]>

    renderer 里可以做一个手动刷新入口,或者在安装 agent 后调用:

    await window.api.preflight.refreshRemoteAgents({ connectionId })
    clearRemoteDetectedAgents(connectionId)
    await ensureRemoteDetectedAgents(connectionId, { force: true })

    4. 真正关键:改 SSH relay 的 preflight.detectAgents

    src/main/ipc/preflight.ts 只是把请求转发到 relay。如果 relay 里面仍然只是裸跑 which,main/renderer 怎么改都不会稳定。

    relay 端建议不要只跑:

    which claude

    而是改成:

    PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:$HOME/.bun/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
    command -v claude

    并且通过用户 shell 执行:

    $SHELL -lc '<script>'

    推荐实现形态:

    import path from 'node:path'
    import { execFile } from 'node:child_process'
    import { promisify } from 'node:util'
    
    const execFileAsync = promisify(execFile)
    
    const COMMON_REMOTE_PATHS = [
      '$HOME/.local/bin',
      '$HOME/.cargo/bin',
      '$HOME/go/bin',
      '$HOME/.bun/bin',
      '/opt/homebrew/bin',
      '/usr/local/bin',
      '/usr/bin',
      '/bin'
    ].join(':')
    
    function shellQuote(value: string): string {
      return `'${value.replace(/'/g, `'\\''`)}'`
    }
    
    function hasAbsolutePath(stdout: string): boolean {
      return stdout
        .split(/\r?\n/)
        .map((line) => line.trim())
        .some((line) => path.posix.isAbsolute(line))
    }
    
    async function isRemoteCommandOnPath(command: string): Promise<boolean> {
      const quoted = shellQuote(command)
    
      const script = `
        PATH="${COMMON_REMOTE_PATHS}:$PATH"
        found="$(command -v -- ${quoted} 2>/dev/null || true)"
        case "$found" in
          /*) printf '%s\\n' "$found"; exit 0 ;;
          *) exit 1 ;;
        esac
      `
    
      const shells = [
        process.env.SHELL,
        '/bin/bash',
        '/bin/zsh',
        '/bin/sh'
      ].filter(Boolean) as string[]
    
      for (const shell of [...new Set(shells)]) {
        try {
          const { stdout } = await execFileAsync(shell, ['-lc', script], {
            encoding: 'utf-8',
            timeout: 5000
          })
    
          if (hasAbsolutePath(stdout)) {
            return true
          }
        } catch {
          // try next shell
        }
      }
    
      return false
    }

    然后 relay 的 preflight.detectAgents 用这个函数:

    async function detectAgents(args: { commands: Record<string, string> | string[] }) {
      const agents: string[] = []
    
      for (const item of normalizeAgentCommands(args.commands)) {
        const found = await isRemoteCommandOnPath(item.command)
    
        if (found) {
          agents.push(item.id)
        }
      }
    
      return { agents }
    }

    normalizeAgentCommands 根据你们 KNOWN_AGENT_COMMANDS 的实际结构写。如果它是数组:

    function normalizeAgentCommands(commands: string[]) {
      return commands.map((command) => ({
        id: command,
        command
      }))
    }

    如果它是 { id, command }[]:

    function normalizeAgentCommands(commands: Array<{ id: string; command: string }>) {
      return commands
    }

    如果它是 Record<agentId, command>:

    function normalizeAgentCommands(commands: Record<string, string>) {
      return Object.entries(commands).map(([id, command]) => ({
        id,
        command
      }))
    }

    5. useIpcEvents.ts:你现在这段可以保留

    这段断开时清缓存是对的:

    if (
      ['disconnected', 'auth-failed', 'reconnection-failed', 'error'].includes(state.status)
    ) {
      store.clearRemoteDetectedAgents(data.targetId)
    }

    可以再补一个状态:如果你们有 connecting / reconnecting,也可以清一次,避免重连过程中沿用旧 relay 的空结果:

    if (
      ['connecting', 'reconnecting', 'disconnected', 'auth-failed', 'reconnection-failed', 'error'].includes(
        state.status
      )
    ) {
      store.clearRemoteDetectedAgents(data.targetId)
    }

    但这个不是必须,核心还是 relay 检测命令和 store 缓存。


    最小改动优先级

    按收益排序:

    1. relay 端 preflight.detectAgents 改成 $SHELL -lc + command -v + common PATH fallback。
    2. detected-agents.ts 加 TTL / force refresh,避免空数组长期缓存。
    3. main/preload 增加 refreshRemoteAgents。
    4. useComposerState.ts 加 connectionId guard。
    5. useIpcEvents.ts 断线/重连时清远程缓存,已有逻辑基本 OK。

    真正能解决“远程检测不到”的关键不是 useComposerState.ts,而是:relay 执行检测时要模拟用户远程 shell 的 PATH,并且 renderer 不能永久缓存第一次的空结果。

  14. LesleyMurfin commented on Jun 22, 2026

    @LesleyMurfin
    Contributor

    Thanks @hufeide — your detectAgents / PATH diagnosis is pointing at the right area, but one part is already handled: the relay isn't running bare which on a non-login shell. main already does /bin/sh -lc 'command -v "$1"' plus a PATH fallback in the relay preflight handler, so the -lc / command -v change you proposed is effectively already shipped.

    Verifying against main, the actual gap is two narrower defects:

    1. The relay's PATH fallback omits user-home bins — it covers /usr/local/bin, /opt/homebrew/bin, /usr/bin, /bin but not ~/.local/bin, ~/.cargo/bin, ~/.bun/bin, ~/.opencode/bin. So an agent installed under $HOME comes back empty.
    2. That empty result gets cached and pinned — an empty [] is treated as truthy and never re-detected, so even after you fix PATH it stays "not found" until a full disconnect/reconnect.

    #6029 addresses both (widen the relay PATH fallback to the user-home bins; stop pinning empty detection results). Credit to you for surfacing the remote-detection case clearly.

  15. added
    size/m
    on Jun 22, 2026
  16. brennanb2025 commented on Jun 29, 2026

    @brennanb2025
    Contributor

    Taking a look 👀

  17. brennanb2025 commented on Jun 29, 2026

    @brennanb2025
    Contributor

    Short answer: yes — you can run agents on the remote Linux server and drive them from your Windows desktop, and the "agents not detected on the remote" problem you hit is a bug that's already fixed in a newer build.

    How the setup works

    The agents, terminals, and workspaces all live on the Linux server; the Windows desktop is just the front-end. The mechanism is the headless runtime (orca serve) plus a "Remote Orca Servers" pairing.

    On the Linux server:

    orca serve --pairing-address <host-your-windows-client-can-reach>
    

    It runs in the foreground and prints a pairing link (orca://pair?code=…). --pairing-address is the important part for a remote box — set it to an address the client can reach (LAN IP, Tailscale IP, SSH-forwarded localhost, or a public tunnel), and make sure the port is open (--port, the examples use 6768). Register your project so it shows up as a workspace:

    orca repo add --path /path/to/your/project
    

    On your Windows desktop, either:

    • GUI: Settings → Remote Orca Servers → add a server and paste the printed orca://pair?code=… link, then open that environment; or
    • CLI: orca environment add --name my-server --pairing-code "orca://pair?code=..."

    Workspaces, terminals, and agents then run on the remote Linux host — launching an agent spawns it server-side. There's also a no-install option: orca serve prints a browser URL with the pairing data embedded, so you can pair from any browser with nothing to install.

    The one requirement that bites people

    Agent runtimes live on the server. Because agents spawn server-side, the agent CLI you want (e.g. claude, codex, opencode) must be installed and on PATH on the Linux server, with its own auth/API key configured there — not on the Windows client.

    Your "remote agents not detected" screenshot

    That was a real bug: detection couldn't see agents installed under your home directory (e.g. ~/.local/bin, ~/.cargo/bin, ~/.bun/bin, ~/.opencode/bin), and once it returned "none found" it cached that empty result until you reconnected. Both parts are fixed in #6029, which shipped in v1.4.92. You reported this on 1.4.90-rc.0, which is just before the fix landed — so upgrading to v1.4.92 or newer should make remote agents show up (current builds are 1.4.105-rc.x), as long as the agent CLI is installed on the server per the note above.

    A first-class, display-free headless server mode (so you don't need a virtual display on a truly headless box) is still being tracked separately in #4280 / #4501 — but the remote-agent workflow itself works today.

  18. added theissue type on Jul 12, 2026
  19. added
    orca-remote-server
    on Jul 22, 2026
  20. nwparker commented on Aug 23, 2026

    @nwparker
    Contributor

    Closing as answered — running agents on a remote Linux server works today (see thread).
    Disagree? Please respond! I will re-visit this ticket in 5 days. If you respond, I will re-open it 🙏.

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

Metadata

Metadata

Assignees

Labels

enhancementorca-remote-serversize/m

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions