Repository navigation
fix(update): out-of-tree venv installs refresh tool deps instead of pointing uv at <checkout>\venv (#116148, salvage #116293) - #117029
Merged
Conversation
…<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>
૮ >ﻌ< ა ci reviewran on 056bc03 — fix(update): resolve the live venv from the running interpre debug infoCI timingsCI timings · View report · View jobWall time 4m36s vs 8m50s (-47.9%). 6 job(s) slower, 6 faster,
|
This was referenced Sep 20, 2026
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.
hermes updateon an install whose interpreter lives outside the checkout (%LOCALAPPDATA%\hermes\venvs\hermes, the layout the shipped Windows launchers pin) now handsuvthe real venv, sohermes toolsPython dependencies are refreshed instead of failing withFailed to inspect Python interpreter from active virtual environment.hermes_constants.py::project_venv_dir— the single choke point every updater call site routes through (project_venv_dir(root) or root / "venv"×12) — falls back to the running interpreter's venv when the checkout has novenv//.venv/, for the checkout this module was loaded from only. In-tree venv still wins; a foreign root (test temp dir, another clone) still resolves toNone.VIRTUAL_ENVexports (update_cmd.py::_pip_install_prefix,update_cmd_zip.py) and the stale probes (update_cmd_deps.py::_venv_dependency_set_stale,update_cmd_windows.py,main_install_repair.py,_install_repair.py) all see the real venv now.TestProjectVenvDirOutOfTree(2 invariants) intests/test_hermes_constants.py.Live repro (Linux, out-of-tree venv
home-1/venvs/hermes, checkout with no in-tree venv, real_pip_install_prefix→uv pip install --dry-run):origin/main)project_venv_dir(PROJECT_ROOT)None…/home-1/venvs/hermesVIRTUAL_ENVhanded to uv<checkout>/venv, exists=False…/venvs/hermes, exists=TrueUsing Python 3.11.15 environment at: <a different .venv found by directory walk>— deps land in the wrong environment (on the reporter's Windows box uv aborts instead:Failed to inspect Python interpreter)Using Python 3.11.15 environment at: …/home-1/venvs/hermesvenv_python_path(venv_dir).exists()origin/mainhermes_constants.py, green with the fix;tests/test_hermes_constants.py tests/hermes_cli/test_cmd_update.py tests/hermes_cli/test_lazy_refresh_venv_repair.py tests/hermes_cli/test_update_concurrent_quarantine.py tests/hermes_cli/test_update_sqlite_remediation.py→ 166 passed (onetest_cmd_update.pycase failed twice under a loaded box while a sibling suite ran, then passed 3/3 alone on this head and 1/1 on base — load, not a regression).Root cause:
project_venv_dir()only looked inside the checkout, so every caller papered over theNonewith a fabricated<checkout>\venvthat does not exist on out-of-tree installs.Fixes #116148
Salvages #116293 (@Finn763) — cherry-picked; test file trimmed from 5 tests to 2 invariants folded into the existing
tests/test_hermes_constants.py.Supersedes #116300 (@rocks737,
Co-authored-by) — same fix applied at the twoVIRTUAL_ENVexport sites via a newrunning_venv_root(); the choke-point fallback covers those sites and the stale probes the issue lists, so its extra resolver is not needed.Dropped hunks
hermes_constants.py::running_venv_root,update_cmd.py::_resolved_install_venv_dir,update_cmd_zip.pyhunk,tests/hermes_cli/test_update_out_of_tree_venv.py,test_lazy_refresh_venv_repair.pyexpectation change — subsumed by theproject_venv_dir()fallback (re-probed:_pip_install_prefixyields the real venv, see table).tests/test_project_venv_dir_out_of_tree.py— replaced by the 2 folded invariants (in-tree-wins, foreign-root-None, half-deleted-venv and base-interpreter cases were controls of unchanged behaviour).Infographic