Skip to content

fix(hosts): agent launch platform and shell come from the execution host - #27259

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v5a
Oct 10, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v5a

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​624 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​599
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​332 $\color{#cf222e}{\Huge{\mathbf{−}}}$​125 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​207

ELI5

When you start an agent, Orca types a startup command into a terminal. That command has to be written for the shell of the machine the agent runs on. Orca was sometimes writing it for the machine you are sitting at instead. A Windows laptop driving a Linux Orca server sent PowerShell to bash, and the agent never started. Now Orca asks the machine that runs the agent which OS it has. If that machine hasn't said yet, Orca stops and tells you why instead of guessing.

What Changed

Before

After

  • One resolver, execution-host-facts.ts, reports the OS of the host that runs the agent:
    • Local workspace: this machine. WSL projects and WSL folders count as Linux.
    • Orca server workspace: the hostPlatform the server reported in its status. A Windows server with a WSL folder counts as Linux.
    • Direct SSH workspace: the OS the SSH relay detected.
    • SSH target reached through an Orca server: the OS from that server's SSH state for the target, not the client's state for a target with the same name.
  • The client's Windows shell setting now shapes only local launches.
  • If the host's OS is unknown, Orca withholds the launch and gives a reason. A new tab shows a toast. The composer, folder composer and background runs show an error. Orca never falls back to the client's OS or a path-shape guess. A verified server status with no OS field shows "update the server".
  • Plain-SSH mode, where the relay couldn't start, now publishes the OS the runtime check already detected. SSH agent launches keep working in that mode.
  • Deleted agent-launch-platform.ts, which held the path-shape guess.
  • New-tab launches read a folder workspace's own path, so a WSL folder is recognized. A platform passed in by a caller only refines a local launch; a remote host's reported OS always wins.
  • Background launches resolve the worktree's own host, so a nested SSH worktree outranks its repo's server default and keeps the SSH relay's orca command name. For a remote host, the client's Windows shell setting is dropped.

Why

The bug happens because the launch code reads "is this repo on SSH?" and assumes everything else is local. A workspace on a paired Orca server is neither, so it got the client's OS. I could have patched each launch caller with an extra "is this a runtime?" check, but then four callers would each carry their own fallback chain, which is how this drifted in the first place. Instead, every caller asks one place for the OS of the host that runs the agent. That place reads facts the hosts already publish: the server's status.get and the SSH relay handshake. No new RPC and no wire change. Withholding is better than guessing, because a wrong guess produces a command that breaks on the host.

Scope note: this covers the four agent-launch entry points (new tab, background, workspace composer, folder composer). Other places still use the client's OS: source-control "fix" actions, resume and fork, and the main-process launch helper for SSH repos. Follow-up slices will move them onto the same resolver.

Linked Issue

Fixes #22204
Fixes #12252

Visual Proof

N/A. The visible change is the startup command text Orca types, which is covered by unit tests. The only new UI is an error toast or message when a host hasn't reported its OS.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New launch-agent-execution-context.test.ts (Windows client): a Linux server gets Linux quoting with no PowerShell shell; a Windows server doesn't inherit the client's shell setting; a server that hasn't reported its OS is withheld; direct SSH uses the relay-reported OS; direct SSH with no report is withheld; a nested SSH target is read from its server; a local workspace keeps the client shell. On origin/main, 6 of the 7 fail. For example, the Linux server case gets resolvedLaunchPlatform: 'win32', queuedShell: 'powershell'.

  • agent-background-session-launch-host.test.ts: server-owned repo, server-owned folder workspace, nested SSH (by repo and by worktree host), and SSH host with no report.

  • launch-agent-background-session.test.ts: a Windows server launch ignores the client's Git Bash setting. This fails without the fix.

  • New-tab tests: a WSL folder on a Windows server, and a caller's client platform ignored on a Linux server.

  • folder-workspace-composer-submit-host-platform.test.ts: a folder group on a server is quoted for the server's OS, and an unknown OS refuses before anything is created.

  • ssh-relay-session-plain-ssh.test.ts: plain-SSH mode keeps the detected OS.

  • Existing launch, composer and caller tests now give their SSH and server fixtures the OS facts they need.

  • pnpm tc, oxlint, check:code-quality:changed, and the focused suites (71 files) all pass. Not tested by hand on Windows; this machine is load-capped.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: direct and nested targets read the OS their own relay reported. Plain-SSH mode now reports the OS it detected.
  • Mixed versions: no wire change. hostPlatform has been in server status since May 2026. Older servers get an "update server" reason instead of a guessed launch.
  • Folder workspaces: folder groups and folder workspaces resolve through the same host lookup.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Agent startup commands were quoted for this client's OS (and its Windows shell
setting) whenever the workspace's repo row had no SSH connection, so a Windows
client driving a Linux Orca server sent PowerShell to bash. SSH hosts were
guessed from path shape.

