fix: make ClaudeCliBackend work on Windows (.cmd shim resolution + argv length)#98
Open
codeL1985 wants to merge 2 commits into
Open
fix: make ClaudeCliBackend work on Windows (.cmd shim resolution + argv length)#98codeL1985 wants to merge 2 commits into
codeL1985 wants to merge 2 commits into
Conversation
… limit) Every claude call failed with WinError 2 and was swallowed by the bare except -> return '', so real-backend cycles silently scored 0.000/0.000 and produced zero edits. - resolve claude_path via shutil.which: the npm-installed claude is a .cmd shim that CreateProcess cannot resolve by bare name - pass the prompt via stdin instead of argv: the .cmd shim routes through cmd.exe whose command line caps at ~8K chars, which reflect/judge prompts exceed Verified: reflect() on a synthetic max_chars failure now returns a concrete bounded edit via the real CLI (was [] before). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…INDOW) Every CLI subprocess (claude/codex/copilot) spawned from a console-less parent allocates a visible console window on Windows. A cycle making hundreds of calls strobes cmd windows and steals focus, making the machine unusable while the engine runs. Pass CREATE_NO_WINDOW on all CLI call sites; no-op on POSIX. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
@codeL1985 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Problem
On Windows,
claudeinstalled via npm is a.cmdshim.subprocess.run(["claude", ...])raisesFileNotFoundError(WinError 2) becauseCreateProcessdoes not resolve.cmdfiles by bare name. The bareexcept Exception: return ""inClaudeCliBackend._callswallows this, so every backend call silently returns an empty string — real-backend cycles reportheld-out 0.000 -> 0.000 => rejectwith zero edits, which is indistinguishable from "nothing to optimize" (same user-facing symptom as #68, different cause).Fix
claude_pathviashutil.which()in__init__— it honorsPATHEXTand returns the fullclaude.CMDpath._callandattempt_with_tools. The.cmdshim routes throughcmd.exe, whose command line caps at ~8K chars; reflect/judge prompts routinely exceed that.claude -pwith no positional prompt reads stdin, so behavior is unchanged on POSIX.Verification (Windows 11, Python 3.14, claude CLI 2.1.170)
reflect()on a syntheticmax_charsfailure returned[](raw_calloutput was"").🤖 Generated with Claude Code