Skip to content

Add project Windows runtime selection - #5519

Merged
Jinwoo-H merged 6 commits into
stablyai:mainfrom
slashdevcorpse:codex/project-windows-runtime
Jun 17, 2026
Merged

Jinwoo-H merged 6 commits into
stablyai:mainfrom
slashdevcorpse:codex/project-windows-runtime

Conversation

@slashdevcorpse

@slashdevcorpse slashdevcorpse commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a project-level Windows execution runtime model so each local Windows project resolves to exactly one runtime: Windows host or one selected WSL distro. The resolved runtime is now used across project-scoped preflight, agent and skill detection, terminal launch, git/worktree operations, hosted reviews, provider CLI calls, source-control AI helpers, file discovery/search, runtime APIs, and renderer command planning.

This also adds global default and per-project runtime settings, runtime-switch invalidation, repair states for unavailable WSL or missing distros, runtime-aware path/provider identity handling, user-facing docs, and regression coverage for stale WSL settings and Windows-host plus WSL side-by-side behavior.

Review Focus

  • Runtime Resolution Logic (src/shared/project-execution-runtime.ts): project overrides take precedence over the global default; inherit-global follows the global default; malformed or absent values fall back to Windows host; WSL repair states are returned instead of silently falling back when WSL is unavailable, missing a distro, or points at a missing distro.
  • WSL Login Shell Routing (src/main/git/runner.ts, src/shared/wsl-login-shell-command.ts): WSL commands are routed through the selected distro with shell-escaped argv, login-shell resolution through the distro user's passwd entry, and dollar escaping across the outer sh -lc layer. Added regression coverage that command-scoped env like HISTFILE=/tmp/orca-history survives to the inner login shell.
  • Worktree Path Comparison (src/main/ipc/worktree-logic.ts): Windows paths remain slash/case-insensitive for host worktrees; POSIX/WSL-owned paths remain case-sensitive even on a Windows desktop, so cleanup does not collapse distinct WSL paths.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — passed on Windows: 1707 files passed / 13 skipped; 17078 tests passed / 172 skipped.
  • pnpm build — passed the top-level build chain on Windows, including typecheck, build:relay, build:cli, build:electron-vite, build:web, and build:native.
  • Added or updated focused regression tests covering resolver precedence, repair states, stale WSL settings, terminal/PTY routing, preflight, skill/runtime setup, git/worktree operations, provider routing, source-control AI helpers, file discovery/search, renderer launch planning, and Windows host plus WSL smoke behavior.
  • ORCA_E2E_FORCE_HEADFUL=1 ORCA_E2E_RECORD_VIDEO=1 pnpm exec playwright test tests/e2e/windows-project-runtime-smoke.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 passed; test-results/.last-run.json reports "status": "passed".

Windows / WSL / SSH Runtime Checklist

  • Identified affected runtime hosts: local Windows host and local WSL are directly affected; SSH Linux/Windows remain remote-owned; local macOS/Linux resolve to local host and ignore Windows WSL settings.
  • Project-scoped code consumes the resolved project runtime, or explains why the code is app-global / physical-path based.
  • Checked global-default WSL with project host override, and global-default host with project WSL override.
  • Checked WSL unavailable or selected distro missing behavior.
  • Verified PATH, shell, cwd, command construction, and path comparisons stay correct for the owning runtime in focused suites.
  • Confirmed Git provider behavior remains provider-neutral; provider-specific behavior is behind GitHub/GitLab/Bitbucket/Azure DevOps/Gitea boundaries while shared local execution uses runtime-aware options.

AI Review Report

Reviewed the implementation against recent Windows/WSL regression lessons: stale hidden WSL state, WSL login shell and distro preservation, zsh-compatible command generation, Windows PATH refresh, daemon/local PTY parity, SSH separation, path safety, provider-neutral source-control behavior, and repair-required behavior for broken WSL.

Follow-up audits checked daemon PTY launch, WSL session context, Windows shell launch-arg resolution, filesystem watcher routing, runtime docs, and stale future-facing documentation. Findings addressed include routing quick-open/text search through project WSL git options, routing terminal history through the selected WSL distro, preserving GitLab SSH hosted-review behavior, keeping filesystem watchers physical-path based, and documenting current resolver consumer coverage.