One resolver now reads the OS from the host that runs the agent: the server's
reported hostPlatform, the relay-reported SSH remotePlatform (nested SSH read
through its server), WSL as linux, and this client only for local workspaces.
A missing fact withholds the launch with a reason. Plain-SSH mode now
publishes the OS the runtime ladder detected.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4685c1e4-2c08-4e46-8210-944c38216d39

📥 Commits

Reviewing files that changed from the base of the PR and between 09fc187 and 07929ea.


📒 Files selected for processing (7)
  • src/renderer/src/lib/agent-background-session-launch-host.test.ts
  • src/renderer/src/lib/agent-background-session-launch-host.ts
  • src/renderer/src/lib/launch-agent-background-session.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/renderer/src/lib/launch-agent-execution-context.test.ts
  • src/renderer/src/lib/launch-agent-execution-context.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-host-resolution.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.



📝 Walkthrough

Walkthrough

The change adds execution-host platform facts for repository, worktree, and folder-workspace launches. Composer, background, and new-tab launch paths use those facts to select command platforms and startup shells. Some paths withhold startup or return no execution context when the host platform is unavailable. Plain SSH sessions retain recognized remote platforms for renderer broadcasts.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 07929

No identified host-routing issue remains to block merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 28 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description is complete and directly explains the host-based launch-platform change, affected entry points, linked issues, testing, scope, and known limitations. It includes the required N/A visua…
Title check Passed The title clearly and concisely describes the main change: agent launch platform and shell selection now use the execution host.
Linked Issues check Passed The PR meets the coding requirements for [#22204, #12252]. execution-host-facts.ts resolves the execution host platform from local runtime facts, Orca server hostPlatform, or SSH relay state. `res…
Out of Scope Changes check Passed The changes stay within [#22204, #12252]. The shared resolver, SSH platform propagation, four agent-launch entry points, and related tests directly support host-based platform selection and safe launc…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

m4air added 2 commits October 10, 2026 07:27
Review follow-up: the new-tab resolver reads folder workspace paths (WSL folders),
a caller's platform only refines a local launch, background launches resolve the
worktree's host (nested SSH) and drop this client's shell setting for remote hosts.
@OrcaWin
OrcaWin merged commit 6cbbe45 into main Oct 10, 2026
42 checks passed
nwparker added a commit that referenced this pull request Oct 16, 2026
…xecution host

GitHub Project Start, PR checks Fix and the source-control/checks preflights
resolved their launch platform from the client OS whenever the repo had no SSH
connection, so a Windows client starting work on a paired Linux Orca server sent
a PowerShell-quoted --prefill to bash. They now read the execution-host facts
#27259 introduced (server-reported OS, SSH-reported OS, WSL), and the
path-shape resolver is removed so one helper decides.
nwparker added a commit that referenced this pull request Oct 16, 2026
…xecution host (#29716)

* fix(agents): direct work-item and checks-fix launches quote for the execution host

GitHub Project Start, PR checks Fix and the source-control/checks preflights
resolved their launch platform from the client OS whenever the repo had no SSH
connection, so a Windows client starting work on a paired Linux Orca server sent
a PowerShell-quoted --prefill to bash. They now read the execution-host facts
#27259 introduced (server-reported OS, SSH-reported OS, WSL), and the
path-shape resolver is removed so one helper decides.

* fix(agents): resolve direct-launch and preflight platforms from the repo owner

Review follow-up: a WSL worktree on a paired Windows server quotes for Linux,
the owner-row fixture reports its server OS, and the source-control preflights
read the repo owner rather than the focus-defaulted worktree route.

* fix(agents): preflight platform honours a worktree's own host

Review follow-up: a per-worktree host outranks the repo owner, the host-platform
test's mutable client platform is typed, and the source-control panel fixture
carries the host slices.

* fix(agents): a server-projected SSH worktree reads its server's SSH state

Review follow-up: the preflight resolver keeps the runtime owner for nested SSH
worktrees instead of reading this client's own SSH connections.

* fix(agents): cmd.exe pastes a multi-line draft instead of prefilling it

Review follow-up: now that direct launches pass the local Windows shell, a
multi-line --prefill under cmd.exe would submit at its first newline.

* fix(agents): direct launches quote for the shell their tab spawns

A project's Windows runtime can override the terminal setting (WSL setting,
Windows runtime spawns PowerShell), so resolve the tab's effective shell before
quoting. The cmd.exe parity row now expects cmd quoting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant