Skip to content

fix(windows): use project runtime for folder agent launches - #28136

Draft
brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/sta-10231-explicit-windows-host
Draft

brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/sta-10231-explicit-windows-host

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On Windows, an agent in the same folder workspace could run on Windows from + but in WSL from a phone, command-line launch or worker. Host launches treated the folder key as a repository ID, missed its project runtime, and used Terminal shell instead. That could select a different installation, login, tools or WSL distro.

Agent launches in a native-drive folder containing exactly one local project repository now follow that project's explicit Windows choice, explicit WSL distro or inherited global WSL distro. The inherited Windows default keeps its existing behavior while the separate settings decision is pending.

What Changed

These cells apply to host-built agent launches with a native-drive starting directory. “Shell distro” is the distro selected in Terminal shell.

Project runtime Terminal shell Before → after
Explicit Windows WSL Shell distro → Windows
Explicit Windows PowerShell or cmd Windows → Windows; host keeps shell-specific quoting
Explicit WSL WSL Shell distro → project distro
Explicit WSL PowerShell or cmd Windows → project distro
Inherit global WSL WSL Shell distro → global distro
Inherit global WSL PowerShell or cmd Windows → global distro
Inherit global Windows Either Existing behavior preserved

The changed agent paths include terminal-mode AI actions, CLI agent launches, existing-workspace orchestration workers, host-created prompt/model tabs, headless phone launches, phone renderer handoff and rescue, and pending phone-tab rebuilds. New canonical folders use the same agent paths. Existing renderer-selected terminals, repository workspaces, their automation/new-worktree startups, and supported native chat retain their runtime selection.

Paired-client resumes stay on the existing host-owned session path: the host builds and quotes the resume for the folder's chosen shell, carries that shell into the terminal, and retains the existing session claim that prevents duplicate ownership. A successful host resume uses only the host-built command. The claim remains the same path-based kind used for repository workspaces; this adds no execution-namespace attestation.

If the host cannot use its existing session claim, such as with an older terminal daemon, the paired client still falls back to its own quoted command. That fallback now starts in the folder project's runtime shell, so client quoting can disagree with the selected shell; this known edge is disclosed without adding another launch guard.

The existing runtime resolver opts agent callers into folder project resolution. Both renderer and host now use one folder ownership lookup in the existing shared execution-host module. Existing shell channels carry command and shell together, including a WSL-share startup cwd. A project that needs repair fails with the existing Settings advice to choose an installed WSL distro, switch to Windows or repair WSL. This also changes the error text for repository terminals, including +: instead of saying the project runtime requires repair before a terminal can start, the error explains which setting to change or how to repair WSL.

Orchestration now reads command overrides using the folder project's launch shell, and its OpenCode model pre-check uses the same folder runtime as the launch. OpenCode with a picked model retains the existing refusal when the chosen runtime is WSL; this adds no WSL model-verification capability. No settings, wire fields, opcodes or process-launch APIs are added.

Unchanged on purpose

  • Host-created plain terminals and raw-command terminals continue to follow Terminal shell.
  • Non-agent orca terminal create --shell requests keep their existing behavior and are not newly refused because of the folder's project runtime.
  • Paired-client browser pages retain their existing native network host for these folders.
  • Remote skill discovery retains its existing folder scan location.
  • Inherited Windows, repo-less/multi-repo folders, other execution hosts and WSL-share filesystem ownership retain their existing rules.

Follow-up: broader alignment of non-agent folder terminals, browser networking and skill discovery/install belongs in separate scoped work.

The full PR is 26 files, +1175/−65 lines: production and shipped catalog +222/−54; tests/fixtures +953/−11. Round 2 is 13 files, +94/−46; no reports or documentation are committed.

Why

Sharing folder ownership and reusing the runtime and shell resolvers fixes the missing project lookup without another launch planner. Limiting the opt-in to agent callers avoids changing user-authored shell commands or refusing previously allowed non-agent shell requests. Keeping resume quoting and claims on the host avoids sending client-quoted arguments into a different shell.

The inherited Windows default stays unchanged because saved data cannot distinguish a deliberate global Windows choice from the shipped default. This PR does not make that product decision.

Linked Issue

STA-10231

Visual Proof

Windows live QA is deferred until code review, as requested. Settings-UI-only QA rows are recorded outside the repository. No desktop application or simulator was launched.

Testing

  • 176 focused tests pass across ten explicitly named suites, including the separated folder runtime suite, the existing launch parity suite, resolver/shared ownership tests, Settings/catalog tests, orchestration target lookups/model pre-checks and the two existing runtime-repair suites.
  • Both round-2 pre-launch assertions fail on f05bf67 before the production changes and pass after: the Windows command override is recognized, and the WSL OpenCode model pre-check refuses without probing Windows.
  • Eight round-1 folder assertions fail on reviewed head 3ce7670: two paired resumes, three non-agent terminal rows, browser/skill scope, pending phone rebuild and repair advice.
  • tc-gate pnpm tc:node and tc-gate pnpm tc:web pass.
  • orca-ci-checks --no-typecheck passes all 23 checks with the ignored worktree Bun 1.4.3 install.
  • Remote CI passes on 4c501ef: 18 passed, 21 skipped, no failures or pending checks. This includes all five test shards, Windows packaging, static analysis/typecheck, relay integration and changed Electron end-to-end checks. The target-lookup tests also pin repository aliases without a folder ID; those keep their existing shell. No sampling-job retry was needed.
  • Windows live QA after code review.

The paired-resume tests exercise the real paired-client RPC handler, runtime, claim and provider. They assert the host-built resume reaches the terminal with its selected shell and claim, with one spawn and no legacy fallback; they do not mount a real paired-client transport. All evidence is source and mocked-provider testing on macOS, not live Windows/SSH/mobile execution.

Review

Draft only; no merge or main sync. C1 #27692 should use findLocalFolderWorkspaceProject from the shared folder execution-host module too, and consolidate these shell inputs into its existing runtime fact. Its inherited-Windows exception remains until STA-10231's settings decision. Integration must retain the existing WSL OpenCode model refusal.

Follow-ups

  • Fix the inherited-Windows phone renderer quoting mismatch separately (review P2.4); its execution location and existing quoting remain unchanged here.
  • Decide the ambiguous global Windows default separately under STA-10231.
  • Consider non-agent folder runtime alignment separately, including paired browser networking and skill discovery/install agreement.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer code or resources copied.

Notes

The execution host owns resolution. SSH/paired-server folders cannot borrow a local project; ambiguous folders do not choose one. Existing mixed-version behavior and optional shell channels remain compatible.

Checklist

  • Scope is folder agent launches; before/after and deliberate boundaries disclosed.
  • Shared lookup, resume host quoting/claim, phone rebuild and repair advice self-reviewed.
  • Cross-platform, SSH/other hosts, WSL shares and folder ambiguity considered.
  • Focused tests, Node/Web typechecks and required local static checks pass.
  • Deferred live Windows proof after review.

Author: @BrennanKB5

This branch has not been deployed

No deployments
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