Repository navigation
feat(cosh-ng): add WSL2 preview launcher from Git Bash - #3143
zhoukailong wants to merge 1 commit into
Conversation
Add scripts/cosh-wsl, a community preview entry point that lets Git Bash users on Windows start cosh-shell inside WSL2 in the directory matching their Windows working directory. This is a preview path, not a native Windows target: platform declarations are unchanged, and pkg, svc, checkpoint, and Gateway stay out of the preview scope. The launcher checks for wsl.exe, resolves the Windows cwd with the MSYS2 pwd -W extension (failing explicitly outside Git Bash), prints the four preview status declarations on every start, and forwards the path as a positional parameter under MSYS2_ARG_CONV_EXCL so quoting and injection are impossible. Inside WSL it reports actionable errors for wslpath conversion failure, an inaccessible directory, and a missing cosh-shell. tests/test-cosh-wsl.sh covers twelve stub-verifiable cases on Linux (distro default and override, argument-conversion guard, byte-exact tricky paths, cwd mapping, exit-code propagation, and all failure branches) and is registered in the fast and all test gates. Real Windows/Git Bash/WSL2 interaction remains NOT VERIFIED and is listed for manual acceptance. Refs agentic-os-org#2770 Assisted-by: Codex:0.152.1 Signed-off-by: zhoukailong <324835893+zhoukailong@users.noreply.github.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffabc21990
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| echo "Error: directory is not accessible inside WSL: $linux_cwd (converted from $windows_cwd)" >&2 | ||
| exit 1 | ||
| fi | ||
| if ! command -v cosh-shell >/dev/null 2>&1; then |
There was a problem hiding this comment.
Resolve the packaged cosh entry point
For users who install cosh-ng through the documented ANOLISA/raw or RPM paths, cosh-shell is not exposed on PATH: the component manifest installs it under libexec/anolisa/cosh-ng, while only cosh is installed in bindir (the RPM likewise exposes /usr/bin/cosh). Consequently this check exits 127 for a normal installation and the new WSL preview cannot start. The tests miss the failure because their stub directory deliberately places a cosh-shell executable on PATH.
Useful? React with 👍 / 👎.
代码评审报告 — PR #3143评审者: reviewer (automated) 五维评审结论
Findings未发现 P0/P1/P2 问题。 P3 — 剩余风险(非阻塞)
验证与覆盖声明
声明:本次为纯静态评审,未执行 shell 测试或 shellcheck。测试设计经静态分析认为覆盖充分且有区分度。 总结未发现阻塞问题。 这是一个干净的 additive PR,不触碰任何现有 crate、IPC 契约或平台声明。安全防御点设计正确且有测试覆盖。建议合并,后续完成真实 Windows/Git Bash/WSL2 环境的 manual acceptance。 |
🔄 Incremental Code Review — PR #3143评审者: reviewer (automated) 触发原因自上次评审(2026-09-11 15:30 CST)后, P1 —
|
| 项目 | 状态 |
|---|---|
| cosh-shell install path 验证 | ✅ 已验证(RPM spec、raw package.sh、component.toml 三方交叉确认) |
| 测试覆盖差距确认 | ✅ 已确认(stub 直接放置 cosh-shell 在 PATH,绕过了真实安装场景) |
| 代码 diff 变更 | 无新 commit,代码未变 |
声明:本次为静态验证评审,聚焦 P1 finding 的确认。
总结
上次评审结论中「未发现 P0/P1/P2 问题」需修正:标准安装下 launcher 不可用是一个 P1 功能缺陷。建议在合并前修复 launcher 中的二进制引用(cosh-shell → cosh),并更新测试 stub 以反映真实安装布局。修复后其余维度评审结论不变。
Why
Windows users want to try cosh-ng, but a native Windows port (terminal,
process, local IPC differences) is too costly to commit to before demand is
validated. This adds a scoped preview path: a lightweight launcher run from
Git Bash enters WSL2 via
wsl.exeand starts thecosh-shellalreadyinstalled in a Linux distribution, in the directory matching the current
Windows working directory.
What changed
src/cosh-ng/scripts/cosh-wsl(new): preview launcher. Preflightswsl.exe, resolves the Windows cwd with the MSYS2pwd -Wextension(fails explicitly outside Git Bash), prints the four preview status
declarations plus the out-of-scope notice on every start, forwards the
path as a positional parameter under
MSYS2_ARG_CONV_EXCL='*', andreports actionable errors for wslpath failure, an inaccessible directory,
and a missing cosh-shell.
COSH_WSL_DISTROselects the distribution(default
Ubuntu).src/cosh-ng/tests/test-cosh-wsl.sh(new): 12 stub-verifiable cases onLinux (distro default/override, arg-conversion guard, byte-exact tricky
paths without injection, cwd mapping, exit-code propagation, all failure
branches, explicit
pwd -Wfailure).src/cosh-ng/scripts/run-test-gates.sh: registersrun_wsl_launcherinthe
fastandallgates (shellcheck-missing handling mirrors theexisting raw/rpm packaging gates).
wsl-preview.mdpages underdocs/user-guide/{en,zh}/user-entrypoint/cosh-ng/, linked from theuser-guide "Start here" lists and summarized in the cosh-ng READMEs.
Related issue
Refs #2770 (community preview; the issue stays open pending real
Windows/Git Bash/WSL2 acceptance — do not close on merge)
User / Agent impact
New opt-in preview entry point for Windows users. On every start the
launcher prints: cosh-ng actually runs on Linux inside WSL2; Git Bash is
only the Windows-side entry point;
/mnt/cand other mounts may haveperformance and permission differences; configuration and credentials stay
in the WSL user environment;
pkg,svc, checkpoint, and Gateway are notpart of this preview. No existing command, exit code, or output changes.
Risk and compatibility
Low risk: additive script + tests + docs only.
component.tomlplatformdeclarations unchanged; no new dependencies; the launcher is not part of
any packaging manifest.
Validation
bash tests/test-cosh-wsl.sh: 12/12 PASS, exit 0 (Linux stub level —stub wsl.exe/wslpath/cosh-shell; this is not real Windows/WSL2
acceptance).
bash -non the launcher, test, and gate script: exit 0.node website/scripts/validate-locales.mjs: PASS (en/zh parity).shellcheck(not installed on the devnode),
website/scripts/check-links.mjs(needs the docusaurus build).change, follow-up needed): the dev node's Python 3.8 breaks
packaging/raw/verify-release.py(import tomllib) andscripts/check_test_necessity.py(str.removesuffix), sotests/test-package-raw.shcannot complete on that node.(NOT VERIFIED): start/exit of cosh-shell, real cwd mapping between the
Windows workspace and the WSL filesystem, Ctrl+C/Ctrl+D, window resize,
CJK input and paste, Bash command boundaries, OSC markers, approval
interaction, authentication and session recovery, common file tools,
real
/mnt/cperformance/permissions, and prompt quality for realwsl.exe errors (e.g. distribution not installed).
Documentation and rollback
Docs added bilingually (
wsl-preview.mden/zh) and summarized insrc/cosh-ng/README.md/README_zh.md. Rollback: revert this commit;the launcher, its tests, its gate registration, and the docs are fully
self-contained.