fix(run): resolve bundled binary on Windows Git Bash / MSYS2 / Cygwin#174
fix(run): resolve bundled binary on Windows Git Bash / MSYS2 / Cygwin#174keith-mvs wants to merge 1 commit into
Conversation
The launcher derives the platform from `uname -s` lowercased, which under
Git Bash / MSYS2 / Cygwin is `mingw64_nt-<winbuild>` (e.g.
mingw64_nt-10.0-26200), not `windows`. It then probes `bin/lumen` and
`bin/lumen-${OS}-${ARCH}` with no `.exe` suffix, so it never matches the
shipped `bin/lumen-windows-amd64.exe` and falls through to a GitHub download
for a non-existent `lumen-<ver>-mingw64_nt-...-amd64` asset. The download
404s and the PreToolUse (Grep|Bash) hook exits non-zero on every tool call.
Normalize mingw*/msys*/cygwin* to `windows` and append the `.exe` suffix to
the binary candidates (and the download fallback path) so the bundled Windows
binary resolves with no download attempted.
Tested under Git Bash on Windows 11: `scripts/run version` prints the version
with no download, and `hook pre-tool-use` exits 0.
Signed-off-by: Keith Fleming <248089218+keith-mvs@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe launcher script ( ChangesWindows Platform and Executable Path Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the scripts/run launcher to correctly detect and execute the bundled Windows binary under Git Bash/MSYS2/Cygwin-style environments.
Changes:
- Normalizes Windows-like
unameoutputs (mingw/msys/cygwin) toOS=windows. - Introduces an executable suffix (
.exe) for Windows-family environments so local binary discovery and download targets match packaged artifacts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/run (1)
55-56:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winWindows download URL still omits
.exesuffix.Line 55 and Line 82 build
ASSETwithout${EXT}, so Windows still requests a non-existent asset name and fails bootstrap download on first run.🔧 Proposed fix
- ASSET="lumen-${VERSION#v}-${OS}-${ARCH}" + ASSET="lumen-${VERSION#v}-${OS}-${ARCH}${EXT}" URL="https://github.com/${REPO}/releases/download/${VERSION}/${ASSET}" @@ - ASSET="lumen-${VERSION#v}-${OS}-${ARCH}" + ASSET="lumen-${VERSION#v}-${OS}-${ARCH}${EXT}" URL="https://github.com/${REPO}/releases/download/${VERSION}/${ASSET}"Also applies to: 82-83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/run` around lines 55 - 56, The ASSET variable is built without the platform-specific extension, so on Windows the download URL (constructed from ASSET and used in URL) omits the .exe and fails; update the ASSET construction (and any other places building ASSET, e.g., the second occurrence around where ASSET is re-set) to append the ${EXT} variable (use ASSET="lumen-${VERSION#v}-${OS}-${ARCH}${EXT}") and ensure the URL uses that ASSET so Windows receives the .exe-suffixed artifact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@scripts/run`:
- Around line 55-56: The ASSET variable is built without the platform-specific
extension, so on Windows the download URL (constructed from ASSET and used in
URL) omits the .exe and fails; update the ASSET construction (and any other
places building ASSET, e.g., the second occurrence around where ASSET is re-set)
to append the ${EXT} variable (use
ASSET="lumen-${VERSION#v}-${OS}-${ARCH}${EXT}") and ensure the URL uses that
ASSET so Windows receives the .exe-suffixed artifact.
Problem
On Windows under Git Bash (and MSYS2 / Cygwin),
scripts/runnever finds thebundled binary and tries to download a non-existent release asset. Because the
launcher is wired as a
PreToolUse(Grep|Bash) hook, it exits non-zero onevery tool call, surfacing as a hook error in the agent.
Root cause is platform detection:
uname -sunder Git Bash isMINGW64_NT-<windows-build>, notwindows— andit even embeds the Windows build number (
10.0-26200), so it isn't a stablestring. The candidate loop then probes
bin/lumenandbin/lumen-${OS}-${ARCH}with no
.exe, never matching the shippedbin/lumen-windows-amd64.exe, andfalls through to:
which 404s (
lumen-0.0.41-mingw64_nt-10.0-26200-amd64is not a release asset).Fix
Normalize
mingw*|msys*|cygwin*(and explicitwindows*) towindows, andappend
.exeto the binary candidates and the download fallback path. The newcaseonly triggers on those uname strings, so Linux/macOS resolution isunchanged.
Testing
Git Bash on Windows 11 (
uname -s=MINGW64_NT-10.0-26200):scripts/run version-> prints0.0.41, no "Downloading..." lineecho '{}' | scripts/run hook pre-tool-use lumen-> exit 0🤖 Generated with Claude Code
Summary by CodeRabbit