fix(update): handle uv-tool, pipx, and system-Python installs in hermes update (#29700)#35248
Merged
Conversation
) Hermes installed via `uv tool install hermes-agent` lives outside any venv. `_cmd_update_pip` previously ran `uv pip install --upgrade`, which errors with `No virtual environment found; run uv venv ...`. The user hits this on the very first `hermes update` after a standard non-`--system` install with `uv` on PATH. Add `is_uv_tool_install()` in `hermes_cli/config.py`: fast path inspects `sys.prefix` for the standard `uv/tools/hermes-agent/` layout, falls back to `uv tool list` for non-standard prefixes. Both the user-facing `recommended_update_command_for_method("pip")` string and the actual subprocess invocation in `_cmd_update_pip` now switch to `uv tool upgrade hermes-agent` when detected. Non-tool installs and the no-`uv` fallback keep their existing commands unchanged.
Copilot review on PR #29703 flagged two issues with the `uv tool list` fallback in `is_uv_tool_install`: 1. False positive: `uv tool list` returns the *machine*'s installed tools, not the active install. A regular pip/venv Hermes on a host that also has `uv tool install hermes-agent` available would be misclassified as a uv-tool install, and `hermes update` would upgrade the wrong copy. 2. Overhead: the subprocess call (up to a 15s timeout) was triggered even from `recommended_update_command_for_method`, which just computes a display string. Restrict detection to properties of the running interpreter (`sys.prefix` and `sys.executable` — both can carry the uv-tool layout marker depending on entry point). Drop the `uv tool list` fallback and the `uv_path` parameter entirely. `_cmd_update_pip` now also surfaces a clear hint when the runtime looks like a uv-tool install but `uv` is missing from PATH, instead of silently falling back to `python -m pip`.
Extends the uv-tool detection (briandevans, #29703) to cover the remaining no-venv install layouts that hit the same uv 'No virtual environment found' error: - pipx-managed installs (sys.prefix under .../pipx/...) -> 'pipx upgrade', matching scripts/auto-update.sh (pipx-detection idea from inchargeautomation-lab, #29852) - bare pip outside any venv -> 'uv pip install --system --upgrade' - venv (launcher shim) keeps the VIRTUAL_ENV overlay from #35224 and never gets --system, so the install always targets the venv, not system Python The four branches are mutually exclusive; VIRTUAL_ENV is exported only for the uv-pip-in-venv path (uv tool / pipx upgrade ignore it). Co-authored-by: Joshua Kimbrell <incharge.automation@gmail.com>
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1 |
First entries
tests/hermes_cli/test_uv_tool_update.py:20: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
✅ Fixed issues: none
Unchanged: 4925 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This was referenced May 30, 2026
Closed
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.
Summary
hermes updatenow succeeds across every no-venv install layout, instead of failing withNo virtual environment foundwhenever Hermes wasn't installed into an activatable virtualenv._cmd_update_pipalways ranuv pip install --upgrade hermes-agentwhen uv was on PATH, but that errors out foruv tool install,pipx install, and bare system-Python installs — none of which expose an active venv. The update path now detects the actual layout and picks the right command.Changes
hermes_cli/config.py:is_uv_tool_install()helper (detectsuv toollayout from the running interpreter'ssys.prefix/sys.executableonly — neveruv tool list, so a pip/venv Hermes on a machine that also has a uv-tool copy isn't misclassified).recommended_update_command_for_method("pip")routes through it.hermes_cli/main.py_cmd_update_pip:uv toolinstall →uv tool upgrade hermes-agentsys.prefixunder.../pipx/...) →pipx upgrade hermes-agent(matchesscripts/auto-update.sh)uv pip install --upgrade+VIRTUAL_ENVoverlay (preserves fix(update): export launcher virtualenv to uv (#35031) #35224)uv pip install --system --upgradeVIRTUAL_ENVis exported only for the uv-pip-in-venv path (uv tool/pipx upgradeignore it).tests/hermes_cli/test_uv_tool_update.py: uv-tool detection + recommendation + subprocess tests (from fix(cli): useuv tool upgradewhen Hermes is a uv tool install (#29700) #29703), plus a new layout class covering pipx,--system, and the venv overlay.scripts/release.py: AUTHOR_MAP entry for the pipx co-author.Validation
uv tool installuv tool upgrade hermes-agentpipx installpipx upgrade hermes-agentuv pip install --upgrade hermes-agentuv pip install --system --upgrade hermes-agentpython -m pip install --upgrade hermes-agenttests/hermes_cli/test_uv_tool_update.py+test_cmd_update.py: 43/43 pass. E2E verified against the real_cmd_update_pipwith real imports for all five layouts above.Credit
Consolidates #29700's
hermes updatecluster:uv tool upgradewhen Hermes is a uv tool install (#29700) #29703), authorship preserved.hermes update#29852), credited via Co-authored-by.Fixes #29700.
Infographic