Skip to content

Host plans agent launches with the window's runtime rule and one runtime fact (C1) - #27692

Merged
brennanb2025 merged 18 commits into
mainfrom
brennanb2025/conv-c1-host-planner
Oct 13, 2026
Merged

brennanb2025 merged 18 commits into
mainfrom
brennanb2025/conv-c1-host-planner

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​427 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​406
Prod 31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​724 $\color{#cf222e}{\Huge{\mathbf{−}}}$​261 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​463

ELI5

Orca can start an agent (Claude, Codex, …) in a terminal two ways. The window starts it in a tab (the "+" button). Or the app's background service starts it: the phone, the orca CLI, orchestration workers, automations, worktree create with a startup agent, resume, and new agent tabs from a paired desktop or the web client. Each side decides by itself whether the agent runs on Windows or in WSL, and they don't always agree. Worse, the background service picks how to write the command from one setting and which shell runs it from another, so a command can be written for one shell and typed into a different one, which mangles its arguments.

This PR makes the background service decide the same way the window does, once per launch, and use that one answer both to write the command and to pick the shell it is typed into.

C-numbers below are steps of the launch-convergence plan: C0 is the characterization tests already on main; C2 is the next step, which moves the window's tab launches and the new agent.launch inputs onto this background path.

What Changed

The problem. The window picks where an agent runs from the project's saved runtime, then a \\wsl$\… path, then the global default (Settings > Project Runtime). The background service had an older rule that:

  • treats a repo stored at \\wsl$\Ubuntu\… with no WSL setting as Windows, so it writes the command for a Windows shell while the agent actually runs in WSL;
  • ignores the project runtime for a folder workspace that holds a repo;
  • writes the command for the Terminal shell setting but starts the terminal in the project runtime's shell. For example, with the Terminal shell set to WSL and a project on the Windows host, a Linux-style command was typed into cmd.exe.

What you'll see differently. Only on Windows, and only for agents the background service starts. Agents started from a window tab, plain terminals, and everything on macOS, Linux and SSH hosts behave as before, with one exception: an OpenCode tab with a picked model opened from the desktop is started by the background service, so change 2 applies to it (in the folders under the temporary OpenCode difference below, it keeps today's behaviour).

  1. A repo inside a WSL share (\\wsl$\…) with no runtime setting of its own: its agents' commands are now written for Linux and the terminal is told it is WSL. The agent already ran in WSL; now its arguments arrive intact. The same goes for a repo stored elsewhere whose worktrees live in a WSL share: agents that automations and workers start in such a worktree, and a new worktree's startup agent, are written for Linux, matching where they run. A \\wsl$ working directory always runs in WSL, so this holds even when the project is set to the Windows host; before, those commands were written for the Terminal shell, which broke them unless that shell was WSL. This also covers a plain folder (not a git repo) added as a project from a WSL share: with the Terminal shell set to PowerShell, its agents used to get a PowerShell-style command inside WSL; now the command is written for Linux.
  2. Terminal shell set to WSL, repo on the Windows host: on Windows, with the Terminal shell set to WSL and a repo whose project has no runtime setting of its own (global default Windows host) or is set to the Windows host. In such a repo the window opens PowerShell tabs (it swaps the WSL Terminal shell for PowerShell), while the background service spawned cmd.exe. What changes is how the command is written, per route:
Route Today With this change
The background service spawns the terminal: orca agent launch / agent.launch, a chat created in the background, the phone with no window open, orchestration workers, server-run automations, resume, a new worktree's startup agent cmd.exe with a Linux-style command: broken PowerShell with a PowerShell-style command: works (needs the agent installed on Windows)
The window spawns the terminal: the phone while a window is open, a chat created focused on the desktop, orca terminal create --command <agent> in a repo a PowerShell tab with a Linux-style command: broken a PowerShell tab with a PowerShell-style command: works
Desktop automations and the "+" tab the window builds and spawns them unchanged (window code is untouched)

A new worktree's startup agent whose worktree lands in a WSL share runs in WSL instead (change 1). A folder holding one such repo keeps today's behaviour on every route (temporary, see below).
3. A folder workspace holding exactly one repo now uses that repo's project runtime. If that project runs in WSL (its own setting or a WSL global default), the folder's agents now start in WSL, in that runtime's distro rather than the Terminal shell's. OpenCode is the exception (see the temporary differences below). Chats the background service started in such a folder before this change ran on Windows; resuming one now runs it in WSL. Chats the window started there were already in WSL. One more consequence: orca terminal create --shell <a Windows shell> with an agent in such a folder is now refused when the repo's runtime is WSL, with the existing message for a project that runs in WSL. Before, the agent started in the requested shell; now that the agent runs in WSL, accepting the request would silently swap the shell for WSL, which --shell exists to prevent.
4. A folder holding one repo whose WSL runtime needs repair (the distro is not installed, or WSL is unavailable): this follows from change 3. An agent the background service starts in such a folder is now refused, instead of starting in the Terminal shell. That covers orca agent launch / agent.launch, chats created through createAgentSession (including the desktop's OpenCode-with-model tab), the phone (with or without a window open), orchestration workers, automations and resume. The phone's refresh shows the same refusal instead of a plain shell under the agent's icon. The refusal uses the words a repo with a broken runtime already gets on main ("Project runtime requires repair before terminal spawn: wsl-distro-missing"), and orca agent launch prints the same "Orca could not confirm the launch outcome" line it prints for such a repo on main. That line wrongly suggests the agent may be running and offers a retry, though nothing started; the stacked S1 replaces it with a plain "No agent was started" sentence. OpenCode is excepted (see the temporary differences below). Launches the window spawns itself are unchanged: orca terminal create --command <agent> (the host does not plan a typed command in a folder) and the desktop's own "+" tab. Creating a workspace with a startup agent behaves as on main: a folder project (a repo added as a plain folder, without git) is still created and the startup's failure comes back as the create's warning; a git repo whose runtime needs repair is refused earlier, at git, with no workspace created. The refusal now happens while the launch is planned, before anything spawns, because the shell is decided once there; the words and the outcome are main's.

Worktree startup agents. Two cases that used to break are fixed when the background service creates the worktree (orca worktree create --agent, automations, the phone, agent.launch creating a workspace): a startup agent in a worktree on a WSL share no longer gets a PowerShell-quoted line in WSL's bash, and with the Terminal shell set to WSL and the project on the Windows host it no longer gets a Linux-style line in cmd.exe. A startup the window builds itself (the desktop's new-worktree dialog) is unchanged until C2.

