fix(photon): resolve the Hermes-managed Node for the sidecar - #76804
fix(photon): resolve the Hermes-managed Node for the sidecar#76804Drexuxux wants to merge 1 commit into
Conversation
$HERMES_HOME/node is never on an arbitrary process's PATH — only generated
service units get it prepended — so on an install whose Node is the managed
one, every bare shutil.which() in the photon platform resolved nothing:
* check_requirements() reported photon unavailable, so the gateway never
created the adapter at all
* _reinstall_sidecar_deps() gave up before running npm
* `hermes photon install-sidecar` refused to run
* the spawn fell back to the literal "node" and died with FileNotFoundError
on every connect
That is precisely the population the installer provisions a managed Node
for: system Node/npm missing, or below the engines floor.
Route the five call sites through hermes_constants.find_node_executable(),
which checks the managed tree first and keeps PATH as the fallback rung, and
run npm (plus the sidecar itself) with the managed directories ahead on PATH
so npm's own `env node` launcher resolves too. An explicit PHOTON_NODE_BIN
stays authoritative.
|
Thanks for tracing the managed-runtime gap across the Photon adapter and CLI. The premise is confirmed on current main: The PR applies that existing mechanism at the affected sites, preserves the explicit Automated hermes-sweeper review. |
What
On an install whose Node is the Hermes-managed one, the Photon platform never works — and stays broken on every run.
$HERMES_HOME/nodeis not on an arbitrary process's PATH; only generated service units get it prepended. Photon resolved node and npm with bareshutil.which()at five sites, so all five resolved nothing:adapter.pycheck_requirements()adapter.pynpm gate +_reinstall_sidecar_deps()adapter.py_node_bin"node"→FileNotFoundErrorcli.pyinstall-sidecarcli.pystatus✗ missing (install Node 18+)That is exactly the population the installer provisions a managed Node for: system Node/npm missing, or below the engines floor.
Reproduced with a managed tree present and no system Node on PATH:
25d0bcd42fixed this class across 11 files andtests/test_managed_runtime_resolution.pyguards it, but that guard's_EXEMPT_DIRSskipsplugins/— so the platform adapters were never swept.Fix
Route the five sites through
hermes_constants.find_node_executable(): managed tree first, PATH kept as the fallback rung,Nonewhen a managed tree exists but cannot be healed (never silently a system copy).npm also needs the managed dirs on PATH, not just an absolute path — npm's launcher runs under
env node, and the sidecar shells out to node too. The npm runs and the sidecar spawn now usewith_hermes_node_path().An explicit
PHOTON_NODE_BINstays authoritative and is still validated.Tests
tests/plugins/platforms/photon/test_managed_node_resolution.py— 11 tests. PATH is pinned empty in each one, so the managed rung decides the outcome rather than whatever the host has installed:check_requirements()accepts a managed Node; still False with no Node anywhereinstall-sidecarrun the managed npm, with the managed dir on the child's PATHPHOTON_NODE_BINstill wins; a broken override is still a hard failureTwo existing tests were updated rather than worked around:
test_inbound.py::test_check_requirements_without_nodeencoded the old "not on PATH → refuse" contract; it now stubs the managed resolver too, preserving its intent — no Node anywhere → refuse.test_npm_error_log_regression.pypatchedcli_mod.shutil.which, whichcli.pyno longer uses; the 7 patch lines now target the resolver. Assertions unchanged.Broader run —
tests/plugins/: 1077 passed, 9 failed, the same 9 that fail on a clean checkout. Baseline verified by stashing the change: 1066 passed, 9 failed — same set, zero new failures.