Repository navigation
fix(claude-hook): use forward slashes in Windows managed hook command path - #1329
Merged
nwparker merged 1 commit intoMay 2, 2026
Merged
Conversation
Claude Code on Windows runs settings.json hooks through Git Bash (/usr/bin/bash). A path with single backslashes (e.g. C:\Users\...\claude-hook.cmd) is interpreted by bash as a string containing escape sequences, so \U, \A, etc. collapse and the launcher fails with 'command not found'. Emit forward slashes from getManagedCommand() on win32 so the same JSON value works through every shell layer (Windows accepts forward slashes in path arguments, bash leaves them intact). Amp-Thread-ID: https://ampcode.com/threads/T-019de591-6d60-771f-bfc6-4a8164791bca Co-authored-by: Amp <[email protected]>
mralexsaavedra
pushed a commit
to mralexsaavedra/orca
that referenced
this pull request
May 2, 2026
… path (stablyai#1329) Co-authored-by: Amp <[email protected]>
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
… path (stablyai#1329) Co-authored-by: Amp <[email protected]>
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.
Fixes #1328.
Problem
On Windows, Orca writes the Claude Code managed hook command into
~/.claude/settings.jsonas a raw path with single backslashes:Claude Code invokes hooks through Git Bash (
/usr/bin/bash), which interprets\U,\A, etc. as escape sequences and collapses the path to:Every Claude Code hook (
UserPromptSubmit,Stop,PreToolUse,PostToolUse,PostToolUseFailure,PermissionRequest) fails on Windows. Manually editing the JSON works until Orca's nextinstall()overwrites it.Fix
Single-line change in
src/main/claude/hook-service.ts::getManagedCommand: emit forward slashes on Windows. They are accepted when invoking a.cmdfile and bash leaves them intact, so the same JSON value works through every shell layer.createManagedCommandMatcherinagent-hooks/installer-utils.tsalready normalizes slashes when sweeping stale entries, so existing installs migrate automatically on the nextinstall()call.Scope
Intentionally minimal:
src/main/claude/hook-service.ts(one function, one line of logic + a why-comment).getManagedCommandshape, but their runtime invocation paths have not been verified to exhibit the same bash-escape behavior. Keeping them out of scope makes this change safe to ship independently and easy to revert.OPENCODE_CONFIG_DIR+ JS plugin, no JSON-stored command).Relationship to #1308
Issue #1308 ("Managed hook runtime and PTY spawn env handling drift across layers") describes the same symptom but frames it as part of a broader cross-layer refactor covering PTY env shaping and runtime-state isolation.
This PR is intentionally narrower and more focused than #1308: a one-line behavioral fix that unblocks Windows users immediately, with no architectural changes. It does not preempt or block #1308's broader redesign — both can land independently.
Verification
getManagedCommandand confirmed the resulting path no longer collapses throughbash -c. Existing path matching increateManagedCommandMatcherhandles backslash-or-forward-slash normalization, so previously-installed entries are detected and swept on the next install.process.platform === 'win32'is unchanged for non-Windows; behavior on macOS/Linux is identical.Related