Skip to content

fix: surface a readable error when Git Bash is missing on Windows - #2814

Merged
liruifengv merged 6 commits into
MoonshotAI:mainfrom
huangzheng2016:fix/windows-git-bash-not-found
Aug 11, 2026
Merged

fix: surface a readable error when Git Bash is missing on Windows#2814
liruifengv merged 6 commits into
MoonshotAI:mainfrom
huangzheng2016:fix/windows-git-bash-not-found

Conversation

@huangzheng2016

@huangzheng2016 huangzheng2016 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Related Issue

No linked issue. This PR addresses a Windows startup crash reported by users running the native-compiled binary on a clean Windows host without Git for Windows installed.

Problem

On Windows, when Git for Windows is not installed and KIMI_SHELL_PATH is not set, launching the native-compiled kimi-code binary causes a silent exit due to an unhandled rejection in the v2 engine host-environment probe. --help and --version continue to work because they do not initialize the v2 engine.

The failure is not surfaced to the user, so there is no actionable install hint.

What changed

  • environmentProbe now throws a dedicated ProbeShellNotFoundError when Git Bash cannot be located on Windows.
  • HostEnvironmentService catches the async probe rejection so it cannot become an unhandled rejection, and re-throws it as a HostProcessError(SHELL_GIT_BASH_NOT_FOUND) when callers access environment fields or await ready.
  • SDKRpcClientV2.ensureConfigFile() awaits IHostEnvironment.ready, so the missing-shell error surfaces before the TUI starts.
  • Added tests for the new error path in environmentProbe, HostEnvironmentService, and SDKRpcClientV2.

Users without Git for Windows now see a clear install hint instead of a silent crash.

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.

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c794ae0

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 362fa15c0e

ℹ️ 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".

Comment thread packages/agent-core-v2/src/os/backends/node-local/hostEnvironmentService.ts Outdated
Comment thread packages/agent-core-v2/src/_base/execEnv/environmentProbe.ts Outdated
…or ready awaiters

- HostEnvironmentService.ready now rejects with the translated
  HostProcessError(shell.git_bash_not_found) instead of the raw
  ProbeShellNotFoundError, matching what sync field reads throw and what
  SDKRpcClientV2.ensureConfigFile() surfaces, while an internal no-op
  handler keeps the rejection from becoming an unhandledRejection.
- Replace the Windows-gated probe-failure tests with vi.mock-stubbed
  deterministic suites that run identically on any platform.
- Move the ProbeShellNotFoundError explanation into the environmentProbe
  file header per the package comment convention.
@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

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

commit: c794ae0

@liruifengv

Copy link
Copy Markdown
Collaborator

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e6e9ec147

ℹ️ 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".

@liruifengv

Copy link
Copy Markdown
Collaborator

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a493de29ec

ℹ️ 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".

@liruifengv

Copy link
Copy Markdown
Collaborator

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fdecd09ff

ℹ️ 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".

Comment thread packages/node-sdk/src/sdk-rpc-client-v2.ts Outdated
…Windows

The missing-Git-Bash failure is Windows-only, and IHostEnvironment.ready
also covers the login-shell PATH enrichment, which spawns the user's login
shell with a 5s timeout. Awaiting it on POSIX coupled config-only commands
(kimi provider list/remove, export, ...) to the user's shell profile for no
benefit.
@liruifengv

Copy link
Copy Markdown
Collaborator

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c794ae0625

ℹ️ 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".

Comment thread packages/node-sdk/src/sdk-rpc-client-v2.ts

@liruifengv liruifengv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@liruifengv
liruifengv merged commit 158c81d into MoonshotAI:main Aug 11, 2026
14 checks passed
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