Skip to content

fix(update): out-of-tree venv installs refresh tool deps instead of pointing uv at <checkout>\venv (#116148, salvage #116293) - #117029

Merged
teknium1 merged 1 commit into
mainfrom
fix/b0919-R03-windows-update-sessions-venv
Sep 20, 2026
Merged

teknium1 merged 1 commit into
mainfrom
fix/b0919-R03-windows-update-sessions-venv

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

hermes update on an install whose interpreter lives outside the checkout (%LOCALAPPDATA%\hermes\venvs\hermes, the layout the shipped Windows launchers pin) now hands uv the real venv, so hermes tools Python dependencies are refreshed instead of failing with Failed 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 no venv//.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 to None.
  • Covers both halves the issue lists in one place: the VIRTUAL_ENV exports (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.
  • Tests: TestProjectVenvDirOutOfTree (2 invariants) in tests/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):

before (origin/main) after
project_venv_dir(PROJECT_ROOT) None …/home-1/venvs/hermes
VIRTUAL_ENV handed to uv <checkout>/venv, exists=False …/venvs/hermes, exists=True
uv target Using 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/hermes
stale-probe venv_python_path(venv_dir).exists() False → "not stale", probe no-ops True
  • New tests red with origin/main hermes_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 (one test_cmd_update.py case 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 the None with a fabricated <checkout>\venv that 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 two VIRTUAL_ENV export sites via a new running_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

Infographic

infographic

…<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>
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on 056bc03 — fix(update): resolve the live venv from the running interpre

debug info

CI timings

CI timings · View report · View job

Wall time 4m36s vs 8m50s (-47.9%). 6 job(s) slower, 6 faster,

  • OS-specific tests / macOS-only tests: +27.0s
  • OS-specific tests / Windows-only tests: -27.0s
  • Detect affected areas: -19.0s
  • Python lints / Windows footguns (blocking): +15.0s
  • Check no committed infographics / check-no-committed-infographics: +5.0s

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard platform/windows Native Windows-specific behavior or breakage area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Sep 20, 2026
@teknium1
teknium1 merged commit 4f6c04c into main Sep 20, 2026
37 checks passed
@teknium1
teknium1 deleted the fix/b0919-R03-windows-update-sessions-venv branch September 20, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes update never refreshes Python tool deps on out-of-tree venv installs — VIRTUAL_ENV points at a nonexistent <checkout>\venv

3 participants