Repository navigation
fix(worktrees): respect Windows shell for setup runners - #6967
Conversation
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 5b717f120810601d96eb0739feda8ebe7270346e on Jul 1, 2026 1:07am UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/shared/setup-runner-command.ts (1)
59-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a short “why” comment for the Windows shell/path translation logic.
This branching is doing non-obvious behavior (
/c/...vs/mnt/c/..., PowerShell vs cmd fallback), so a brief rationale here would make future edits much safer.As per coding guidelines,
**/*.{ts,tsx,js,jsx}: "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."Also applies to: 121-144
Source: Coding guidelines
src/renderer/src/lib/launch-worktree-background-terminals.ts (1)
121-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why background setup launches must reuse
setup.shell.The extra argument is easy to remove in a later cleanup unless this helper states that deferred/background setup tabs must preserve the shell chosen when the runner was generated.
As per coding guidelines,
**/*.{ts,tsx,js,jsx}: "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."Source: Coding guidelines
src/renderer/src/lib/worktree-activation.test.ts (1)
75-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd one shell-aware
issueCommandcase.These additions cover setup launches well, but Line 723 in
src/renderer/src/lib/worktree-activation.tsnow forwardsissueCommand.shellthroughbuildSetupRunnerCommand(), and the suite still only exercises the shell-less issue-command path. A single PowerShell or WSL issue-command assertion would keep that new branch from regressing unnoticed.Also applies to: 419-441, 596-624
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fc5113fa-9220-4c39-9fa8-b692d0d63a89
📥 Commits
Reviewing files that changed from the base of the PR and between 764e2fe and aa8723db4b9fa2f38593bd30c33d8c5d29dde50a.
📒 Files selected for processing (17)
src/main/hooks.test.tssrc/main/hooks.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees-windows.test.tssrc/main/ipc/worktrees.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/lib/launch-worktree-background-terminals.test.tssrc/renderer/src/lib/launch-worktree-background-terminals.tssrc/renderer/src/lib/setup-runner.tssrc/renderer/src/lib/worktree-activation.test.tssrc/renderer/src/lib/worktree-activation.tssrc/shared/setup-agent-sequencing.test.tssrc/shared/setup-agent-sequencing.tssrc/shared/setup-runner-command.test.tssrc/shared/setup-runner-command.tssrc/shared/types.ts
|
Addressed the CodeRabbit pass in |
|
Taking a look! |
|
👋 Did a deep Opus review of this on Windows (native + WSL + SSH paths) after rebasing onto current I pushed 3 small hardening fixes on our rebased branch
Added unit tests locking the remote-probe behavior. Heads-up worth a release note (not a code bug): for unconfigured Windows users this PR shifts the setup runner default from Residual risk: if a user configures Git Bash locally and creates a remote Windows worktree, the runner is emitted as |
|
Thanks @rodboev — the root-cause analysis and the Git Bash routing here were exactly right. We've pushed five maintainer commits on top of your branch (no history rewrite) that narrow the scope so only the broken configurations change behavior:
Verified on the combined head: the focused vitest suite (814 tests) and node/web typecheck are green. Known follow-ups, deliberately out of scope: the |
|
@OrcaWin thanks for the deep Windows pass — good catches. Status update so we don't fork efforts: we've kept this PR as the canonical branch (no superseding PR needed; On your three hardening fixes from
Your residual-risk note (Git Bash config + remote Windows worktree) is also resolved by the remote-owned selection — local shell preferences never reach remote hosts now. No need to carry |
5dec683 to
14983af
Compare
|
Hey — hope this is helpful! We rebased this branch onto the latest |
|
My bad, force-pushed and overwrote the five maintainer commits I'd pushed to this branch 20 minutes earlier (see the two comments above). Restored them in State of the branch now:
Verified on the pushed head: focused vitest suite (1123 tests) and node/web typecheck green. |
79c0229 to
fd3c5dc
Compare
|
Rebased this onto the latest main and pushed the review fixes here to help get it landed. The only conflicts were in |
|
Quick follow-up: CI flagged two changed-code gates (a param-count limit on the runner helper and a hooks-runner test expectation for the new shell field), which I've addressed in the latest commit — all 22 checks are green now. |
- Resolve remote PowerShell binary without local pwsh probe: for SSH/remote
Windows worktrees, isPwshAvailable() reflects only the LOCAL host, so an
'auto' implementation could route the remote runner to a pwsh.exe the remote
lacks. Add resolveSetupRunnerShell(..., { probeLocalPwsh: false }) so remote
auto keeps the always-present powershell.exe; explicit pwsh.exe still honored.
- Preserve native exit codes in the PowerShell runner by checking
$LASTEXITCODE before $?, so a failing native command surfaces its real code
instead of a generic exit 1; $? still catches cmdlet soft-failures.
- Write the PowerShell runner with a UTF-8 BOM so Windows PowerShell 5.1 (the
new default powershell.exe) reads it as UTF-8 instead of ANSI, preventing
non-ASCII setup-script corruption.
- Add unit tests for the remote-probe behavior.
The force-pushed rebase dropped five review-fix commits that were already on this branch; this reapplies their combined effect on top of the new base and the hardening commit: - Keep SSH setup shell selection remote-owned (no local terminalWindowsShell or pwsh routing for remote hosts; supersedes the probeLocalPwsh guard) - Preserve cmd setup compatibility outside POSIX shells (no .ps1 runner family, so the BOM/exit-code hardening is no longer applicable) - Route WSL setup runners from the project runtime - Avoid blocking PowerShell probes during setup creation - Correct SSH and WSL background setup fixtures
- createWorktreeRunnerScript took 7 positional parameters, tripping the changed-code max-params gate; move it to a single options object. - hooks-runner.test.ts deep-equals the createSetupRunnerScript result, so assert the cmd shell now returned for native Windows worktrees.
c8f27a2 to
8361080
Compare
Greptile SummaryThis PR fixes Windows worktree setup runners to respect the user's configured terminal shell (Git Bash, WSL, PowerShell) instead of always writing
Confidence Score: 5/5Safe to merge — shell selection, path conversion, and env var encoding are all correctly threaded end-to-end and covered by the expanded test suite. The change is well-scoped: SetupRunnerShell metadata flows from settings resolution through runner creation, sequencing, background launch, and completion signaling without any gaps. Path conversion helpers (/c/… for Git Bash, /mnt/… for WSL, delayed-expansion wrapper for metacharacter paths) are correct. The DisableDelayedExpansion fix in buildWindowsRunnerScript is a genuine correctness improvement for cmd users under the new launcher. No execution path leaves the shell hint unthreaded. Files Needing Attention: No files require special attention — the logic across all 33 changed files is consistent and well-commented.
|
| Filename | Overview |
|---|---|
| src/shared/setup-runner-command.ts | Core routing logic for setup runner commands; adds shell-aware path conversion (Git Bash /c/… vs WSL /mnt/… vs cmd.exe), with correct guard ordering (WSL UNC, Linux path, posix shell, fallback cmd). |
| src/main/hooks.ts | Adds resolveSetupRunnerShell reading terminalWindowsShell settings, threads SetupRunnerShell through createWorktreeRunnerScript, converts POSIX env var paths for Git Bash, and fixes DisableDelayedExpansion in cmd runner header. |
| src/shared/windows-cmd-runner-delayed-launch.ts | New file: PowerShell-wrapped delayed-expansion launcher for cmd-family paths containing metacharacters that survive no amount of quoting; well-reasoned guard pattern and script. |
| src/shared/types.ts | Adds optional shell field to WorktreeSetupLaunch; correctly typed and backward-compatible. |
| src/main/ipc/worktree-remote.ts | Threads setup.shell through sequenced setup and background setup launch paths consistently. |
| src/main/runtime/orca-runtime.ts | Threads setup.shell through all setup launch paths; fixes setupCommandPlatform derivation; adds didStartInProcessSetupHook to avoid reporting spawn_failed when the in-process hook is already running. |
| src/renderer/src/lib/worktree-activation.ts | Passes setup.shell through to buildSetupRunnerCommand and createSequencedSetupAgentCommands in the renderer activation path. |
| src/preload/index.ts | Broadens IPC type annotations from inline object literals to WorktreeSetupLaunch so the new shell field is included in renderer-visible payloads. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[createLocalWorktree / runHook] --> B[resolveSetupRunnerShell\nsettings.terminalWindowsShell]
B --> C{Platform}
C -- non-win32 --> D[return undefined]
C -- win32 --> E{Shell family}
E -- wsl.exe terminal --> F[family: cmd]
E -- PowerShell terminal --> F
E -- bash.exe / bash\nGit for Windows --> G{resolveWindowsGitBashShellPath}
G -- found --> H[family: posix]
G -- not found --> F
H --> I[createWorktreeRunnerScript]
F --> I
D --> I
I --> J{nativeWindowsWorktree?}
J -- yes --> K[runnerShell = setupShell ?? cmd\nExtension .cmd or .sh]
J -- no WSL distro --> L[runnerShell = posix\nlaunchShell = posix + wsl.exe]
J -- posix host --> M[runnerShell = posix]
K --> N[Write runner + convert env paths]
L --> N
M --> N
N --> O[WorktreeSetupLaunch\nrunnerScriptPath + shell]
O --> P[resolveSetupRunnerCommand]
P --> Q{Windows platform?}
Q -- WSL UNC path --> R[bash /linux/path]
Q -- Linux / path --> R
Q -- shell.family=posix no WSL --> S[bash '/c/...' Git Bash]
Q -- shell.family=posix wsl.exe --> T[bash '/mnt/...' WSL]
Q -- shell.family=cmd safe path --> U[cmd.exe /c path]
Q -- shell.family=cmd metachar --> V[powershell delayed expansion]
Q -- posix platform --> R
Reviews (5): Last reviewed commit: "fix(plugins): keep in-process unsubscrib..." | Re-trigger Greptile
|
PR ready. pending windows verification |
- buildObservedSetupCommand takes the runner's launch shell so WSL-routed Windows-drive setup replays use /mnt/c instead of Git Bash /c - resolveSetupRunnerShell gates the posix runner on the same Git Bash resolution the PTY uses, so a missing or non-MSYS bash keeps the cmd runner - issue-command runners carry their launch shell, and the renderer passes it when building the queued command - treat a bare `bash` shell setting as POSIX like `bash.exe` Co-authored-by: Orca <[email protected]>
|
@coderabbitai[bot] fixed |
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
Route windowless/headless creates through the shell-aware setup runner when a PTY controller is available, existence-check explicit Git Bash paths before committing to .sh runners, thread the resolved shell into issue-command runners, and document the intentional Git Bash interpreter flip with a narrow scope table.
C3: a Git Bash setup runner now receives ORCA_*/CONDUCTOR_*/GHOSTX_* path values in /c/... form, matching the runner path and the shell's own HOME/PWD. C5: extension-less `bash` resolves to Git Bash everywhere, matching how resolveWindowsShellStartupFamily already classifies it. C7: runner paths carrying characters that cannot be quoted on a cmd command line launch through a delayed-expansion PowerShell shim instead, and the batch runner disables inherited delayed expansion so `!` in setup lines survives. Co-authored-by: Orca <[email protected]>
Keep the setup-shell release note aligned with C3 env conversion and C5 bare bash resolution so the published claim matches runtime behavior.
Keep the counsel P1/P2 product fixes without expanding the docs allowlist or AGENTS.md guidance surface.
Dev plugin watchers fire-and-forget unsubscribe, and in-process Parcel can reject when temp watch roots are already deleted. Catch those rejections so they cannot fail the suite as unhandled errors.
Swallowing Parcel unsubscribe errors broke mocked unsubscribe tests that return non-Promises and expect rejections. Contain failures only in PluginDevWatcher fire-and-forget paths.
…s to Git Bash (#12406) * fix(worktrees): stop silently switching existing Windows setup scripts to Git Bash #6967 derived the Windows setup-runner shell from `terminalWindowsShell`. On upgrade, any Windows user whose terminal preference resolved to Git Bash had their existing `orca.yaml` setup script (and issue command) handed to bash instead of cmd.exe. Scripts authored against the cmd runner — `copy`, `xcopy`, `set VAR=value`, `if errorlevel 1`, `%VAR%`, backslash paths — broke with no migration and no warning, and the failure looked like Orca broke the project. The conflation is also wrong in the steady state: a terminal preference is per-user, so two people on the same repo got different interpreters for the same orca.yaml and no project could write a setup script that worked for all of its Windows contributors. The interpreter is now a property of the script, declared the standard way: a leading `#!` line. Native Windows keeps the historical `.cmd` runner unless the script declares a POSIX shell, so no existing script changes behavior. `resolveSetupRunnerShell` keeps its role as the feasibility gate — a bash runner still requires the terminal to resolve to Git Bash, since the launch command is typed into that shell and uses MSYS `/c/...` paths. `buildWindowsRunnerScript` now drops a leading `#!` line rather than `call`ing it, so a declared-bash script that falls back to cmd (Git Bash missing) fails on a real setup line instead of aborting on errorlevel at line one. WSL worktrees, POSIX platforms, and SSH hosts are untouched. * fix(worktrees): keep the cmd setup runner launchable from a Git Bash pane Adversarial review of this PR found that pinning the runner format per script reopened issue #6896 one layer down. - `WorktreeSetupLaunch.shell` had been redefined to mean "the format the runner file was written in". `resolveSetupRunnerCommand` consumes it as "the shell that types the launch command", so a Git Bash terminal with a batch setup script produced `cmd.exe /c "C:\...\setup-runner.cmd"` typed into a bash pane, where MSYS rewrites the `/c` switch into a drive path: cmd opens interactively and setup never runs. `shell` is the terminal's family again; the runner file's .cmd/.sh extension carries the format, and a batch runner launched from a POSIX pane reuses the existing PowerShell ProcessStartInfo launcher. - The cmd runner dropped a leading `#!` line and ran the rest as batch, so a bash script reaching cmd (PowerShell/cmd terminal, or any SSH-to-Windows host) got its interpreter-agnostic prefix executed before failing mid-way. It now prints why and exits 1 without running anything. - A `#!` line's option flags were discarded: `#!/usr/bin/env -S bash -euo pipefail` lost pipefail because the runner is launched as `bash <path>`. The generated posix runner now replays declared flags via `set` and drops the duplicate interpreter line. - Docs cover the per-user setup command in repository hook settings, which goes through the same `#!` rule, and describe what the `#!` line does and does not select. Tests: composed launch command for a POSIX pane + cmd runner (hooks, shared runner command, setup sequencing gate, observed-setup signal), the cmd runner's shebang refusal, and shebang flag replay. Each fails with the source reverted. * fix(worktrees): replay only real `set` flags and keep the gate in the pane's shell Two round-2 review findings: - `#!/bin/bash -l` replayed `set -l`, which exits 2 and aborted the runner under its own `set -e` before a single setup line ran (all platforms). Only the flags `set` documents are replayed now; a bare `-o` with no option name is dropped instead of dumping the shell-option table. - The wait-for-setup gate picked its language from the runner file, so a batch runner launched from a Git Bash pane got the PowerShell gate while the agent startup command was already POSIX-quoted — `Invoke-Expression` cannot parse `'\''`. The gate now follows the pane; the runner still launches through the ProcessStartInfo launcher, never through bash. --------- Co-authored-by: OrcaWin <[email protected]>
* Honor configured shells during worktree setup
* Align setup launch paths with selected Windows shells
* Carry setup shell selection through deferred launches
* Prove Windows setup shell routing at its real adapters
* Ground remote PowerShell proof in the real writer
* Preserve Git Bash across deferred setup launches
* Harden Windows setup runner shell selection
- Resolve remote PowerShell binary without local pwsh probe: for SSH/remote
Windows worktrees, isPwshAvailable() reflects only the LOCAL host, so an
'auto' implementation could route the remote runner to a pwsh.exe the remote
lacks. Add resolveSetupRunnerShell(..., { probeLocalPwsh: false }) so remote
auto keeps the always-present powershell.exe; explicit pwsh.exe still honored.
- Preserve native exit codes in the PowerShell runner by checking
$LASTEXITCODE before $?, so a failing native command surfaces its real code
instead of a generic exit 1; $? still catches cmdlet soft-failures.
- Write the PowerShell runner with a UTF-8 BOM so Windows PowerShell 5.1 (the
new default powershell.exe) reads it as UTF-8 instead of ANSI, preventing
non-ASCII setup-script corruption.
- Add unit tests for the remote-probe behavior.
* Restore setup-shell scope narrowing over the rebase
The force-pushed rebase dropped five review-fix commits that were already
on this branch; this reapplies their combined effect on top of the new
base and the hardening commit:
- Keep SSH setup shell selection remote-owned (no local terminalWindowsShell
or pwsh routing for remote hosts; supersedes the probeLocalPwsh guard)
- Preserve cmd setup compatibility outside POSIX shells (no .ps1 runner
family, so the BOM/exit-code hardening is no longer applicable)
- Route WSL setup runners from the project runtime
- Avoid blocking PowerShell probes during setup creation
- Correct SSH and WSL background setup fixtures
* Satisfy the changed-code gates for the setup-shell runner
- createWorktreeRunnerScript took 7 positional parameters, tripping the
changed-code max-params gate; move it to a single options object.
- hooks-runner.test.ts deep-equals the createSetupRunnerScript result, so
assert the cmd shell now returned for native Windows worktrees.
* Carry the setup launch shell through observed and issue runners
- buildObservedSetupCommand takes the runner's launch shell so WSL-routed
Windows-drive setup replays use /mnt/c instead of Git Bash /c
- resolveSetupRunnerShell gates the posix runner on the same Git Bash
resolution the PTY uses, so a missing or non-MSYS bash keeps the cmd runner
- issue-command runners carry their launch shell, and the renderer passes it
when building the queued command
- treat a bare `bash` shell setting as POSIX like `bash.exe`
Co-authored-by: Orca <[email protected]>
* fix(worktrees): close counsel P1 gaps for Windows setup shells
Route windowless/headless creates through the shell-aware setup runner when a
PTY controller is available, existence-check explicit Git Bash paths before
committing to .sh runners, thread the resolved shell into issue-command
runners, and document the intentional Git Bash interpreter flip with a narrow
scope table.
* Convert setup env to MSYS form and harden the bare cmd runner launch
C3: a Git Bash setup runner now receives ORCA_*/CONDUCTOR_*/GHOSTX_* path
values in /c/... form, matching the runner path and the shell's own HOME/PWD.
C5: extension-less `bash` resolves to Git Bash everywhere, matching how
resolveWindowsShellStartupFamily already classifies it.
C7: runner paths carrying characters that cannot be quoted on a cmd command
line launch through a delayed-expansion PowerShell shim instead, and the batch
runner disables inherited delayed expansion so `!` in setup lines survives.
Co-authored-by: Orca <[email protected]>
* docs: note MSYS ORCA_* paths and bare bash Git Bash resolution
Keep the setup-shell release note aligned with C3 env conversion and C5 bare
bash resolution so the published claim matches runtime behavior.
* revert: drop windows-setup-shell doc allowlist and AGENTS link
Keep the counsel P1/P2 product fixes without expanding the docs allowlist
or AGENTS.md guidance surface.
* fix(plugins): contain Parcel unsubscribe rejections under Vitest
Dev plugin watchers fire-and-forget unsubscribe, and in-process Parcel
can reject when temp watch roots are already deleted. Catch those
rejections so they cannot fail the suite as unhandled errors.
* fix(plugins): keep in-process unsubscribe rejection surface
Swallowing Parcel unsubscribe errors broke mocked unsubscribe tests
that return non-Promises and expect rejections. Contain failures only
in PluginDevWatcher fire-and-forget paths.
---------
Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: Brennan Benson <[email protected]>
Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
…s to Git Bash (stablyai#12406) * fix(worktrees): stop silently switching existing Windows setup scripts to Git Bash stablyai#6967 derived the Windows setup-runner shell from `terminalWindowsShell`. On upgrade, any Windows user whose terminal preference resolved to Git Bash had their existing `orca.yaml` setup script (and issue command) handed to bash instead of cmd.exe. Scripts authored against the cmd runner — `copy`, `xcopy`, `set VAR=value`, `if errorlevel 1`, `%VAR%`, backslash paths — broke with no migration and no warning, and the failure looked like Orca broke the project. The conflation is also wrong in the steady state: a terminal preference is per-user, so two people on the same repo got different interpreters for the same orca.yaml and no project could write a setup script that worked for all of its Windows contributors. The interpreter is now a property of the script, declared the standard way: a leading `#!` line. Native Windows keeps the historical `.cmd` runner unless the script declares a POSIX shell, so no existing script changes behavior. `resolveSetupRunnerShell` keeps its role as the feasibility gate — a bash runner still requires the terminal to resolve to Git Bash, since the launch command is typed into that shell and uses MSYS `/c/...` paths. `buildWindowsRunnerScript` now drops a leading `#!` line rather than `call`ing it, so a declared-bash script that falls back to cmd (Git Bash missing) fails on a real setup line instead of aborting on errorlevel at line one. WSL worktrees, POSIX platforms, and SSH hosts are untouched. * fix(worktrees): keep the cmd setup runner launchable from a Git Bash pane Adversarial review of this PR found that pinning the runner format per script reopened issue stablyai#6896 one layer down. - `WorktreeSetupLaunch.shell` had been redefined to mean "the format the runner file was written in". `resolveSetupRunnerCommand` consumes it as "the shell that types the launch command", so a Git Bash terminal with a batch setup script produced `cmd.exe /c "C:\...\setup-runner.cmd"` typed into a bash pane, where MSYS rewrites the `/c` switch into a drive path: cmd opens interactively and setup never runs. `shell` is the terminal's family again; the runner file's .cmd/.sh extension carries the format, and a batch runner launched from a POSIX pane reuses the existing PowerShell ProcessStartInfo launcher. - The cmd runner dropped a leading `#!` line and ran the rest as batch, so a bash script reaching cmd (PowerShell/cmd terminal, or any SSH-to-Windows host) got its interpreter-agnostic prefix executed before failing mid-way. It now prints why and exits 1 without running anything. - A `#!` line's option flags were discarded: `#!/usr/bin/env -S bash -euo pipefail` lost pipefail because the runner is launched as `bash <path>`. The generated posix runner now replays declared flags via `set` and drops the duplicate interpreter line. - Docs cover the per-user setup command in repository hook settings, which goes through the same `#!` rule, and describe what the `#!` line does and does not select. Tests: composed launch command for a POSIX pane + cmd runner (hooks, shared runner command, setup sequencing gate, observed-setup signal), the cmd runner's shebang refusal, and shebang flag replay. Each fails with the source reverted. * fix(worktrees): replay only real `set` flags and keep the gate in the pane's shell Two round-2 review findings: - `#!/bin/bash -l` replayed `set -l`, which exits 2 and aborted the runner under its own `set -e` before a single setup line ran (all platforms). Only the flags `set` documents are replayed now; a bare `-o` with no option name is dropped instead of dumping the shell-option table. - The wait-for-setup gate picked its language from the runner file, so a batch runner launched from a Git Bash pane got the PowerShell gate while the agent startup command was already POSIX-quoted — `Invoke-Expression` cannot parse `'\''`. The gate now follows the pane; the runner still launches through the ProcessStartInfo launcher, never through bash. --------- Co-authored-by: OrcaWin <[email protected]>
Summary
Closes #6896.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm exec vitest run --config config/vitest.config.ts src/main/hooks.test.ts src/shared/setup-runner-command.test.ts src/shared/setup-agent-sequencing.test.ts src/main/ipc/worktrees.test.ts src/main/ipc/worktrees-windows.test.ts src/main/runtime/orca-runtime.test.ts src/renderer/src/lib/worktree-activation.test.ts src/renderer/src/lib/launch-worktree-background-terminals.test.ts- passed (815tests,4skipped).pnpm run typecheck:node- passed.pnpm run typecheck:web- passed.pnpm exec oxlint src/main/hooks.test.ts src/main/hooks.ts src/main/ipc/worktree-remote.ts src/main/ipc/worktrees-windows.test.ts src/main/ipc/worktrees.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/orca-runtime.ts src/renderer/src/lib/launch-worktree-background-terminals.test.ts src/renderer/src/lib/launch-worktree-background-terminals.ts src/renderer/src/lib/setup-runner.ts src/renderer/src/lib/worktree-activation.test.ts src/renderer/src/lib/worktree-activation.ts src/shared/setup-agent-sequencing.test.ts src/shared/setup-agent-sequencing.ts src/shared/setup-runner-command.test.ts src/shared/setup-runner-command.ts src/shared/types.ts- passed.pnpm exec oxfmt --check src/main/hooks.test.ts src/main/hooks.ts src/main/ipc/worktree-remote.ts src/main/ipc/worktrees-windows.test.ts src/main/ipc/worktrees.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/orca-runtime.ts src/renderer/src/lib/launch-worktree-background-terminals.test.ts src/renderer/src/lib/launch-worktree-background-terminals.ts src/renderer/src/lib/setup-runner.ts src/renderer/src/lib/worktree-activation.test.ts src/renderer/src/lib/worktree-activation.ts src/shared/setup-agent-sequencing.test.ts src/shared/setup-agent-sequencing.ts src/shared/setup-runner-command.test.ts src/shared/setup-runner-command.ts src/shared/types.ts- passed.git diff --check- passed.AI Review Report
Reviewed the final diff for Windows cmd, PowerShell, Git Bash, and WSL setup behavior across local worktree creation, SSH worktree setup, wait-for-setup sequencing, runtime-spawned and renderer-spawned setup terminals, path quoting, and automation background setup launches. The change is scoped to setup runner generation plus setup runner launch command routing.
Security Audit
Setup still runs only through the existing user-approved setup flow. The change adds explicit shell metadata, selects
.cmd,.ps1, or.shrunner content from that metadata, and reuses the existing setup terminal launch path. No new background execution path is added.Notes
Scope is limited to worktree setup runner generation and launch semantics on Windows. Ordinary terminal spawning, archive hooks, notification behavior, and unrelated git provider behavior are unchanged.
ELI5
Windows worktree setup always forced cmd.exe-style runners. Setup now follows your configured shell (PowerShell, Git Bash, WSL) so scripts match the terminal.