Mechanism.

  • One runtime rule, on main's data. The host extends its existing resolveLocalWorkspaceRuntime (local-project-runtime-resolution.ts) to read like the window: the project is found by its source repos, as on main (the window also takes a project named after the repo; that moves to a stacked PR), a folder borrows its single local repo (findLocalFolderWorkspaceRuntimeRepo, which also checks the folder and its group are on this machine), a repo-less folder has no runtime, and for a launch a \\wsl$ path with no saved runtime is not checked against main's distro list (main never refused these launches, because it read such a repo as Windows; the agent list still checks it, as on main). Window code is unchanged, apart from one line passing shell: undefined now that the input is required (the window quotes by the Settings shell its tab's spawn also reads).
  • One runtime answer per launch. AgentLaunchRuntime { platform, pty } (src/shared/agent-launch-runtime.ts), where pty is the spawn's own shell-and-distro type. The command's quoting style is computed from it (agentLaunchQuotingShell), never stored, so it cannot disagree with the shell. Plain terminals and agents use one PTY function (resolveLocalPtyOptions).
  • One host path. runtime-agent-terminal-startup.ts is the path every host terminal create goes through. An agent the host plans (asked for by name, or a typed bare command) is quoted from the runtime answer, and that answer rides in memory into the PTY spawn (spawn-preflight.ts takes the shell only from it). A command the caller wrote itself keeps today's spawn rule unless the caller passes the answer it used. Qoder's two-name check runs once here and probes where the process runs: a \\wsl$ working directory first, then a WSL shell. The window's own Qoder check stays until C2.
  • Every host caller quotes from the answer and passes it on: agent.launch, phone sessions (including the stalled-window fallback and the refresh path), resume, createAgentSession, worktree-create startups, automations and workers. An agent started in an existing worktree uses that worktree's answer. A new worktree's startup is planned before the worktree exists, so it uses where the worktree will land: its WSL-share base folder when one is set, else the repo (newWorktreeLaunchScope). shell is now a required input of the launch-command builder; the compiler enforces it in the typed planner files, and the other host callers (several runtime files skip type checking) were checked by reading.
  • Disabled agents keep main's refusal, in main's order. Main's three-line "Agent X is disabled" refusal stays in runtime-agent-terminal-startup.ts; it now runs before the runtime is looked up, so a disabled agent in a project whose runtime needs repair is refused as disabled, as on main (the earlier head of this PR gave the repair error first). A test pins it.
  • No wire change. No new RPC fields, error codes, capability, fingerprint input or receipt change.

Why

One rule and one answer remove the class of bug where a command's quoting and its shell come from different places, instead of patching each caller. The host resolves with main's own WSL data on purpose: the window's WSL facts are an earlier copy that can disagree before its first load, after its 30-second cache, or after an IPC failure. Alternatives considered: keeping two rules and syncing them (that is today's drift); a new shared resolver for both sides (more code, and it would change the window in a step meant to change only the host).

Approved departures from the plan (10-11)

  • Moved to C2: the new agent.launch request fields (title, extraAgentArgs, requestKind, terminalOnly), their capability, their fingerprint handling, and the two window-parity switches (prompt on the command line, Codex waiting for the shell). C2 has their first sender; this PR keeps today's host behaviour for all of them.
  • No shared resolver: main's existing resolver is extended instead, and window code is untouched apart from that one required-input line. C2 adds a characterization row showing the window and the host agree.
  • Folders follow the window. A folder with one repo uses that repo's runtime; a folder with no repo is placed only by its \\wsl$ path and is never refused for repair.
  • Every host launch caller is folded in, including createAgentSession.
  • Disabled agents stay refused at launch, as on main. This PR keeps main's 3-line refusal in runtime-agent-terminal-startup.ts.
  • Split (10-12): each side fix that was in this PR is now its own small PR stacked on it (listed below). Where this PR's new path would otherwise change behaviour for those cases, it keeps main's with temporary code and a test.

Rules that differ from the window or from a plain reading of the settings

The first three are in agentLaunchProjectRuntime (agent-launch-scope-runtime.ts); the others name their file. Only the first row is permanent; it is a fix, not parity, and must stay when the temporary rows are removed.

