orca icon indicating copy to clipboard operation
orca copied to clipboard

fix: use runtime agent IDs in workspace composer (#7082)

Open sudoeren opened this issue 5 months ago • 1 comments

Summary

When a repo is bound to a runtime environment (e.g., Windows WSL/macOS local), the Create Workspace dialog shows the locally-detected agent list instead of the runtime-specific agent list. This is the same class of bug as #7082.

Changes

  • src/renderer/src/hooks/useComposerState.ts — Extended detectedAgentList selector to check selectedRepoSettings.activeRuntimeEnvironmentId when no SSH connection is active, falling through to the runtime agent list before reaching the local agent list. Also updated the detection useEffect to call ensureRuntimeDetectedAgents(environmentId) when a runtime environment is active, and added runtimeEnvironmentId to the deps array.

Testing

  • [x] Select a repo without SSH / runtime — local agents shown (existing behavior)
  • [x] Select an SSH-remote repo — remote agents shown (existing behavior)
  • [x] Select a repo with a runtime environment paired — runtime agents shown (new behavior)

Screenshots

No visual change — agent list logic only.

Notes

Closes #7082.

sudoeren avatar Jul 02 '26 20:07 sudoeren

Review Change Stack

📝 Walkthrough

Walkthrough

The change extends agent detection logic in useComposerState to support runtime-backed repositories in addition to existing SSH remote and local repo cases. A runtimeEnvironmentId is derived from selectedRepoSettings and used to select detected agent IDs from a new runtimeDetectedAgentIds store slice. A new ensureRuntimeDetectedAgents action is introduced and invoked for runtime repos within the detection useEffect, whose dependency array now also tracks runtimeEnvironmentId alongside connectionId.

Changes

File Change Summary
src/renderer/src/hooks/useComposerState.ts Added runtime environment detection: derives runtimeEnvironmentId, selects agent IDs from remote/runtime/local sources, adds ensureRuntimeDetectedAgents call and effect dependency.

Sequence Diagram(s)

sequenceDiagram
  participant Hook as useComposerState
  participant Store as Agent Store

  Hook->>Hook: derive runtimeEnvironmentId from selectedRepoSettings
  alt SSH remote repo
    Hook->>Store: ensureRemoteDetectedAgents(connectionId)
    Store-->>Hook: remoteDetectedAgentIds
  else runtime-backed repo
    Hook->>Store: ensureRuntimeDetectedAgents(runtimeEnvironmentId)
    Store-->>Hook: runtimeDetectedAgentIds
  else local repo
    Hook->>Store: ensureDetectedAgents()
    Store-->>Hook: detectedAgentIds
  end

Related PRs: None identified.

Suggested labels: renderer, enhancement

Suggested reviewers: None identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, changes, testing, screenshots, and notes, but omits the required AI Review Report and Security Audit sections. Add the AI Review Report and Security Audit sections from the template, including cross-platform checks and any security follow-up notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change matches #7082 by preferring runtimeDetectedAgentIds for runtime-bound workspaces and re-running detection with the runtime environment.
Out of Scope Changes check ✅ Passed The patch stays within the composer agent-selection flow and introduces no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: using runtime agent IDs in the workspace composer.

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[bot] avatar Jul 02 '26 20:07 coderabbitai[bot]

This PR looks potentially related to #7563.

#7563 reports a WSL-backed setup where regular Claude is installed and works inside the WSL distro and Orca-managed WSL terminals, but the GUI agent picker does not show regular Claude and only shows Claude Agent Teams. That sounds very close to the runtime-specific agent-list boundary described here.

There are also adjacent post-launch/sidebar cases that may need separate coverage even after composer detection is fixed:

  • #6907: Codex launched in a WSL worktree does not appear in agent status/sidebar.
  • #7565: OMP agents launched in WSL no longer appear in the worktree sidebar after v1.4.124, despite Orca terminal identity/env being present.
  • #7091: OMP status env is injected but live status does not report correctly.

Suggested validation matrix for this PR or the follow-up area: Windows desktop app, WSL default/runtime-backed project, agent CLIs installed only inside WSL, then verify both the Create Workspace/agent picker list and the post-launch sidebar/status projection.

euclodius avatar Jul 06 '26 10:07 euclodius

Review (do not merge without maintainer sign-off) — RECOMMEND MERGE ✅

Reviewed and validated this fix. The branch was behind main, so I rebased it onto current main (clean cherry-pick, byte-identical patch — no changes to the original diff) and ran authoritative CI, which the community-fork PR itself doesn't get.

Bug reproduces & fix resolves it. useComposerState read the local detected-agent list (s.detectedAgentIds) for any repo without an SSH connectionId — including repos owned by a paired runtime environment. So a Windows client paired to a Linux orca serve runtime hid runtime-detected agents (e.g. Codex) in the Create Workspace picker even though the runtime detects and can launch them. The fix falls through to runtimeDetectedAgentIds[environmentId] / ensureRuntimeDetectedAgents(...) when activeRuntimeEnvironmentId is set, before reaching the local list. Precedence SSH → runtime → local matches getActiveRuntimeTarget / getRuntimeEnvironmentIdForRepo.

Hostile-author audit — clean.

  • Diff is exactly the described 20/11 lines in one file; no out-of-scope or smuggled changes.
  • SSH and runtime are mutually exclusive by construction (a connection-owned repo resolves activeRuntimeEnvironmentId to null), so no double-detection; SSH branch untouched.
  • Mobile safe — shares the same composer; preflight.detectAgents is on the mobile RPC allowlist; the same runtime-detect path is already exercised by the TabBar; .catch(() => []) degrades gracefully.
  • Windows / GitLab unaffected — agent detection is provider-agnostic; Windows is the reported scenario the fix targets.
  • No render-loop risk (selector returns stable store refs).

CI green on the rebased branch (full pr.yml verify job: oxlint, typecheck ×3, full test suite, build:unpack, smoke CLI) — see #7602. Added a regression test locking the SSH → runtime → local host-detection precedence.

Rebased + verified branch: Jinwoo-H/pr-7141-runtime-agent-ids (draft #7602). Maintainer can merge this PR (after a rebase to pick up the regression test) or merge #7602.

Jinwoo-H avatar Jul 06 '26 23:07 Jinwoo-H