fix(cli): skip npm lifecycle scripts during agent-browser post-setup#48601
Open
liuhao1024 wants to merge 1 commit into
Open
fix(cli): skip npm lifecycle scripts during agent-browser post-setup#48601liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
agent-browser's postinstall script (fixUnixSymlink) replaces the global npm symlink to point directly at the local node_modules/ binary. When hermes update reinstalls node_modules, that local path is destroyed, leaving a dangling symlink that makes all browser tools unusable. Adding --ignore-scripts to the npm install call in _run_post_setup() prevents the postinstall from touching the global symlink while keeping the local node_modules/ install intact (bin stubs are created by npm regardless of lifecycle scripts, and the native binaries ship with the package). Fixes NousResearch#48521
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.
What does this PR do?
Adds
--ignore-scriptsto thenpm installcommand in_run_post_setup()to preventagent-browser's postinstall script from replacing the global npm symlink with a localnode_modules/path that gets destroyed on the nexthermes update.Related Issue
Fixes #48521
Type of Change
Changes Made
hermes_cli/tools_config.py: Added--ignore-scriptsflag to thenpm installcommand in_run_post_setup()for theagent_browser/browserbasepost-setup path. This preventsagent-browser'sfixUnixSymlink()postinstall from overwriting the global npm symlink (e.g./opt/homebrew/bin/agent-browser) to point at the localnode_modules/binary, which disappears on the next update.tests/hermes_cli/test_tools_config.py: Addedtest_agent_browser_post_setup_passes_ignore_scripts— verifies that--ignore-scriptsis present in the npm install command when_run_post_setup('agent_browser')runs.How to Test
npm install -g agent-browser@0.27.1ls -la $(which agent-browser)— should point to/opt/homebrew/lib/node_modules/agent-browser/...hermes update(or any command that triggers_run_post_setup("agent_browser"))ls -la $(which agent-browser)— should still point to the global install pathagent-browser --versionpython -m pytest tests/hermes_cli/test_tools_config.py::test_agent_browser_post_setup_passes_ignore_scripts -xvsChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
_run_post_setupinhermes_cli/tools_config.py(callers: 4 call sites in tools_config.py)_run_post_setup, which is a setup/installation pathfixUnixSymlink()inagent-browser/scripts/postinstall.jsis the upstream root cause;--ignore-scriptsis the standard npm flag to suppress lifecycle scripts