Skip to content

fix(update): handle uv-tool, pipx, and system-Python installs in hermes update (#29700)#35248

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-a486d27b
May 30, 2026
Merged

fix(update): handle uv-tool, pipx, and system-Python installs in hermes update (#29700)#35248
teknium1 merged 4 commits into
mainfrom
hermes/hermes-a486d27b

Conversation

@teknium1

@teknium1 teknium1 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

hermes update now succeeds across every no-venv install layout, instead of failing with No virtual environment found whenever Hermes wasn't installed into an activatable virtualenv.

_cmd_update_pip always ran uv pip install --upgrade hermes-agent when uv was on PATH, but that errors out for uv 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 (detects uv tool layout from the running interpreter's sys.prefix/sys.executable only — never uv 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 tool install → uv tool upgrade hermes-agent
    • pipx-managed install (sys.prefix under .../pipx/...) → pipx upgrade hermes-agent (matches scripts/auto-update.sh)
    • real venv → uv pip install --upgrade + VIRTUAL_ENV overlay (preserves fix(update): export launcher virtualenv to uv (#35031) #35224)
    • bare pip outside any venv → uv pip install --system --upgrade
    • These four branches are mutually exclusive; VIRTUAL_ENV is exported only for the uv-pip-in-venv path (uv tool/pipx upgrade ignore it).
  • tests/hermes_cli/test_uv_tool_update.py: uv-tool detection + recommendation + subprocess tests (from fix(cli): use uv tool upgrade when 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

Layout Command VIRTUAL_ENV
uv tool install uv tool upgrade hermes-agent
pipx install pipx upgrade hermes-agent
venv (launcher shim) uv pip install --upgrade hermes-agent exported
bare pip, no venv uv pip install --system --upgrade hermes-agent
no uv python -m pip install --upgrade hermes-agent

tests/hermes_cli/test_uv_tool_update.py + test_cmd_update.py: 43/43 pass. E2E verified against the real _cmd_update_pip with real imports for all five layouts above.

Credit

Consolidates #29700's hermes update cluster:

Fixes #29700.

Infographic

hermes-update-install-layout-aware

briandevans and others added 4 commits May 30, 2026 01:41
)

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

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-a486d27b vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9499 on HEAD, 9498 on base (🆕 +1)

🆕 New issues (1):

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.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels May 30, 2026
@teknium1 teknium1 merged commit 4d7ea3f into main May 30, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-a486d27b branch May 30, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes update fails when Hermes is installed via uv tool install

3 participants