Skip to content

fix(windows): add Scoop, Chocolatey, and MSYS2 Git Bash paths - #38092

Open
sc5464988 wants to merge 2 commits into
NousResearch:mainfrom
sc5464988:win/add-bash-paths
Open

fix(windows): add Scoop, Chocolatey, and MSYS2 Git Bash paths#38092
sc5464988 wants to merge 2 commits into
NousResearch:mainfrom
sc5464988:win/add-bash-paths

Conversation

@sc5464988

Copy link
Copy Markdown

Hi, I'm linglingwu, a Windows user from China.

One night I realized Hermes Agent only runs inside WSL on Windows. I had a crazy idea — build a version that runs
natively in PowerShell, no WSL needed.

Pulled an all-nighter and got it working. Thought I was the first person to do it. Then I checked and realized… the
official project already has native Windows support.

Didn't want the effort to go to waste, so I dug into the official implementation and found that _find_bash() was
missing a few common Git install paths. This PR adds them.


Changes

Added three Git Bash paths to _find_bash() in tools/environments/local.py:

  • Scoop — %USERPROFILE%\scoop\apps\git\current\usr\bin\bash.exe
  • Chocolatey — C:\ProgramData\chocolatey\lib\git\tools\git\bin\bash.exe
  • MSYS2 — C:\msys64\usr\bin\bash.exe

Fixes part of #7835. Users who installed Git via these package managers would get "Git Bash not found" even though
bash was installed.

Purely additive — no existing behavior is affected. Tested on Windows 11.

Thanks for building an amazing agent!

On Windows, _find_bash() only checked PortableGit, winget/system Git,
and Program Files. Users who installed Git via Scoop, Chocolatey, or
MSYS2 couldn't find bash.exe and got a "Git Bash not found" error
even though bash was installed.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have backend/local Local shell execution labels Jun 3, 2026

@teknium1 teknium1 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.

Thanks for extending the Windows Git Bash discovery list. The runtime premise still holds on current main: tools/environments/local.py:588-598 has only the standard Git-for-Windows locations before its PATH fallback.

Problems

  • apps/desktop/electron/main.ts:1789-1824 says Desktop checks the same locations as runtime _find_bash(), but its candidate list lacks all three proposed paths. Updating only Python would make desktop prerequisite detection disagree with runtime behavior.
  • scripts/install.ps1:868-917 independently resolves and persists HERMES_GIT_BASH_PATH, but likewise lacks these explicit candidates.
  • There is no direct Windows candidate-selection regression test; tests/tools/test_find_shell.py:106-116 only verifies a generic POSIX _find_bash() result.

Suggested changes

  • Keep the existing precedence and synchronize the desktop and installer candidate lists with the runtime list.
  • Add mocked Windows tests for each package-manager location and PATH-fallback ordering.

This is an automated hermes-sweeper review.

os.path.join(os.environ.get("ProgramFiles(x86)", r"C:\Program Files (x86)"), "Git", "bin", "bash.exe"),
os.path.join(_local_appdata, "Programs", "Git", "bin", "bash.exe"),
# Scoop
os.path.join(os.environ.get("USERPROFILE", ""), "scoop", "apps", "git", "current", "usr", "bin", "bash.exe"),

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.

Please synchronize this candidate with the independently maintained Desktop preflight list in apps/desktop/electron/main.ts:1805-1824 and installer resolver in scripts/install.ps1:875-917; Desktop currently states that its list matches runtime _find_bash().

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
…nstaller, add tests

PR NousResearch#38092 added three package-manager Git Bash paths to _find_bash() but
did not mirror them in the Desktop preflight (main.cjs:findGitBash) or the
installer (install.ps1:Set-GitBashEnvVar), which both maintain independent
but identical candidate lists claiming to match runtime behavior.

This commit:
- Adds Scoop, Chocolatey, and MSYS2 candidates to findGitBash (main.cjs)
- Adds the same three candidates to Set-GitBashEnvVar (install.ps1)
- Adds test_local_env_find_bash.py with 14 mocked Windows tests covering
  every package-manager location, PATH-fallback ordering, and the
  HERMES_GIT_BASH_PATH escape hatch

Review: NousResearch#38092 (review)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sc5464988

Copy link
Copy Markdown
Author

Done — synchronized the three new paths into findGitBash in apps/desktop/electron/main.cjs and Set-GitBashEnvVar in scripts/install.ps1. Also added tests/tools/test_local_env_find_bash.py with 14 mocked Windows tests covering each package-manager location and PATH-fallback ordering. All pass.

@teknium1 ready for re-review.

@sc5464988
sc5464988 requested a review from teknium1 July 20, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local Local shell execution P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants