fix(cli): use 'uv tool upgrade' when hermes was installed via 'uv tool install' (#29700)#29707
Closed
Bartok9 wants to merge 1 commit into
Closed
fix(cli): use 'uv tool upgrade' when hermes was installed via 'uv tool install' (#29700)#29707Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing to stay within contributor PR limit. Will resubmit with fresh rebase if the issue remains open in main. |
…l install' (NousResearch#29700) hermes update calls _cmd_update_pip() when no .git directory is found (standard PyPI/install-script installs). It detects uv via shutil.which and then always runs: uv pip install --upgrade hermes-agent This fails with: error: No virtual environment found; run `uv venv` to create an environment, or pass --system to install into a non-virtual environment because `uv pip install` requires an active venv, but the standard install script uses `uv tool install hermes-agent` which creates its own isolated tool environment (not a user-activatable venv). Fix: before choosing the uv command, run `uv tool list` (with a 15 s timeout) to detect whether hermes-agent is a tool-install. hermes-agent in tool list -> uv tool upgrade hermes-agent not in tool list -> uv pip install --upgrade hermes-agent uv tool list fails/times out -> fall back to uv pip (prior behaviour) uv not found -> sys.executable -m pip (prior behaviour) The probe adds ~50 ms on the fast path (uv tool list is a local command with no network I/O). Adds 5 new tests covering: - uv tool install path -> uv tool upgrade - regular venv path -> uv pip install - uv tool list rc!=0 fallback - TimeoutExpired fallback - no uv at all -> pip module Fixes NousResearch#29700
fa65fe2 to
d74636e
Compare
1 task
Contributor
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
Fixes
hermes updateon systems where Hermes was installed viauv tool install hermes-agent(the standard install script).Root cause
_cmd_update_pip()always usesuv pip install --upgrade hermes-agentwhenuvis found. Butuv pip installrequires an active virtual environment, anduv tool installinstalls into an isolated tool environment — no activatable venv exists. The result:Fix
Before choosing the update command, probe
uv tool listto detect the install method:Fallback chain preserved: if
uv tool listfails or times out (15 s), the prioruv pip installpath is used. Ifuvisn't on PATH at all,sys.executable -m pipis used (unchanged).The probe adds ~50 ms on the fast path (
uv tool listhas no network I/O).Tests
New file
tests/hermes_cli/test_cmd_update_pip_uv_tool.py— 5 cases:test_uv_tool_install_uses_uv_tool_upgradeuv tool upgradetest_no_uv_tool_install_uses_uv_pipuv pip installtest_tool_list_failure_falls_back_to_uv_pipuv pip installtest_tool_list_timeout_falls_back_to_uv_pipuv pip installtest_no_uv_falls_back_to_pip_modulesys.executable -m pipFixes #29700