Skip to content

fix(kaos): detect bash when git comes from a native MSYS2 toolchain - #1580

Merged
7Sageer merged 1 commit into
MoonshotAI:mainfrom
wszqkzqk:feat/kaos-msys2-native-git
Jul 13, 2026
Merged

fix(kaos): detect bash when git comes from a native MSYS2 toolchain#1580
7Sageer merged 1 commit into
MoonshotAI:mainfrom
wszqkzqk:feat/kaos-msys2-native-git

Conversation

@wszqkzqk

Copy link
Copy Markdown
Contributor

Related Issue

Fixes #1579

Problem

On Windows, the shell probe infers the bash location from
git --exec-path by scanning the path for known mingw-w64 prefix
segments, then looks for bash at <root>\bin\bash.exe /
<root>\usr\bin\bash.exe. The scan only covered the legacy
mingw32/mingw64 prefixes. On a host where git comes from a native
MSYS2 environment and Git for Windows is not installed, the exec path
(e.g. C:/msys64/ucrt64/libexec/git-core) matches nothing, so
detection throws KaosShellNotFoundError even though bash exists at
C:\msys64\usr\bin\bash.exe. Setting KIMI_SHELL_PATH works around
it; installs passed the override were not affected.

What changed

  • Collected the mingw-w64 prefix names into a MINGW_PREFIX_SET
    covering all current MSYS2 toolchain prefixes, adding
    ucrt64/clang64/clangarm64 next to the legacy
    mingw32/mingw64. A native MSYS2 git's exec path now walks back
    to the MSYS2 root and resolves the shared bash at
    usr\bin\bash.exe.
  • Git for Windows layouts are unaffected — their exec paths still hit
    mingw32/mingw64 first, so resolution results are unchanged and
    the legacy prefixes stay for compatibility.
  • No new options, no changed error messages. Added unit tests for the
    three new prefixes; existing suites continue to exercise Scoop shims
    and Git for Windows layouts.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

git --exec-path of a native MSYS2 git returns a path under the
modern toolchain prefixes (ucrt64, clang64, clangarm64), but the root
inference scan only covered the legacy mingw32/mingw64 prefixes, so
detection fell through to KaosShellNotFoundError on hosts without
Git for Windows even though MSYS2 bash exists at <root>\usr\bin.

Extend the segment scan to all current MSYS2 prefixes so the MSYS2
root is inferred correctly. mingw32/mingw64 stay for Git for Windows
compatibility.
@changeset-bot

changeset-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ab5509

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 12, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4ab5509
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4ab5509

commit: 4ab5509

@7Sageer
7Sageer merged commit 83370f1 into MoonshotAI:main Jul 13, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 13, 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.

Windows bash detection fails when git comes from a native MSYS2 environment (ucrt64/clang64/clangarm64)

2 participants