Skip to content

fix(process_host): forward-slash Windows hook paths for Git Bash (#773) - #827

Merged
pbean merged 3 commits into
fix/783-779-worktree-reliabilityfrom
fix/773-windows-hook-command
Sep 23, 2026
Merged

pbean merged 3 commits into
fix/783-779-worktree-reliabilityfrom
fix/773-windows-hook-command

Conversation

@pbean

@pbean pbean commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #773.

Summary

  • Register Windows hook paths with forward slashes. Claude Code runs shell-form hook commands under Git Bash on Windows, where an unquoted backslash is an escape character. So the registered relay C:\Users\me\.local\bin\bmad-loop.exe ran as C:Usersme.localbinbmad-loop.exe, no events were written, and every session stalled until session_timeout_min. WindowsProcessHost.shell_quote now converts separators to forward slashes before list2cmdline, so a path with spaces is still double-quoted. Registrations written before [BUG] Native Windows: hook relay command is shell-mangled, so no session event ever fires #773 with backslashes are still recognized as managed, so init and worktree provisioning replace them. The Codex trust diagnostic reads them as untrusted until the next init.
  • validate flags a stale relay spelling. hooks.relay-stale compared Path objects. On Windows, Path equality and str(Path) both normalize separators, so a pre-[BUG] Native Windows: hook relay command is shell-mangled, so no session event ever fires #773 backslash registration was never flagged, even though init's merge_hooks compares raw strings and does rewrite it. The new relay_executable_text returns the executable exactly as registered, and registered_relay_paths pairs each Path with that text. validate still checks presence with the Path, but compares the registered text against the text init would write now. So the warning means "re-running init would change something". It is a warning only (rc 0), like the existing stale-installation warning.

Notes for reviewers

  • The Windows CI leg is the proof for this layer. The Git Bash and PowerShell execution rows and the new test_validate_warns_on_backslash_windows_relay_registration are win32-only and are skipped on Linux by design. No Windows host or psmux live gate was available while writing this. Please wait for the Windows CI leg to pass before merging.
  • Known gap: on the PowerShell fallback (no Git Bash), a relay path that contains a space is not supported.
  • A backslash registration is a warning, not a failure: it still works under the PowerShell fallback, and rc stays 0 for an advisory.
  • test_validate_warns_when_registered_relay_uses_another_installation now reads its expected value with relay_executable_text. On POSIX nothing changes. On Windows, str(Path) would have converted init's forward slashes back to backslashes. test_validate_warns_when_relay_spelling_differs_but_path_is_equal was ablation-checked: it fails if the check goes back to comparing Path objects.
  • Gate at this layer: 10877 passed, 85 skipped; pyright 0 errors.

Stack

Part of a stack; merge bottom-up. This is layer 2 of 8, on top of #826.

Stack order (bottom → top): #826 → #827 → #828 → #829 → #830 → #831 → #832 → #833.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c97c622c-aaa0-408f-a848-f04866ee70f5

📥 Commits

Reviewing files that changed from the base of the PR and between ba18b33 and a30b9ea.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • src/bmad_loop/cli.py
  • src/bmad_loop/install.py
  • src/bmad_loop/process_host.py
  • tests/conftest.py
  • tests/test_cli.py
  • tests/test_codex_trust.py
  • tests/test_install.py
  • tests/test_process_host.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

t added 2 commits September 22, 2026 18:04
Claude Code runs shell-form hook commands under Git Bash on Windows, where
an unquoted backslash is an escape: the registered relay
C:\Users\me\.local\bin\bmad-loop.exe ran as C:Usersme.localbinbmad-loop.exe,
no events were written, and every session stalled to session_timeout_min.

WindowsProcessHost.shell_quote now normalizes separators to forward slashes
before list2cmdline, so a path with spaces is still double-quoted. Every
caller passes a path. Pre-#773 backslash registrations are still recognized
as managed, so init and worktree provisioning replace them; the Codex trust
diagnostic reads them as untrusted until re-init. Paths with spaces remain
unsupported on the PowerShell fallback.
…nit's (#773)

hooks.relay-stale compared Path objects. On Windows, Path equality and
str(Path) both normalize separators, so a pre-#773 backslash registration,
which Git Bash mangles and which stalls every in-place session, was never
flagged, although init's merge_hooks (a raw-string comparison) rewrites it.

relay_executable_text now returns the executable exactly as registered,
and registered_relay_paths pairs each Path with that spelling. validate
keeps its presence checks on the Path but compares the registered text
with the one init would write now, so the warning means "re-running init
changes something". It stays advisory (rc 0).

The existing another-installation test now reads the expected spelling
with relay_executable_text. It is unchanged on POSIX, and on Windows
str(Path) would respell init's forward slashes.
@pbean
pbean force-pushed the fix/773-windows-hook-command branch from 88ea69d to c681fc7 Compare September 23, 2026 01:04
@pbean

pbean commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T01:26:05.311812Z c681fc7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: c681fc7f32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pbean
pbean merged commit ddd2bf8 into main Sep 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Native Windows: hook relay command is shell-mangled, so no session event ever fires

1 participant