fix: use ${PLUGIN_ROOT} so the Stop hook runs on Windows - #64
Open
milanagm wants to merge 1 commit into
Open
Conversation
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
Codex runs command hooks through the platform shell:
$SHELL -lcon Unix, but%COMSPEC% /C, i.e.cmd.exe, on Windows (codex-rs/hooks/src/engine/command_runner.rs).cmd.exehas no POSIX parameter expansion, so theStophook commandreached
nodeas a literal string, and the hook always exited 1 on Windows.Fix
Codex substitutes
${PLUGIN_ROOT}in a plugin hook's command line itself, literally and on every platform, before any shell sees the line (openai/codex#19705,codex-rs/hooks/src/engine/discovery.rs). That support shipped on 2026-04-28, so it predates every Codex version in the reports (0.135.0 and newer). It also drops the hardcoded0.1.0, so the path no longer has to be bumped in lockstep with the plugin version.Why the test file changes too
The existing test could not have caught this, and it also blocked those two PRs:
shell: true, so it always got a POSIX shell, and CI isubuntu-latestonlyCODEX_HOMEbut neverPLUGIN_ROOT, so${PLUGIN_ROOT}expanded to the empty string and the executing test exited 1Net effect is a smaller test file.
stageInstalledPluginandreadPluginVersionexisted only to serve the old hardcoded path, and the stagedplugins/cache/.../0.1.0/tree existed only so that path had something to find. The test now pointsPLUGIN_ROOTat the real plugin directory and executes the committed bundle.The one genuinely new assertion is the regression guard:
${PLUGIN_ROOT}is resolved by Codex. Any other$can only be resolved by a shell, and on Windows that shell iscmd.exe. This is the only assertion that separates "works on Linux" from "works on Windows", which matters because CI never runs Windows.Verification
pnpm test40/40 green,pnpm run lintcleanhooks.jsonalone fails 2 of the 3 tests on Linux"${NODE_BINARY:-node}" "${PLUGIN_ROOT}/dist/index.mjs", fails the guard alone while the executing test stays greenFixes #55
Fixes #32
LFE-15599