Skip to content

fix(doctor): skip npm audit when no package-lock.json in Hermes-managed install#39449

Closed
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/doctor-skip-audit-no-lockfile
Closed

fix(doctor): skip npm audit when no package-lock.json in Hermes-managed install#39449
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/doctor-skip-audit-no-lockfile

Conversation

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

Summary\nWhen npm audit runs inside a Hermes-managed install that has node_modules but no package-lock.json (e.g. Windows native vendored installs), the audit itself works but the only safe remediation — npm audit fix — cannot run without a lockfile. This PR skips the audit in that case and tells the user why.\n\nFixes #36893\n\n## Files changed\n- hermes_cli/doctor.py — skip check + informative messages\n- tests/hermes_cli/test_doctor.py — regression tests

On Windows native installs (and any Hermes-managed install where
agent-browser is vendored without a package-lock.json), `hermes doctor`
was reporting phantom 'X npm vulnerabilities' and telling users to run
`npm audit fix` inside the Hermes-managed directory in %LOCALAPPDATA%.

That fix path is un-actionable:
- `npm audit fix` requires a lockfile to safely update
- The path is Hermes-managed; users should not hand-edit it
- Vulnerabilities in vendored deps are addressed by the Hermes release
  pipeline, not by individual user action

Now doctor checks for package-lock.json before running the audit. When
it's missing, the audit is skipped and three info lines explain:
1. why the audit was skipped (no package-lock.json)
2. that vulnerabilities are managed by the release pipeline
3. that users should not run `npm audit fix` inside that path

Regression tests cover both the no-lockfile (skip) and lockfile-present
(run normally) paths. Closes NousResearch#36893.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jun 5, 2026
@alaamohanad169-ship-it alaamohanad169-ship-it marked this pull request as ready for review June 5, 2026 06:40
@alaamohanad169-ship-it alaamohanad169-ship-it deleted the fix/doctor-skip-audit-no-lockfile branch June 6, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants