Skip to content

fix(powershell): use Windows cwd for WSL UNC startup - #462

Merged
Kuddev merged 9 commits into
Kuddev:mainfrom
WilliamWang1721:codex/issue-195-powershell-unc
Oct 14, 2026
Merged

Kuddev merged 9 commits into
Kuddev:mainfrom
WilliamWang1721:codex/issue-195-powershell-unc

Conversation

@WilliamWang1721

@WilliamWang1721 WilliamWang1721 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Result / 用户结果

Native PowerShell started from a WSL UNC directory cannot pass that cwd to CMD-based launchers, which fall back to the Windows directory. PowerShell/pwsh now starts in the existing Windows home directory for wsl.localhost and wsl$ paths, and initial pane metadata follows the prepared launch cwd. Fixes #195.

Design / 设计边界

  • The existing Windows platform adapter prepares the launch directory; terminal startup reads the prepared fact for pane metadata.
  • Ordinary network shares and WSL shells retain their directories. No dependency, persistence, threading or lifetime changes.
  • Scope does not meet the module's causal-note threshold; the CMD rationale stays beside the policy and in regression tests.

Evidence / 验证依据

  • Three Windows regressions cover WSL UNC directory policy, preserved launches, and actual PowerShell 5.1/7 → CMD/.cmd child cwd.
  • Two author self-review rounds and coordinating diff/surrounding-code review completed.
  • No local build, tests or formatting ran. Upstream CI and fork-only exact-source Windows evidence are pending.
  • The supplementary SMB reproduction is a UNC surrogate, not proof of an actual WSL guest or physical pane interaction. DPI/provider acceptance remains unverified.
  • Prepared with GPT-6.1-SOL (high reasoning). Maintainer review and approval remain required.

Required Review / 必须确认

  • I followed CONTRIBUTING.md, docs/architecture.md, and docs/project-constraints.md.
  • I split responsibilities, not arbitrary line ranges; no duplicate behavior authority was added.
  • python3 scripts/check_architecture.py --base <PR-base-commit> passes; budgets were not inflated to fit the change.
  • Tests cover success and failure; platform/feature coverage limitations are stated.
  • No new user-facing messages or governance changes.

@WilliamWang1721
WilliamWang1721 marked this pull request as ready for review October 11, 2026 13:44

@Kuddev Kuddev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed 131c70d against main 79e594d. Updating the branch preserved the three-file fix without conflict or further source changes. The platform adapter limits the cwd adjustment to native PowerShell/pwsh on WSL UNC prefixes; ordinary local/SMB directories and WSL shells retain their cwd, shell/argv remain unchanged, and pane startup metadata reads the prepared PTY cwd. No merge-blocking finding.

Local exact-head verification: powershell_wsl_unc_startup_uses_home_without_changing_the_launch, powershell_cmd_launchers_inherit_the_prepared_windows_directory, and ordinary_network_directories_and_wsl_launches_keep_their_startup_cwd all pass. The child-process test exercised installed Windows PowerShell 5.1 plus the existing portable PowerShell 7.6.4, CMD and a .cmd shim. The first local run reported program-not-found because pwsh was not on PATH; re-running with its existing directory added only to the test process environment passed. No product/test assertion or machine-wide configuration was changed.

All ten required checks and all five native jobs succeeded for this exact head in run 38508873422. No full local test suite, live WSL guest login or interactive pane acceptance is claimed.

@Kuddev
Kuddev merged commit 21214a4 into Kuddev:main Oct 14, 2026
16 checks passed
@WilliamWang1721
WilliamWang1721 deleted the codex/issue-195-powershell-unc branch October 14, 2026 12:36
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.

[Bug] PowerShell 面板以 WSL 的 UNC 路径为起始目录,cmd.exe 系启动器(claude.cmd 等)回退到 C:\Windows

3 participants