Skip to content

fix: resolve Node outside minimal hook PATH - #737

Open
fscfede-beep wants to merge 13 commits into
openai:mainfrom
fscfede-beep:fix/portable-node-launcher-105
Open

fix: resolve Node outside minimal hook PATH#737
fscfede-beep wants to merge 13 commits into
openai:mainfrom
fscfede-beep:fix/portable-node-launcher-105

Conversation

@fscfede-beep

@fscfede-beep fscfede-beep commented Sep 5, 2026

Copy link
Copy Markdown

Summary

Fixes #105.

Claude Code hooks and deterministic !-pattern commands can run with a minimal shell PATH that does not expose a normally installed Node or Codex executable. This PR adds a portable POSIX launcher and routes the affected plugin surfaces through it.

The current branch covers the compatibility issues found during review:

  • validates every candidate against Node >=18.18;
  • preserves the selected toolchain directory on PATH;
  • routes /codex:transfer through the same portable launcher as the other deterministic commands;
  • discovers standard Windows / Git Bash installs via Program Files, NVM_SYMLINK, VOLTA_HOME, and LOCALAPPDATA;
  • restores custom npm global locations through NPM_CONFIG_PREFIX or npm prefix -g;
  • honors and normalizes custom NVM_DIR, FNM_DIR, ASDF_DATA_DIR, and MISE_DATA_DIR roots for both Node discovery and PATH enrichment;
  • honors normalized HOMEBREW_PREFIX and the standard Linuxbrew /home/linuxbrew/.linuxbrew prefix, in addition to macOS/Homebrew fallback locations;
  • prefers a supported managed Node whose directory contains the Codex shim when the incoming PATH would otherwise split Node and Codex across different toolchains;
  • normalizes an explicit native-Windows CODEX_COMPANION_NODE before returning it, so downstream directory derivation exposes the selected toolchain's adjacent npm/Codex executables instead of falling back to .;
  • isolates launcher tests from inherited version-manager / Windows installation-root variables case-insensitively.

Validation

Fresh validation on Windows 11 / Git Bash at head e116d57b1d5fa61a3bfa02ab6aa9595335b84416:

  • commands / launcher / process / state: 28 passed, 0 failed;
  • SessionStart / SessionEnd focal lifecycle tests: 2 passed, 0 failed;
  • custom ASDF_DATA_DIR / MISE_DATA_DIR regression: RED before fix, GREEN after;
  • native-Windows configured-Node PATH propagation regression: RED before fix (PATH fell back to .), GREEN after;
  • HOMEBREW_PREFIX regression: RED before fix with exit 127, GREEN after;
  • bash -n plugins/codex/scripts/run-node.sh: PASS;
  • hooks JSON parse: PASS;
  • git diff --check: PASS.

Upstream Pull Request CI is checked per head. If GitHub reports action_required with zero jobs, that is treated as an external workflow-approval/action gate, not a CI test failure.

Current scope

The implementation remains limited to launcher/routing compatibility and regression coverage; it does not alter Codex task/review semantics.

@fscfede-beep
fscfede-beep requested a review from a team September 5, 2026 01:26

@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: 8f09814f4b

ℹ️ 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/codex/scripts/run-node.sh
Comment thread plugins/codex/scripts/run-node.sh

@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: a17c3dafe4

ℹ️ 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/codex/scripts/run-node.sh

@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: cc0ffadc0e

ℹ️ 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/codex/scripts/run-node.sh Outdated

@sylvesterkaczmarek sylvesterkaczmarek 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.

There is a version-manager edge here when node is absent from PATH and several nvm/fnm/asdf/mise installations exist. The glob loop selects the first supported executable in lexical path order, not the version manager's active/default runtime. That selected directory is then prepended to PATH, so a codex shim found later in another installation can still resolve #!/usr/bin/env node to the earlier, unrelated Node version. A machine with nvm v20 and v24 installed can therefore run the companion and Codex under a different runtime than the user's configured default. Resolving the manager's default/current alias first, or selecting the highest supported semantic version, would avoid that mismatch. A regression with two supported nvm installs and codex present only in the newer one would make the behavior explicit.

@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: ef58bf1597

ℹ️ 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/commands.test.mjs Outdated
Comment thread plugins/codex/scripts/run-node.sh Outdated

@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: 1338edef04

ℹ️ 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/codex/scripts/run-node.sh Outdated

@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: a6855f3992

ℹ️ 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/node-launcher.test.mjs Outdated

@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: 64dcef9272

ℹ️ 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/codex/scripts/run-node.sh Outdated

@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: a420fc0dfb

ℹ️ 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/codex/scripts/run-node.sh Outdated

Copy link
Copy Markdown
Author

Review reconciliation update for the multi-version/toolchain concern: addressed in 64dcef9 and subsequently extended through 0ef6b73. The launcher now prefers a supported managed Node whose directory contains the Codex shim when the incoming PATH would otherwise split Node and Codex across toolchains. The two-supported-nvm regression (v20 + v24, Codex only beside v24) was RED before the fix and GREEN after it. Custom NVM_DIR and FNM_DIR are also normalized and used for discovery/PATH enrichment. Fresh validation on current head 0ef6b73: commands/launcher/process/state 26/26 PASS; lifecycle focal 2/2 PASS; shell/JSON/diff checks PASS. Upstream PR CI remains an external action_required gate with 0 jobs created.

@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: 0ef6b735bc

ℹ️ 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/codex/scripts/run-node.sh Outdated
Comment thread plugins/codex/scripts/run-node.sh

Copy link
Copy Markdown
Author

@codex review

Please re-review current head 11007e405a86415407f208879324f5960868f2a2. The two findings from the prior 0ef6b73 review were addressed with RED→GREEN regressions: custom ASDF_DATA_DIR / MISE_DATA_DIR discovery+PATH enrichment, and normalization of explicit native-Windows CODEX_COMPANION_NODE before selected-directory derivation. Fresh exact-head validation: commands/launcher/process/state 27/27 PASS; SessionStart/SessionEnd 2/2 PASS; bash -n, hooks JSON parse, and git diff --check PASS. Upstream CI remains action_required with 0 jobs.

@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: 11007e405a

ℹ️ 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/codex/scripts/run-node.sh Outdated

Copy link
Copy Markdown
Author

@codex review

Current head e116d57 addresses the Linuxbrew/Homebrew prefix finding with a RED→GREEN HOMEBREW_PREFIX regression and standard /home/linuxbrew/.linuxbrew fallback. Fresh local validation: commands/launcher/process/state 28/28 PASS; SessionStart/SessionEnd 2/2 PASS; bash -n, hooks JSON parse, and git diff --check PASS. Please review the current head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: e116d57b1d

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

fscfede-beep commented Sep 6, 2026

Copy link
Copy Markdown
Author

@openai/developer-experience — contributor-side work on this PR is complete at exact head e116d57b1d5fa61a3bfa02ab6aa9595335b84416: the known review findings are resolved and current-head local validation is documented in the PR body. I verified that the active Main ruleset requires at least one formal approval from the Developer Experience team for *. The repository's classic required-status-check protection is currently off; Actions is still action_required with 0 jobs, so CI has not executed, but I am not representing that as a proven merge requirement here. When convenient, could someone from Developer Experience review the current head? No maintainer approval or CI result is being claimed yet.

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.

Codex plugin commands fail with command not found: node on Mac App

2 participants