Rule Why Removed by
Permanent fix. A repo on a WSL share whose project is set to the Windows host: its path places the agent, so the command is written for Linux and runs in WSL. The terminal runs a \\wsl$ working directory in WSL whatever the setting says. Nothing. The window adopts it in C2.
Temporary. A folder whose repo runs on the Windows host (no runtime setting and a Windows-host global default, or set to the Windows host) keeps today's answer: launches the background service spawns run in WSL with a Linux-style command when the Terminal shell is WSL, and launches the window opens (the phone or a desktop chat while a window is open) keep today's split: the window opens a PowerShell tab, following the repo's Windows-host runtime, and the command is Linux-style, as on main, until C2 moves the window onto the same answer. Only folders reach it: every local repo has a project. An explicit "Windows host" can't yet be told apart from the shipped default. STA-10231, the WSL-shell default decision (after C8).
Temporary. OpenCode in a folder whose repo runs in WSL: every OpenCode launch keeps today's answer (the Terminal shell, with models checked on Windows), for starting, resuming and the worker's model check alike. It is also exempt from change 4's repair refusal. Not a visible change. Orca can't yet verify OpenCode models inside WSL, and a chat must resume where it was started. STA-10251 (verify OpenCode models inside WSL).
Temporary. The worker's OpenCode model check treats only a \\wsl$ path as WSL (orca-runtime-get-terminal-interactive-wait.ts). Main's rule, so the check agrees with the row above. STA-10251.
Temporary. For a launch, a \\wsl$ path with no saved runtime is not checked against Orca's cached distro list, but the agent list the phone, web and desktop show for such a worktree still is, as on main (trustsWslPath in local-project-runtime-resolution.ts). The agent list is a separate visible change. S2: the agent list trusts the path too.
Temporary. orca terminal create --shell with an agent is refused if main's project-only runtime refuses it, before the agent's own runtime is checked (runtime-agent-terminal-startup.ts). So --shell wsl.exe for an agent in a \\wsl$ repo saved as Windows host, or with no setting and a Windows-host default, is still refused. The refusal's words stay main's. Accepting those is a separate visible change. S3a (the decision); S3b (the words).
Temporary. Picking an OpenCode model in a \\wsl$ repo not set to WSL: the model is checked on Windows, as on main, while the command is written for Linux, where OpenCode runs (openCodeModelCheckPlatform, used by the shared planner and createAgentSession). Refusing the pick is a separate visible change. S4.
Temporary. A repo's project is found only through the projects that list the repo, as on main; the window also takes a project named after the repo (local-project-runtime-resolution.ts). Only differs for a project named after a repo that no longer lists it; projects Orca builds itself never look like that. Matching the window is a separate visible change for that data. S5.
Until C4. A command its caller quoted itself keeps the spawn's own shell rule (runtime-agent-terminal-startup.ts). Those callers aren't moved yet. C4.
Until C2. The window still quotes by the Terminal shell and keeps its own Qoder check, including in WSL-share repos set to the Windows host. Window code is untouched in C1. C2.

Known: a folder's agent list and its launch can disagree, unchanged from main

Checked case by case against main (96 probe cases on each). This PR changes no folder's agent list; where it changes a folder's launch, the launch now agrees with the list. These disagreements remain exactly as on main:

  • A local folder in a group tagged for another host still lists its repo's agents but starts with the Terminal shell. Follow-up: decide whether a group's host tag affects the folder, then use one rule for listing and launching.
  • A folder whose repo runs on Windows still starts in the WSL Terminal shell while listing Windows agents. Follow-up: STA-10231.
  • A folder without exactly one repo still lists this machine's agents even when its path or the Terminal shell starts the agent in WSL. Follow-up: decide where a repo-less folder's agent list should look.
  • A folder on a WSL share can start in its path's distro while its agent list refuses an out-of-date distro list. Follow-up: the stacked S2 (fix(agent-detection): trust a WSL share path's distro in the agent list, over Orca's cached distro list #28233), plus a folder test.
  • A folder on a WSL share runs in that share's distro even when its saved runtime makes the agent list look at Windows or another distro. Follow-up: decide how a share's distro should limit the agent list.
  • OpenCode in a folder still follows the Terminal shell while the folder's agent list follows its repo's runtime. Follow-up: STA-10251.

Size

Net production +455, tests +412 (against the main this branch merged; the automatic line-count table counts the 8-line C0 test-cases file as production, so it shows 8 more production and 8 fewer test lines).

  • Against this PR's previous head (+479 / +355): the side fixes now in stacked PRs take out 73 production lines, and the temporary code that keeps main's behaviour for them adds 35 (S2 +2, S3 +6, S4 +28, S5 −1). Moving the disabled-agent refusal is line-neutral.
  • Tests: the stacked PRs take their tests with them (−43), each temporary behaviour has a test that pins main's behaviour (+61), and the disabled-agent order has one (+21).
  • f587ab5 puts the folder agent list back on main's code (workspace-agent-detection.ts is now identical to main; that file had dropped 14 net lines), plus one test that pins it (+18).

History

Normal pushes only; no history rewrite since round 1. 2147865 moved the side fixes out to stacked PRs (a normal push). f587ab5 restored main's folder agent list, which the earlier head had changed by also reusing the launch lookup there (a normal push). Main was merged twice: once before the split (one import conflict in runtime-terminal-contracts.ts, both kept), and again at b21a289 after the branch fell into conflict (one conflict in the same file: main's account-environment field and this PR's launch runtime field, both kept; plus one main test given the now-required runtime field).

Stacked on this PR

Each is a draft with one change, stacked in this order:

Linked Issue

Part of the launch-convergence plan (step C1). Follow-ups for the temporary differences: STA-10231 (WSL Terminal shell in folders), STA-10251 (OpenCode in WSL folders). Not changed here, as on main: orca worktree create --agent still prints "could not confirm" when the workspace was created but its agent was refused; a "workspace created, agent refused" answer is its own design question.

Visual Proof

No new UI. Live QA on Windows (a hidden test copy of Orca with an isolated profile and real Claude/Codex; WSL Ubuntu-24.04), main 57a7c22 vs this PR (final rows on 20ce184). Re-QA of this head (2147865) against main 1e48f44 for the rows the split touched (hidden test copies, real Codex/Claude/OpenCode): the --shell refusals, the OpenCode picked-model refusal and the disabled-agent refusal read word for word as on main, including a disabled startup agent in a folder whose WSL runtime needs repair ("Agent codex is disabled. Choose an enabled agent.", before any repair message); an agent started in a folder whose one repo is set to a WSL distro that isn't installed is refused (main starts it on Windows), as change 4 says; W1 and W2 below are still fixed on this head.

W2: Terminal shell set to WSL, a repo with no runtime of its own, global default Windows host, a worktree created with a startup agent and the prompt it's W2: reply OK.

