Repository navigation
Conversation
…alls _pip_install_prefix (and the ZIP fallback) fabricated PROJECT_ROOT/venv whenever the checkout had no in-tree venv. On out-of-tree installs — the interpreter under $HERMES_HOME\venvs\hermes, the exact layout the shipped Windows gateway launchers pin themselves — that path does not exist, and uv aborts every command with 'Failed to inspect Python interpreter from active virtual environment' before doing any work. The main dependency install self-heals via the sys.executable pin (NousResearch#71510/NousResearch#83335), but the unguarded consumers — pip upgrade before lazy refresh, and the hermes tools dependency restore whose import probe resolves no target — fail, so tool deps stay frozen while the update still reports success. Resolve the install target instead of fabricating it: the checkout's in-tree venv, else the running interpreter's own venv root (running_venv_root, pyvenv.cfg-verified), else leave VIRTUAL_ENV unset so uv/pip resolve from sys.executable. Shared resolver so the git-pull and ZIP paths cannot drift; the repair path's uv venv creation target is untouched (it creates the path it names). Fixes NousResearch#116148
OverviewThis PR stops two update paths ( Findings
Minor: none. |
teknium1
pushed a commit
that referenced
this pull request
Sep 20, 2026
…<checkout>/venv An install whose interpreter lives outside the checkout ($HERMES_HOME/venvs/<name> — the layout the shipped Windows launchers assume) has neither venv/ nor .venv/ in-tree, so project_venv_dir() returned None and every `project_venv_dir(root) or root / "venv"` call site in the updater handed uv a VIRTUAL_ENV that does not exist (#116148): two uv interpreter errors per update, the import probe skipped, every `hermes tools` dependency reclassified as missing and reinstalled into a dead pointer, the staleness probe a no-op. project_venv_dir() — the single choke point — now falls back to the venv of the interpreter running this module, for the checkout it was loaded from only, so a foreign root (test temp dir, another clone) still resolves to None. In-tree venv/.venv still wins. Tests trimmed to two invariants in tests/test_hermes_constants.py. Salvages #116293; supersedes #116300 (same fix at the two VIRTUAL_ENV export sites). Co-authored-by: S <superb-cation@users.noreply.github.com>
Collaborator
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?
Fixes the
hermes updatefailure reported in #116148: on installs whose interpreter lives outside the checkout ($HERMES_HOME\venvs\hermes— the layout the shipped Windows gateway launchersHermes_Gateway.cmd/.ps1themselves pin), the updater fabricated aVIRTUAL_ENVpointing atPROJECT_ROOT/venv, which does not exist there. uv then aborts every command withFailed to inspect Python interpreter from active virtual environmentbefore doing any work.Mechanism (why the update still reported success): the main dependency install self-heals — the #71510/#83335 guard drops a nonexistent
VIRTUAL_ENVand pinssys.executable. But two unguarded consumers of_pip_install_prefix's env keep the fabricated path:_upgrade_pip_before_lazy_refresh→ the firstuvinterpreter error in the report_restore_active_tool_dependencies→_resolve_install_target_pythonresolves no target from a nonexistent venv, the import probe never runs, every tools dep is classified missing, and theuv pip installfails → the second interpreter error +faster_whisper failed to restoreSo
hermes toolsdependencies stay frozen at their install-time versions indefinitely, with only a one-line ⚠.The fix
Stop fabricating; resolve. New canonical helper
running_venv_root()inhermes_constants.py(pyvenv.cfg-verified — a bare/usr/bin/pythonmust not read as a venv root). New shared resolver_resolved_install_venv_dir()inupdate_cmd.py:venv/.venvwhen one exists (unchanged behavior)VIRTUAL_ENVunset; uv/pip resolve fromsys.executable(the proven fix(cli): target the managed install root in the ZIP update path #71510 pin path)Both the git-pull path (
_pip_install_prefix) and the ZIP fallback path (update_cmd_zip.py) now share the resolver so they cannot drift. The repair path'suv venv <dir>creation target is untouched — it creates the path it names, a different case.Two sibling fabrication sites in cold-recovery paths (
_install_repair.py,_early_recovery.py) are intentionally left: they run from a base interpreter repairing a broken in-tree install, a context where out-of-tree installs don't land, and the report shows neither fired (exactly two uv errors, both from the update flow).Verification
tests/hermes_cli/test_update_out_of_tree_venv.py(7 tests): real-venv detection, system-interpreter rejection, resolver precedence, env pinning, unset-when-unresolvabletest_lazy_refresh_venv_repair.pycontract assertion (it asserted the old fabricated-path behavior)test_cmd_update.py,test_update_handoff_desktop_rebuild.py,test_update_concurrent_quarantine.py,test_update_sqlite_remediation.py,test_lazy_refresh_venv_repair.py+ new suite → 105 passedFixes #116148
Type of Change
Checklist