Skip to content

fix(windows): prefer managed node for whatsapp and desktop - #49239

Closed
helix4u wants to merge 1 commit into
NousResearch:mainfrom
helix4u:codex/windows-managed-node-whatsapp-desktop
Closed

fix(windows): prefer managed node for whatsapp and desktop#49239
helix4u wants to merge 1 commit into
NousResearch:mainfrom
helix4u:codex/windows-managed-node-whatsapp-desktop

Conversation

@helix4u

@helix4u helix4u commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Windows Hermes-owned Node/npm resolution for WhatsApp setup/gateway and Desktop rebuild/update paths.

Windows installs place Hermes-managed portable Node directly under %LOCALAPPDATA%\hermes\node with node.exe and npm.cmd. Several Hermes subprocess paths still resolved bare node / npm from PATH, and the Desktop updater only prepended HERMES_HOME/node/bin, which is the POSIX layout. On Windows machines with a bad or elevation-triggering system Node/npm, WhatsApp setup/gateway and Desktop rebuilds could fail even though Hermes-managed Node was installed and working.

This adds one shared Python resolver for Hermes-managed Node/npm and uses it in the Python WhatsApp/Desktop/Web build paths, plus a matching Desktop main-process PATH helper for updater handoff/rebuild flows.

Related Issue

Support thread: https://discord.com/channels/1053877538025386074/1517614256680468600

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_constants.py: add Hermes-managed Node/npm lookup helpers for Windows %LOCALAPPDATA%\hermes\node, POSIX $HERMES_HOME/node/bin, and PATH augmentation.
  • hermes_cli/main.py: use the managed Node/npm resolver for hermes whatsapp, web UI build, Electron redownload, Desktop build, and update-time Node dependency install.
  • gateway/platforms/whatsapp.py: use managed Node/npm for WhatsApp requirement checks, bridge dependency install, bridge subprocess PATH, and bridge launch.
  • apps/desktop/electron/main.cjs: prepend the Windows portable Node directory as well as the POSIX node/bin directory during updater handoff and in-app rebuild flows.
  • tests/test_hermes_constants.py: add resolver coverage for Windows managed Node directory order, npm.cmd lookup, and PATH prepending.

How to Test

  1. On Windows with Hermes installed under %LOCALAPPDATA%\hermes, make sure %LOCALAPPDATA%\hermes\node\node.exe and %LOCALAPPDATA%\hermes\node\npm.cmd exist.
  2. Put a broken, incompatible, or elevation-triggering system Node/npm earlier on PATH, or remove system Node/npm from PATH.
  3. Run hermes whatsapp and verify bridge dependency install/pairing uses Hermes-managed Node/npm instead of the bad PATH copy.
  4. Start the gateway with WhatsApp enabled and verify the bridge launches instead of logging WhatsApp: Node.js not installed or bridge not configured.
  5. Run the Desktop update/rebuild path and verify the Desktop build can find Hermes-managed npm from %LOCALAPPDATA%\hermes\node.

Scoped validation run in this checkout:

  • python -m py_compile hermes_constants.py hermes_cli/main.py gateway/platforms/whatsapp.py tests/test_hermes_constants.py
  • node --check apps/desktop/electron/main.cjs
  • inline Python resolver assertions for Windows managed npm.cmd lookup and PATH prepending

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Reported support symptoms included:

  • hermes whatsapp: npm install failed with no output.
  • Later hermes whatsapp: WinError 740, elevation required.
  • Gateway skipped WhatsApp with WhatsApp: Node.js not installed or bridge not configured and No adapter available for whatsapp.
  • Manual %LOCALAPPDATA%\hermes\node\npm.cmd run pack succeeded where Desktop updater rebuild did not.

@alt-glitch alt-glitch added type/bug Something isn't working platform/whatsapp WhatsApp Business adapter comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 19, 2026
@helix4u
helix4u marked this pull request as ready for review June 19, 2026 20:00
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Superseded by #49254, which salvages this work with your authorship preserved (your commit is cherry-picked verbatim at the base of that PR's stack) plus two follow-up commits on top:

  • a sibling-coverage fix routing the hermes update desktop-rebuild gate through the same find_node_executable("npm") resolver (it was still on a bare shutil.which("npm")), and
  • a small behavior-preserving refactor of the resolver helpers (hoist the command-name list out of the inner loop, drop a redundant os.environ.copy(), add reciprocal keep-in-sync comments between the Python and Electron path helpers).

Thanks for the fix, @helix4u — the cross-platform reasoning and the npm.cmd-before-npm.ps1 handling were spot on. Also filed #49259 to track consolidating the remaining hand-rolled managed-node resolution sites (mcp_tool, browser_tool, the TUI launcher, gateway service path) onto your new hermes_constants helpers as a separate follow-up.

Closing in favor of #49254.

kshitijk4poor added a commit that referenced this pull request Jun 19, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of #49239.
gnalvesteffer pushed a commit to gnalvesteffer/hermes-agent that referenced this pull request Jun 19, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
The `hermes update` desktop-rebuild gate still used a bare
`shutil.which("npm")` presence check. On a Windows box where the only
working npm is the Hermes-managed npm.cmd (not on PATH), the gate would
skip the desktop rebuild even though _build_web_ui / cmd_gui can now find
it via find_node_executable. Route the gate through the same resolver for
full bug-class coverage.

Surfaced during review of NousResearch#49239.
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 comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants