fix(cli): preserve WSL cwd through the Windows bridge (#6965) - #7640
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughUpdates worktree selector containment checks to use direct path-inside comparisons. WSL launcher generation now captures the current directory, converts it to a Windows path, and forwards it to the PowerShell bridge. The bridge manages 🚥 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
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: abf73873-2cad-4c34-b987-79e50c5b5334
📒 Files selected for processing (4)
src/cli/index.test.tssrc/cli/index.tssrc/main/cli/wsl-cli-installer.test.tssrc/main/cli/wsl-cli-scripts.ts
# Conflicts: # src/cli/index.test.ts # src/cli/index.ts
2f1fd70 to
9d8087f
Compare
|
Taking a look! |
# Conflicts: # src/main/cli/wsl-cli-installer.test.ts
Summary
Preserve the invoking WSL cwd through the generated launcher and PowerShell bridge so the Windows batch entrypoint no longer inherits a UNC cwd.
main()now defaults fromORCA_CLI_CWDwhen the bridge sets it, and explicitmain(argv, cwd)calls still win.Closes #6965.
Testing
pnpm exec vitest run --config config/vitest.config.ts src/main/cli/wsl-cli-installer.test.ts src/cli/index.test.tspnpm run typecheck:nodepnpm run typecheck:cliAI Review Report
Windows, Linux, and macOS behavior stays bounded. The WSL-only bridge path sets
ORCA_CLI_CWD, so non-WSL launches still resolve throughprocess.cwd(), and empty env values fall back the same way. Remote selection rules, selector semantics, and GUI runtime projection remain unchanged. No provider-specific code changed, and no new persistent state or network surface was added.Security Audit
The bridge only forwards a converted cwd value that it already owns from the generated launcher. It is quoted before the PowerShell hop, scoped to the bridge call, and restored in
finally.Push-Locationmoves the Windows process to the launcher directory socmd.exedoes not inherit a WSL UNC cwd. No new shell interpolation or command construction was introduced beyond the existing generated script flow.Notes
The fix stays inside the bridge boundary.
resources/win32/bin/orca.cmd,src/main/wsl.ts, andsrc/cli/selectors.tsremain unchanged.