Skip to content

fix(plugins): make Claude hook tests portable on Windows#1055

Merged
phernandez merged 5 commits into
mainfrom
codex/fix-windows-claude-hook-tests
Jul 15, 2026
Merged

fix(plugins): make Claude hook tests portable on Windows#1055
phernandez merged 5 commits into
mainfrom
codex/fix-windows-claude-hook-tests

Conversation

@phernandez

@phernandez phernandez commented Jul 15, 2026

Copy link
Copy Markdown
Member

Why

The Bash hook regression tests added in #924 pass on macOS and Linux, but fail in the Windows unit job because subprocess.run(["bash", ...]) resolves to the Windows WSL launcher. GitHub's Windows runner has no WSL distribution installed, so the tests exit before exercising the scripts. After selecting Git Bash, native Windows Python also exposed two harness assumptions: it resolves the home directory through USERPROFILE, and it cannot execute an extensionless shebang shim directly.

What Changed

  • On Windows, resolve Git for Windows bin/bash.exe from the installed git.exe.
  • Let Claude hooks honor the same explicit BM_BIN command override as the Codex hooks.
  • Preserve existing literal executable paths, including native paths with spaces, before parsing multi-token launcher commands.
  • Inject the fake CLI as an explicit Python command, so subprocess execution is portable.
  • Isolate both HOME and USERPROFILE in the hook harness.
  • Cover Git Bash selection, raw command paths with spaces, and the normal PATH-based CLI discovery flow.

Testing

  • uv run pytest -q tests/test_claude_plugin_hooks.py — 6 passed.
  • just fast-check — passed with the repository's existing Python 3.14 asyncio deprecation diagnostics.
  • just package-check-claude-code — passed.
  • git diff --check — passed.

Risks / Follow-ups

The remaining validation is the Windows GitHub Actions unit job that exposed both failures. Once this lands, queued PRs should be rebased so their Windows jobs include the corrected harness.

Signed-off-by: phernandez <paul@basicmachines.co>

Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown
Member Author

recheck

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 0d9dc4dd19

ℹ️ 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".

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez

Copy link
Copy Markdown
Member Author

recheck

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d319bc2e4c

ℹ️ 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".

Comment thread plugins/claude-code/hooks/session-start.sh
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

recheck

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e94041fca

ℹ️ 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".

Comment thread tests/test_claude_plugin_hooks.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez phernandez changed the title fix(plugins): use Git Bash for Claude hook tests fix(plugins): make Claude hook tests portable on Windows Jul 15, 2026
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez

Copy link
Copy Markdown
Member Author

recheck

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be19ae794c

ℹ️ 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".

Comment thread tests/test_claude_plugin_hooks.py
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez

Copy link
Copy Markdown
Member Author

recheck

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 02b41359ff

ℹ️ 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".

@phernandez phernandez merged commit 26c3682 into main Jul 15, 2026
29 checks passed
@phernandez phernandez deleted the codex/fix-windows-claude-hook-tests branch July 15, 2026 04:35
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.

1 participant