Before (main): a Command Prompt pane with a Linux-style command, so Claude received --dangerously-skip-permissions as its message and the prompt was lost.

Before: main starts Claude in Command Prompt with a Linux-style command

After: a PowerShell pane with a PowerShell-style command; Claude receives it's W2: reply OK and answers.

After: Claude in PowerShell receives the prompt intact

W1 (worktree-create startup in a repo on a WSL share, Codex, prompt it's a C1 test: reply with exactly the words 'two spaces' here; WSL panes render blank in hidden screenshots, so this is the argument list Codex received):

  • Before (main): its a C1 test: reply with exactly the words two spaces here (apostrophes lost)
  • After: it's a C1 test: reply with exactly the words 'two spaces' here

Testing

  • Live tested on Windows (hidden test copies of Orca with real Claude, Codex and OpenCode; WSL Ubuntu-24.04), see Visual Proof; not tested on macOS, Linux or SSH hosts, where nothing changes
  • Automated tests added/updated

New tests cover what later steps rely on: the runtime rule on the host (repo with a WSL project, folder holding one WSL repo, repo-less folder), main's distro list refusing a saved distro it doesn't know while a \\wsl$ repo is never refused at launch, the answer quoting for the shell the terminal gets, a \\wsl$ path placing the agent whatever the setting, the temporary folder rule, OpenCode in a WSL folder staying on Windows at each entry point (create, resume, the worker's model check), the host path deriving the answer, quoting from it and handing it to the spawn, Qoder probing where it runs, a worktree startup quoting from its answer, a folder whose one repo's WSL distro is gone refused by the real planner through the real chat-create request with main's words, and a disabled agent refused as disabled before a runtime that needs repair. Each temporary behaviour kept from main has its own test (agent list distro check, --shell refusal, OpenCode model check, project lookup); each stacked PR flips its test. The spawn taking its shell only from the answer is covered end to end by the C0 row below. Each was checked by breaking its production line and seeing it fail.

Not tested: the OpenCode model-check test (picking a model in a \\wsl$ repo still checks it on Windows, as on main) runs through createAgentSession only; the same check in the shared launch planner (runtime-agent-terminal-startup.ts, the route orca agent launch --model and C2's OpenCode tab use) was verified by reading the code, and live by the Windows re-QA row for orca agent launch --agent opencode --model. Also not tested: the phone's refresh path rethrowing a repair message (it re-derives the answer, which throws only when the runtime needs repair; the plain-shell fallback for other failures stays covered by main's phone tab tests), and a new worktree's startup reading its WSL-share base folder (newWorktreeLaunchScope).

Characterization suites (C0). The C0 suites on main (pty-launch-parity, pty-launch-race-parity, pty-pane-materialization-race, launch-parity-window-tab, launch-agent-background-session-launch-parity, terminal-startup-queue-restart) pass unchanged. This PR adds one row to the host table: Windows, \\wsl$ repo with no saved runtime → Linux-style command, wsl.exe + Ubuntu at the terminal. It fails when the \\wsl$ rule is removed.

On 2147865: tc:node, tc:web and tc:cli pass. Vitest on 44 named files (every test that imports a module the split touched, the agent-launch request tests and the C0 suites): 604 pass. Each stacked branch passes tc:node, the same files and the changed-code quality check. The earlier wide run (894 files, 10,842 tests) was on the previous head; in it one test failed locally, not from this change: orca-runtime-agent-session-operation "shapes the launch for the route it resolved" expects the Linux-only orca-ide name, so it passes only on a Linux host (CI). orca-ci-checks --no-typecheck is clean except its typecheck:ci step, which fails to start under bun locally ("Script not found check"); the typechecks above cover it, and CI runs it.

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

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • SSH: remote launches keep their path-based quoting and the remote's own shell; the answer carries no shell for them.
  • Mixed versions: no wire change; what the host publishes is unchanged apart from the commands it plans.

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 (no new UI; before/after shell evidence above)
  • 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)

…me rule and one runtime fact

Host-started agent launches now pick their platform with the same rule the
window uses (project runtime, else a \\wsl$ path, else the host), and resolve
one runtime fact that supplies both the command quoting and the PTY shell.
Adds the agent.launch.terminal-inputs.v1 capability and its optional
title/extraAgentArgs/requestKind/terminalOnly fields; no sender yet.
OpenCode's createAgentSession stays on today's rules until C2 (temporary).
@brennanb2025
brennanb2025 force-pushed the brennanb2025/conv-c1-host-planner branch from 18b8025 to d12a54e Compare October 12, 2026 00:20
…quoted commands carry it

Round-1 review fixes for C1:
- Window and host read a workspace's runtime through one shared resolver
  (local-workspace-execution-runtime.ts); a repo-less \\wsl$ folder gets no
  runtime, as in the window.
- The fact is { platform, remote, pty } with the spawn's own PTY type; the
  quoting shell is derived from it, never stored.
- createAgentSession uses the same fact (its pre-C1 exception is deleted).
- Worktree startups quote from a fact for the repo and pass it on; a runtime
  that needs repair fails the startup, not the create. `shell` is required
  when building a launch command.
- The host planner stamps a fact only on commands quoted with it; a
  caller-quoted command keeps the spawn's own rule.
- Qoder probes where the process runs (\\wsl$ cwd, then a WSL shell).
- wslShellRule 'host-legacy' keeps today's WSL-shell outcome where no
  project chose a runtime (temporary, removed by C8).
- terminalOnly reaches the early-tab decision with an accurate receipt
  sentence; the unused client gate is removed.
- Adds one host C0 row for a \\wsl$ repo with no saved runtime.
… resolver, one answer per workspace

Problem: the first round still carried request fields and window-parity
switches that only the next step sends, added a new shared resolver that
also changed window code, and left some background launches using a
different runtime answer than the one they spawn with.

- Move the agent.launch request fields, their capability and fingerprint
  handling, and the prompt/Codex parity switches out to the next step;
  today's host behaviour is kept.
- Drop the shared resolver: main's resolveLocalWorkspaceRuntime now finds
  the project by repo id or source repos, folders borrow their single
  local repo, and a \\wsl$ path is not refused on a stale distro list.
  Window code is back to main.
- Agents started in an existing worktree use that worktree's answer; the
  phone's fallback paths spawn with the answer they quoted for, and a
  runtime that needs repair shows its message instead of a plain shell.
- The OpenCode model check looks where the agent will run.
- A Windows --shell in a \\wsl$ workspace names the path, not a runtime
  setting that cannot change it.
- The temporary folder rule names its follow-up, STA-10231.
…indows runtime

Problem: once a folder follows its repo's WSL runtime, an OpenCode launch
that picks a model would be checked and started inside WSL, where Orca
cannot yet verify OpenCode models, so picks that work today could be
refused.

Where main had no runtime for the scope (only folders), a model-picked
OpenCode launch keeps main's answer. Start, resume and the worker's model
check read the same answer. Temporary until OpenCode models are verified
inside WSL.
…s quoted for where they land

Problem: round 2's OpenCode exception keyed on a model pick, so a resumed
chat could run somewhere other than where it started, and the worker's
model check read WSL from the Terminal shell and refused folders that work
today. A new worktree's startup used the repo's answer even when the
worktree lands in a WSL share.

- In a folder whose repo runs in WSL, every OpenCode launch keeps main's
  Windows answer: create, resume and the worker's model check agree. The
  model check reads WSL from the path alone, as main did. STA-10251.
- A new worktree's startup is planned for its WSL-share base folder when
  one is set (newWorktreeLaunchScope).
- A \\wsl$ working directory runs in WSL whatever the project says, so
  non-OpenCode agents there are written for Linux.
- The planner test derives the answer instead of passing it in.
- Smaller shapes for the PTY settings type, the cache-less resolve,
  executionRuntimePlatform, spawnShellInputs and two comments.
…ides; OpenCode follows the WSL-share fix

Problem: OpenCode in a repo on a WSL share whose project is saved as
Windows host still got PowerShell quoting typed into WSL, because the
WSL-share fix skipped OpenCode. The fix and the two temporary parity
rules were also split across two returns, so deleting the temporary
ones could take the permanent fix with them.

- One expression decides when the path places the agent, each term
  labelled: WSL share + Windows host (permanent fix), folder + Windows
  host (STA-10231), OpenCode in a folder (STA-10251).
- OpenCode now gets the WSL-share fix too; a model pick there is refused,
  as main's model check already did.
- The OpenCode entry-point tests set a WSL Terminal shell, so the model
  check test fails if it reads WSL from that shell again.
- Tests trimmed with no coverage loss; the spawn-precedence unit test is
  dropped (the C0 WSL-share row covers the reachable case).
…host-planner

# Conflicts:
#	src/main/runtime/runtime-terminal-contracts.ts
…spawns

Live Windows QA (Terminal shell wsl.exe, global default Windows host, repo
with no project setting) saw an agent command written with PowerShell
quoting typed into a WSL pane, so codex lost the apostrophes in its prompt.
The host wrote the command for its own answer (Windows, PowerShell), but on
routes where the window spawns the pane (the phone while a window is open,
a focused desktop chat create, `orca terminal create --command` in a repo)
the window spawned it by the Terminal shell, which is WSL. Quoting and the
pane came from two different answers.

Those routes ran in WSL with Linux-style quoting on main and worked, so the
temporary host-legacy term (STA-10231) now also covers them: when the window
spawns the pane, the path and Terminal shell decide, as on main. Background
routes keep the approved change (PowerShell instead of cmd.exe with
Linux-style quoting, which was broken on main). createTerminal and the
pre-launch planning share one `windowSpawnsTerminal` rule so they can't
disagree about who spawns the pane.
…ot an unknown outcome

`orca agent launch` into a folder whose one repo is set to a WSL distro that
is no longer installed printed "Orca could not confirm the launch outcome;
the agent may already be running", although nothing had started. The host
knew the launch was refused before any spawn, but the refusal went out as
the generic `runtime_error`, which the CLI must treat as possibly started.

The launch planner now raises that refusal under its own code,
`project_runtime_repair_required`, with the same message, and the RPC layer
passes the code through. The CLI then prints the repair message as a plain
failure. Older CLIs read the unrecognised code as a failure too; a newer CLI
against an older host still gets `runtime_error`, as before.
…em on a retry

The repair refusal from the last commit read "Project runtime requires repair
before terminal spawn: wsl-distro-missing", an internal reason code rather
than what happened and what to do. It now says, for example, "No agent was
started. Ubuntu is not installed in WSL. Choose an installed distro or switch
this project to Windows.", adding "This project follows the default in
Settings > Project Runtime." when the runtime came from the default.

Those sentences are the project settings page's own. They now live in one
shared module that maps each repair reason to the page's existing
translation key; the settings page passes its translator, and the host writes
English, since it also runs headless where the desktop's translations can't
load. The planner checks for a repair before the shell lookup, so the shared
spawn message, which window spawns still use, is untouched.

A retried launch (`--retry-launch`, or a phone resend) used to answer with
the bare error code. The failed launch record now keeps the refusal's words
and the retry repeats them.
…eep the host's English equal to the window's

A retried launch now repeats a coded refusal's own words, but nothing tested
it. A new case refuses a launch with a coded error and checks the retry
answers with the same words.

The repair sentences live in one shared module whose English the host
writes and whose keys the settings page translates. The localization checks
can't see call sites outside the window and main, so the module's test now
checks each sentence against the window's English catalog for its key.

Smaller, behaviour-identical tidy-ups: the reason-to-words mapping is a
table, the refusal type fits on one line, and the length cap the retry
words share with folder refusals has a neutral name.
@brennanb2025

brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Status: ready for review (head b21a289)

The problem, in one line. On Windows, agents that Orca's background service starts (the orca CLI, the phone, workers, automations, worktree create --agent, resume) could get a command written for one shell and typed into another, which mangled their arguments; folders also ignored their repo's runtime.

What changes for users. Only on Windows, only for background-started agents: a repo on a WSL share gets a Linux-style command and its arguments arrive intact; with the Terminal shell set to WSL, a repo on the Windows host starts in PowerShell with a PowerShell-style command; a folder with one repo uses that repo's runtime (and is refused, in main's words, when that WSL runtime needs repair). Everything else stays as on main.

This PR was split (one thing per PR). Five other fixes that were in it are now their own drafts stacked on it, in merge order: #28232, #28233, #28234, #28235, #28236, #28237. Where this PR's new path would otherwise change behaviour for those cases, it keeps main's behaviour with temporary code and a test; each stacked PR removes its own piece.

Review. Six full rounds before the split (to 20ce184). After the split: a delta review of the split (no findings), then one review of the whole stack that ran every pin (each passes on its PR and fails on the one below). That review found one change that had crept into this PR: the agent list for a folder in a group tagged for another host. f587ab5 puts that agent list back on main's code (workspace-agent-detection.ts is identical to main) and adds a test that pins it; nothing else changed since QA.

Folder agent list vs launch. Checked case by case against main (96 probe cases on each): no new disagreement. This PR changes no folder's agent list, and every folder launch it changes now agrees with the list. Six disagreements that main already has are listed in the body under "Known", each with its follow-up.

Live QA on Windows (hidden test copies of Orca, real Claude, Codex and OpenCode, WSL Ubuntu-24.04), this PR at 2147865 vs main 1e48f44:

Row Main This PR Verdict
Agent in a \\wsl$ repo, prompt with an apostrophe and two spaces apostrophes lost arrives intact fixed
Terminal shell WSL, repo on the Windows host, Claude with "it's W2: reply OK" (first QA run) cmd.exe, prompt lost PowerShell, Claude answers fixed
--shell wsl.exe / --shell pwsh.exe in \\wsl$ repos refused refused, same words as main
OpenCode with a picked model in \\wsl$ repos and a WSL folder refused refused, same words as main
Hidden Codex started in a folder whose WSL distro is missing "Agent codex is disabled…" same as main
Agent in a folder whose one repo's WSL distro is missing starts Codex on Windows refused with main's repo wording change 4, as described

f587ab5 was not re-run live: it only changes the agent list back to main's code, covered by its test.

Readiness against current main (4857afd, not merged in): merges cleanly; every touched file is under the line limit; the repo checks pass on the merged code (lint, code quality, typecheck), except one local tool step that cannot start here and that CI runs itself.

Main merged in (b21a289): the branch had fallen into conflict with main, so main (0903ed9) was merged in once, as a merge commit. One file conflicted, runtime-terminal-contracts.ts: main's new account-environment field and this PR's launch runtime field are both kept. One main test (account environment over a worktree startup) needed the launch runtime field this PR makes required; it now also checks the field survives main's change. Main's new launch routes (agent account environment, automation workspace tabs) go through this PR's launch path. The code that decides a launch's runtime is unchanged; every pinning test, the typechecks and the wider test set pass.

CI: green on b21a289 (26 pass, 0 fail). Main's replay-test breakage that was red on f587ab5 was fixed by #28286.

Not verified: macOS, Linux and SSH hosts live (nothing changes there; covered by tests); the window's "+" tab and the phone with a window open (unchanged in this PR); the share-folder and repo-id edge cases of the stacked PRs live (they need hand-made data).

@brennanb2025
brennanb2025 marked this pull request as ready for review October 12, 2026 12:12
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Agent launches now resolve platform, shell, and PTY options from the launch scope and runtime. Startup planning uses the resolved shell and passes the launch runtime through session, worktree, mobile-terminal, and PTY creation paths. The changes also add runtime-resolution coverage for WSL paths, folder workspaces, shell selection, OpenCode model checks, and launch errors.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b21a2

Agent launches from a Windows workspace into a WSL-share folder can corrupt command arguments. Align runtime selection with the startup folder in both launch paths before merging; refusal messages may also be lost on retry.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 49 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is comprehensive and covers the required change summary, rationale, testing, visual proof, compatibility considerations, linked follow-ups, and checklist. Some optional or conditional …
Title check Passed The title clearly identifies the main change: host-side agent launches now use the window's runtime rule and one runtime fact. It is concise and specific.
  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Preserve the refusal message for replayed launches. · agent-launch.ts:248

src/main/runtime/rpc/methods/agent-launch.ts:248
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve the refusal message for replayed launches.

When an OpenCode create-worktree or reused-terminal launch includes unsupported model or session preferences, resolveUnlaunchedIntent throws an OrchestrationError with a specific refusal message. This catch stores only the error code, so retrying the same operation ID returns a generic message instead of the original refusal.

Suggested fix
-    await settleQuietly(admission.fail(agentLaunchFailureCode(error)))
+    await settleQuietly(admission.fail(agentLaunchFailureCode(error), error))

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13010826-c3b7-42cf-9904-27ff213da5af
📥 Commits

Reviewing files that changed from the base of the PR and between c43ac3f and 20ce184.

📒 Files selected for processing (49)
  • src/main/ipc/pty-launch-parity-host.test-cases.ts
  • src/main/ipc/pty/runtime/spawn-preflight.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/local-project-runtime-resolution.ts
  • src/main/opencode/opencode-model-startup-plan.test.ts
  • src/main/preflight/workspace-agent-detection.ts
  • src/main/runtime/agent-launch-scope-runtime.test.ts
  • src/main/runtime/agent-launch-scope-runtime.ts
  • src/main/runtime/opencode-wsl-folder-launch-host.test.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-agent-session.ts
  • src/main/runtime/orca-runtime-create-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-create-terminal-dependencies.ts
  • src/main/runtime/orca-runtime-create-terminal.ts
  • src/main/runtime/orca-runtime-get-agent-session-execution-namespace.ts
  • src/main/runtime/orca-runtime-get-terminal-interactive-wait.ts
  • src/main/runtime/orca-runtime-perform-mobile-session-pty-records-refresh.ts
  • src/main/runtime/orca-runtime-resolve-mobile-session-terminal-command.ts
  • src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts
  • src/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.ts
  • src/main/runtime/orca-runtime-run-create-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-terminal-create-deduplication.ts
  • src/main/runtime/qoder-terminal-command-resolution.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/agent-launch-execution-outcome.ts
  • src/main/runtime/rpc/methods/agent-launch-failure-code.ts
  • src/main/runtime/rpc/methods/agent-launch-pane-reservation.test.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.ts
  • src/main/runtime/rpc/methods/agent-launch.ts
  • src/main/runtime/runtime-agent-launch-resolution.ts
  • src/main/runtime/runtime-agent-terminal-startup.test.ts
  • src/main/runtime/runtime-agent-terminal-startup.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/main/runtime/runtime-worktree-agent-startup.test.ts
  • src/main/runtime/runtime-worktree-agent-startup.ts
  • src/main/runtime/terminal-shell-override-host-support.ts
  • src/renderer/src/components/settings/ProjectWindowsRuntimeSetting.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/project-runtime-repair-message.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/shared/agent-launch-runtime.ts
  • src/shared/agent-startup-plan-inputs-extra-agent-args.test.ts
  • src/shared/agent-startup-plan-inputs.test.ts
  • src/shared/agent-startup-plan-inputs.ts
  • src/shared/project-runtime-repair-message.ts
💤 Files with no reviewable changes (1)
  • src/main/runtime/qoder-terminal-command-resolution.ts

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

@brennanb2025

brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

On the outside-diff note about src/main/runtime/rpc/methods/agent-launch.ts:248 (a retried launch loses the refusal words when the launch is refused before anything is created): no change in this PR. That line is unchanged from main, and main already replays only the code there, so this is an existing main behaviour, not something this PR introduced, and it stays out of this PR. The new refusal this PR adds (project needs WSL repair) is raised later in the launch, where the words are already kept. Tracked as a follow-up: pass the error as the second argument, admission.fail(agentLaunchFailureCode(error), error).

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status: back to draft. This PR is being split into smaller stacked PRs so each one does one thing: this PR keeps the core (one runtime answer per launch, so a command's quoting and its shell always agree), and the earlier refusal for a WSL setup that needs repair, the \\wsl$ distro check, the --shell refusal message, and the OpenCode model refusal in WSL-share repos each move to their own PR on top of it.

… change it

The repair refusal's own code and words, the \\wsl$ path's distro in the agent list,
--shell refusals for agents (decision and words), OpenCode's model check in a \\wsl$ repo,
and finding a repo's project by its id move to their own stacked PRs. Until they land,
each keeps main's behaviour with temporary code and a test that pins it.

A disabled agent is refused as disabled before its runtime is looked at again, as on main.
…names another host

The agent list for a folder reads the folder's own host pin, as on main; only launches also
read the containing group's host tag.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 10:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Quote the agent startup command for the effective… · runtime-agent-terminal-startup.ts:119-139

src/main/runtime/runtime-agent-terminal-startup.ts:119-139
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Quote the agent startup command for the effective startup cwd when that cwd is a WSL share.

When startupAgent is set, opts.cwd is a \\wsl$ path outside the workspace, and the workspace runtime is Windows, the planner still quotes the agent command for the workspace runtime. The PTY then starts under wsl.exe from the startup cwd. The command can reach the WSL shell with PowerShell-style quoting, which can corrupt its arguments.

The runtime comes from resolveAgentLaunchRuntime(store, workspace, opts.shellOverride, plannedAgent), not from the startup cwd. The startup cwd is resolveTerminalStartupCwd(workspace.path, opts.cwd) ?? workspace.path, and that value is not constrained to the workspace. The Windows-host WSL exception checks only the workspace path. Choose the runtime from the effective startup cwd, or refuse when the runtime and the WSL-share cwd disagree. Changing only the session-creation caller leaves this path unchanged, because this path resolves its own runtime.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49a7b42b-dc7b-495c-9cca-1dfc5febe9ed
📥 Commits

Reviewing files that changed from the base of the PR and between e18b2fd and b21a289.

📒 Files selected for processing: 11
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/orca-runtime-create-agent-session.ts
  • src/main/runtime/orca-runtime-create-terminal.ts
  • src/main/runtime/orca-runtime-get-agent-session-execution-namespace.ts
  • src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts
  • src/main/runtime/runtime-agent-terminal-startup.ts
  • src/main/runtime/runtime-local-worktree-terminal-startup.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/main/runtime/runtime-worktree-agent-startup.test.ts

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

Comment on lines +136 to +141
const launchRuntime = this.resolveAgentLaunchRuntime(workspace, request.agent)
const startupArgs = resolveAgentStartupPlanInputs({
agent: request.agent,
settings,
platform: this.getAgentLaunchPlatformForWorkspace(workspace),
platform: launchRuntime.platform,
shell: agentLaunchQuotingShell(launchRuntime),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '95,160p' src/main/runtime/orca-runtime-create-agent-session.ts
sed -n '185,205p' src/main/runtime/orca-runtime-create-agent-session.ts
sed -n '15,55p' src/shared/terminal-startup-cwd.ts

Repository: stablyai/orca

Length of output: 6001


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- changed hunk and relevant callers ---'
git diff --no-ext-diff --unified=35 0903ed9577fc46ce29e34ea49924dfa4fb5dc1ad b21a2899cdfdf32d27a5e2e9f3d9d1027cc04eb2 -- src/main/runtime/orca-runtime-create-agent-session.ts src/main/runtime/runtime-agent-terminal-startup.ts src/main/runtime/agent-launch-scope-runtime.ts src/main/providers/local-pty-launch-plan.ts
printf '%s\n' '--- request validation and startup CWD bindings ---'
rg -n -F --glob '*.ts' -e 'startupCwd' -e 'resolveWorkspaceTerminalStartupCwd' -e 'resolveAgentLaunchRuntime' src/main src/shared | head -160
printf '%s\n' '--- runtime resolver and PTY launch blocks ---'
rg -n -F --glob '*.ts' -e 'function resolveAgentLaunchRuntime' -e 'resolveAgentLaunchRuntime(' -e 'shellPath = ' -e 'wsl.exe' -e 'isWslUncPath' src/main | head -200
printf '%s\n' '--- exact source excerpts ---'
sed -n '1,240p' src/main/runtime/agent-launch-scope-runtime.ts
sed -n '150,245p' src/main/providers/local-pty-launch-plan.ts
sed -n '1,220p' src/main/runtime/runtime-agent-terminal-startup.ts

Repository: stablyai/orca

Length of output: 43018


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- runtime helper contracts ---'
rg -n -F --glob '*.ts' -e 'export function agentLaunchQuotingShell' -e 'function agentLaunchQuotingShell' -e 'type AgentLaunchRuntime' -e 'interface AgentLaunchRuntime' src/shared src/main
sed -n '1,180p' src/shared/agent-launch-runtime.ts
printf '%s\n' '--- launchRuntime propagation and PTY projection ---'
rg -n -F --glob '*.ts' -e 'launchRuntime' -e 'terminalWindowsWslDistro' src/main/runtime src/main/providers src/main | head -220
rg -n -F --glob '*.ts' -e 'resolveLocalPtyOptions' -e 'resolvePlainTerminalPtyOptions' src/main
printf '%s\n' '--- request schema and effective CWD ---'
rg -n -F --glob '*.ts' -e 'RuntimeCreateAgentSessionRequest' -e 'startupCwd' src/shared src/main | head -180
sed -n '1,180p' src/shared/agent-session-host-authority.ts
printf '%s\n' '--- shell override refusal and runtime repair ---'
sed -n '1,240p' src/main/runtime/terminal-shell-override-host-support.ts
rg -n -F --glob '*.ts' -e 'runtime_needs_repair' -e 'needs repair' -e 'resolveLocalPtyOptions' src/main/local-project-runtime-resolution.ts src/main | head -160

Repository: stablyai/orca

Length of output: 41811


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- shared runtime helper ---'
rg -n -F --glob '*.ts' -e 'agentLaunchQuotingShell' -e 'AgentLaunchRuntime' src/shared src/main | head -120
sed -n '1,180p' src/shared/agent-launch-runtime.ts
printf '%s\n' '--- exact launchRuntime consumers ---'
rg -n -F --glob '*.ts' -e 'launchRuntime' src/main | head -240
printf '%s\n' '--- local runtime resolution ---'
rg -n -F --glob '*.ts' -e 'function resolveLocalPtyOptions' -e 'export function resolveLocalPtyOptions' -e 'resolveLocalPtyOptions(' -e 'resolvePlainTerminalPtyOptions' src/main
sed -n '1,260p' src/main/local-project-runtime-resolution.ts
printf '%s\n' '--- request contract ---'
rg -n -F --glob '*.ts' -e 'RuntimeCreateAgentSessionRequest' -e 'startupCwd' src/shared/agent-session-host-authority.ts src/main | head -180
printf '%s\n' '--- refusal path ---'
sed -n '1,260p' src/main/runtime/terminal-shell-override-host-support.ts

Repository: stablyai/orca

Length of output: 42133


Resolve the launch runtime from the effective startup CWD.

startupCwd can be a \\wsl$ path outside the workspace. The session currently quotes the command from the Windows workspace runtime, then passes that runtime with the WSL CWD to terminal creation. The local provider starts wsl.exe for that CWD, so the Windows-quoted command can be interpreted by a Linux shell.

Pass the effective CWD to runtime selection. Keep project-runtime resolution on the original workspace so repair-required runtimes still refuse before spawning.

Suggested fix
diff --git a/src/main/runtime/agent-launch-scope-runtime.ts b/src/main/runtime/agent-launch-scope-runtime.ts
@@
 export function agentLaunchProjectRuntime(
   store: LaunchScopeRuntimeStore,
   scope: TerminalWorkspaceLaunchScope,
-  agent: TuiAgent | undefined
+  agent: TuiAgent | undefined,
+  effectiveCwd = scope.path
 ): ProjectExecutionRuntimeResolution | undefined {
@@
-    (onWindowsHost && isWslUncPath(scope.path)) ||
+    (onWindowsHost && isWslUncPath(effectiveCwd)) ||
@@
 export function resolveAgentLaunchRuntime(
   store: AgentLaunchRuntimeStore,
   scope: TerminalWorkspaceLaunchScope,
   requestedShellOverride: string | undefined,
-  agent: TuiAgent | undefined
+  agent: TuiAgent | undefined,
+  effectiveCwd = scope.path
 ): AgentLaunchRuntime {
@@
-  const projectRuntime = agentLaunchProjectRuntime(store, scope, agent)
+  const projectRuntime = agentLaunchProjectRuntime(store, scope, agent, effectiveCwd)
   return {
-    platform: executionRuntimePlatform(projectRuntime, scope.path, process.platform),
+    platform: executionRuntimePlatform(projectRuntime, effectiveCwd, process.platform),

Update the agent-session caller and its runtime wrapper to pass startupCwd ?? workspace.path.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant