Skip to content

fix(wsl): preserve single-letter POSIX terminal cwd - #13859

Merged
Jinwoo-H merged 4 commits into
mainfrom
OrcaWin/sta-3925-wsl-single-letter-cwd
Aug 11, 2026
Merged

fix(wsl): preserve single-letter POSIX terminal cwd#13859
Jinwoo-H merged 4 commits into
mainfrom
OrcaWin/sta-3925-wsl-single-letter-cwd

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve exact absolute POSIX cwd paths, including /a and /c, when the selected Windows runtime is WSL.
  • Fall back to the workspace root only after WSL proves the requested cwd is missing and the root exists.
  • Keep native/MSYS launch semantics aligned, avoid probes for SSH and successful stable-pane adoption, and route fresh spawns through daemon protocol v33 while preserving older daemon-owned sessions.

This is the latest-main release audit follow-up for historical PR #13420.

Linear: STA-3925

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Completed proportional validation:

  • Deterministic oracle on final origin/main: baseline RED, candidate GREEN, in-memory revert RED for both /a and /c.
  • Physical Windows 2 / WSL2 (Ubuntu-24.04) proof: exact /a and /c; missing wsl.exe --cd /q warns, returns /, and exits 0; inode-guarded cleanup verified.
  • Native Windows: /a -> C:\a, /c -> C:\c; Git Bash/MSYS: /a -> A:\, /c -> C:\.
  • Focused IPC/provider/daemon/protocol tests, plus SSH and folder-workspace cwd tests.
  • Node typecheck; Oxlint default/type-aware/React Doctor with denied warnings; formatting; max-lines ratchet; diff check.

AI Review Report

Fresh adversarial, performance, and internal reviews are clean. Review explicitly covered macOS, Linux, and Windows path/shell behavior; WSL vs native/MSYS authority; SSH and folder workspaces; stable-pane probe cost; daemon generation skew; test quality; and Electron main/daemon boundaries.

Review findings addressed:

  • Removed caller-asserted daemon cwd prevalidation and retained daemon-side validation.
  • Added daemon protocol v33 so a surviving v32 daemon cannot reinterpret fresh /a or /c spawns.
  • Deferred WSL probes until stable-pane adoption fails and pinned SSH zero-probe behavior.
  • Aligned non-WSL MSYS existence checks with native launch normalization.
  • Added mismatch, daemon /a//c, timing attribution, and local-build compatibility coverage.

Security Audit

Reviewed cwd input handling, path normalization, WSL command construction/quoting, IPC/provider trust boundaries, SSH isolation, and daemon protocol skew. The exact-path prevalidation hint remains in-process only and must equal the provider’s independently resolved path; it is not sent over daemon or SSH RPC. No auth, secret, dependency, or new external-command surface was added.

Notes

  • Daemon v1-v32 sessions remain attachable; fresh sessions route to v33.
  • Full local pty.test.ts has three unchanged Windows host-coupling failures, and full pty-subprocess.test.ts has two unchanged default-distro expectation failures. Focused changed contracts pass.
  • The local cross-version harness cannot extract its release checkout through Git Bash when given a native Windows staging path; the Linux CI cross-version lane is the authoritative run.
  • Do not merge as part of this audit.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 20204f5c-44c5-4cea-acff-a223aaf1df05

📥 Commits

Reviewing files that changed from the base of the PR and between 97ebfd9 and 92d6d60.

📒 Files selected for processing (14)
  • src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
  • src/main/daemon/daemon-protocol-version.test.ts
  • src/main/daemon/daemon-protocol-version.ts
  • src/main/daemon/daemon-pty-router.test.ts
  • src/main/daemon/pty-subprocess.test.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-provider-contract.ts
  • src/main/providers/windows-shell-args.test.ts
  • src/main/providers/windows-shell-args.ts
  • src/shared/local-build-compatibility-contract.json
  • src/shared/local-build-compatibility-contract.ts

📝 Walkthrough

Walkthrough

The daemon protocol advances from version 32 to 33 and adds a WSL POSIX CWD protocol gate. Legacy protocol version 32 remains supported, including session routing. PTY startup defers fresh-session CWD validation until after stable-pane adoption. Local spawns validate Windows and WSL paths, record validated CWD data, and pass matching prevalidation evidence to providers. Tests cover WSL, Windows, Git Bash, SSH, fallback, and adopted-pane scenarios.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary user-visible change: preserving single-letter POSIX terminal working directories in WSL.
Description check ✅ Passed The description includes all required sections and provides clear change details, validation results, review coverage, security assessment, and platform notes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@OrcaWin

OrcaWin commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 34225254-a3e5-4c03-b981-ada1bd67c78a

📥 Commits

Reviewing files that changed from the base of the PR and between 97ebfd9 and ee32bed.

📒 Files selected for processing (14)
  • src/main/daemon/daemon-foreground-confirmation-protocol.test.ts
  • src/main/daemon/daemon-protocol-version.test.ts
  • src/main/daemon/daemon-protocol-version.ts
  • src/main/daemon/daemon-pty-router.test.ts
  • src/main/daemon/pty-subprocess.test.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-provider-contract.ts
  • src/main/providers/windows-shell-args.test.ts
  • src/main/providers/windows-shell-args.ts
  • src/shared/local-build-compatibility-contract.json
  • src/shared/local-build-compatibility-contract.ts

Comment thread src/main/daemon/daemon-pty-router.test.ts
@OrcaWin

OrcaWin commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@Jinwoo-H
Jinwoo-H merged commit e6eec11 into main Aug 11, 2026
50 checks passed
@Jinwoo-H
Jinwoo-H deleted the OrcaWin/sta-3925-wsl-single-letter-cwd branch August 11, 2026 22:29
AmethystLiang pushed a commit that referenced this pull request Aug 12, 2026
zpyoung pushed a commit to zpyoung/orca that referenced this pull request Aug 14, 2026
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.

2 participants