Repository navigation
fix(hosts): agent launch platform and shell come from the execution host - #27259
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No identified host-routing issue remains to block merging after normal checks. Pre-merge checks |
|
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.
…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.
…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.
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
bash: eval: syntax error near unexpected token '('([Bug]: Windows client → Linux remote worktree — agent startup command emitted in PowerShell, breaks bash 'eval' #22204). In general, a Linux host was treated as Windows for agent commands ([Bug]: Remote Linux host mis-detected as Windows for agent/platform commands #12252).C:\…meant Windows, anything else meant Linux).After
execution-host-facts.ts, reports the OS of the host that runs the agent:hostPlatformthe server reported in its status. A Windows server with a WSL folder counts as Linux.agent-launch-platform.ts, which held the path-shape guess.orcacommand 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.getand 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. Onorigin/main, 6 of the 7 fail. For example, the Linux server case getsresolvedLaunchPlatform: '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
Notes
hostPlatformhas been in server status since May 2026. Older servers get an "update server" reason instead of a guessed launch.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)