Cross-platform compatibility was reviewed for macOS/Linux non-Windows local-host behavior, Windows host behavior, WSL distro behavior, SSH Linux/Windows separation, shell/path handling, and Electron IPC/runtime boundaries touched by this PR.

Security Audit

Reviewed command execution boundaries for WSL wrapping, distro propagation, login-shell command construction, Windows batch-script routing, unsafe argv rejection, and provider CLI execution. Reviewed path handling and destructive operations for runtime-aware worktree removal, orphan cleanup, recursive filesystem access, path identity, Windows host vs WSL path conversion, and SSH separation.

Reviewed IPC/runtime boundaries so repair-required WSL states block project-scoped execution instead of silently falling back to Windows host. Reviewed auth/secrets-adjacent paths for Codex/Claude account runtime targeting and CODEX_HOME conversion so host-managed and WSL-managed homes are not passed into the wrong runtime.

No dependency changes are part of this runtime baseline. Remaining follow-up: broad human exploratory QA beyond the repeatable Windows smoke and final PR evidence attachment.

Notes

  • Broad pnpm test is green in this Windows command-line environment after the final cleanup pass.
  • pnpm run build passed the top-level build chain on Windows.
  • Existing terminals and active tasks keep running in their current runtime after a project runtime switch; the UI warns before applying the switch.
  • Custom Windows shell executable paths are intentionally outside this baseline and should be handled as a separate design-backed follow-up.

Known validation caveat:

  • The Windows host plus WSL project scenario has headful automated smoke coverage with video evidence, including settings UI runtime switching and persisted preference checks; full human exploratory QA beyond that repeatable smoke was not performed in this command-line pass.

Open in Stage

Copilot AI review requested due to automatic review settings June 16, 2026 18:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@slashdevcorpse
slashdevcorpse force-pushed the codex/project-windows-runtime branch from 1f37980 to 35aff5e Compare June 16, 2026 18:45
…-runtime

# Conflicts:
#	src/main/ipc/pty.test.ts
#	src/renderer/src/store/slices/terminals.ts
@Jinwoo-H
Jinwoo-H self-requested a review June 16, 2026 19:50
@AmethystLiang
AmethystLiang requested review from brennanb2025 and removed request for Jinwoo-H June 17, 2026 17:45

@Jinwoo-H Jinwoo-H 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.

Windows/WSL runtime selection is ready to land. Conflicts resolved against latest main; local typecheck, lint, focused runtime/settings/relay tests, and real Windows agent validation passed.

@Jinwoo-H
Jinwoo-H merged commit 0ec3882 into stablyai:main Jun 17, 2026
LesleyMurfin added a commit to LesleyMurfin/orca that referenced this pull request Jun 20, 2026
…e-runtime e2e

Standalone unit test locking in that the runtimeHostIsNonWindows suppression does NOT fire for a win32 host runtime (local Windows-WSL project runtime keeps its shell menu), plus a Playwright e2e for the serve-runtime menu suppression. Per peer-review item #3.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
nwparker pushed a commit to xianjianlf2/orca that referenced this pull request Jul 23, 2026
stablyai#5519 removed WSL from Terminal Settings and moved WSL selection to the
Project Runtime model, but Windows onboarding still offered WSL as a
default-shell choice and persisted terminalWindowsShell='wsl.exe'.
Settings can no longer represent that value and renders it as PowerShell,
so a fresh-profile WSL selection could not be viewed or edited afterward.

Gate the onboarding WSL card on an already-persisted 'wsl.exe' value only,
mirroring how Settings drops WSL. Fresh profiles no longer persist a shell
Settings cannot display, keeping the stored setting, Settings UI, and the
shell used for new panes consistent. The option still appears when a prior
build already saved 'wsl.exe' so those users are not stranded.

Closes stablyai#8537
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Add project Windows runtime selection

* Fix project Windows runtime selection

Co-authored-by: Orca <[email protected]>

* fix: preserve WSL shell variables

---------

Co-authored-by: Jinwoo-H <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Neil <[email protected]>
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.

6 participants