fix: resolve claude.cmd shim on Windows before spawning (#120)#121
Merged
Conversation
On Windows the npm global install ships the CLI only as a `claude.cmd`
shim (no `claude.exe`). `subprocess.run(["claude", ...])` goes through
CreateProcess, which resolves only `.exe` from a bare name, so every
spawn raised `FileNotFoundError: [WinError 2]` — silently killing every
auto-save (now.md / today-*.md / recent.md never generated).
Resolve the binary with `shutil.which("claude")`, which honours PATHEXT
and returns the full claude.cmd path subprocess can launch — no
shell=True, no argv-length regression, cross-platform safe. Overridable
via REMEMBER_CLAUDE_BIN, mirroring the REMEMBER_MODEL / _MAX_TURNS knobs.
Bump 0.8.2 -> 0.8.3.
Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
On Windows the npm global install ships the CLI only as a
claude.cmdshim (noclaude.exe).pipeline/haiku.pyspawned it in list-form assubprocess.run(["claude", ...]), which goes throughCreateProcess— that resolves only.exefrom a bare name. Every spawn raisedFileNotFoundError: [WinError 2], the pipeline aborted right after[haiku] calling, andnow.md/today-*.md/recent.mdwere never generated. (The SessionStart hook and/rememberskill kept working since they don't spawnclaude.) 5th Windows bug, not covered by the four fixed in #6.Fix
Resolve the binary with
shutil.which("claude")before spawning. It honoursPATHEXT, returns the fullclaude.cmdpath, andsubprocesslaunches it fine — noshell=True, no argv-length regression, cross-platform safe (returns the plain path on Linux/macOS). Overridable viaREMEMBER_CLAUDE_BIN, mirroring the existingREMEMBER_MODEL/REMEMBER_MAX_TURNSknobs. New_resolve_claude_bin()helper, wired intocmd[0].Tests (TDD)
6 new tests in
tests/test_haiku.py: which-resolution (queried for"claude"),.cmdshim path,REMEMBER_CLAUDE_BINoverride, blank-override fallback, not-on-PATH fallback to bare name, andcmd[0]is the resolved path. Made the one fragile existing assert path-robust.Full suite: 487 passed, 41 skipped, 98.5% coverage. Red-before-green confirmed.
Bump
0.8.2 -> 0.8.3 (
plugin.json,README.mdbadge,CHANGELOG.md).Closes #120
🤖 Generated by Max