fix(cli): hermes-agent --help/--version print help instead of running a model turn (#54648, salvage #54649) - #120440
Merged
Merged
Conversation
Follow-up to the salvaged wrapper: the argument layer now lives in a topical sibling (agent/legacy_cli.py) instead of growing the run_agent facade, and `python run_agent.py` (the installer's PATH launcher for hermes-agent) routes through the same parser instead of fire, so `--version` and a bare invocation no longer run the demo turn there either. - --help/-h/--version use argparse's own exit path; options carry help text - the runner is injected (`run=`) so `python run_agent.py` does not import run_agent a second time - tests trimmed to two invariants that resolve the console-script target from pyproject exactly like pip's wrapper (red on main, green here) - docs: hermes-agent section in the CLI reference
૮ >ﻌ< ა ci reviewran on 11fdefd — fix(cli): move the hermes-agent argv layer into agent/legacy
|
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-agent --help,-h,--versionand a barehermes-agentnow print help/version and exit instead of running a real model turn, andhermes-agent --query …actually runs the query you passed (#54648, salvage of #54649).Changes
hermes-agentconsole script →agent.legacy_cli:main, an argparse layer over the unchangedrun_agent.main()(salvaged from @ooiuuii's fix(cli): guard legacy hermes-agent entrypoint #54649, authorship kept).python run_agent.pyroutes through the same parser instead offire. That is also what the installer's PATH launcher~/.local/bin/hermes-agentruns, so the launcher is fixed too.agent/legacy_cli.py) and does not grow therun_agent.pyfacade. The runner is injected (run=), sopython run_agent.pydoes not import itself twice.hermes-agentsection to the CLI commands reference.Validation
Live repro: before: on origin/main, the real pip-style
hermes-agentwrapper plus the installer launcher were run against a loopback fake provider.--help,-h,--versionand no args each made 1 model call with the hard-coded "Python 3.13" demo query.--query "say hi"also sent the demo query. The launcher's--versionran a turn and then exited 2. After: the same probe gives 0 model calls for every metadata/bare case, all rc=0, and they printusage: hermes-agent …/Hermes Agent v0.21.4 (2026.9.21).--query "say hi"makes 1 call carryingsay hi.hermes-agent --help/-hhermes-agent --versionhermes-agent(no args)--versionhermes-agent --query "say hi"say hiTests: 2 invariants in
tests/agent/test_legacy_cli.py. Each resolves thehermes-agenttarget from pyproject[project.scripts]and calls it the way pip's wrapper does (no args, argv insys.argv). On origin/main all 5 cases (4 parametrized + 1) fail. With the fix they pass.tests/agent/+tests/scripts/install/were run viascripts/run_tests.sh. ruff, the tmp-literal check, the windows-footgun check, compat pointers andgit diff --checkare all clean.Root cause: a console script calls its target with no arguments, and
hermes-agentpointed straight atrun_agent.main, whosequery=Nonedefault is a built-in demo prompt.fireonly parsed argv under__main__, so no flag was ever read.Notes
hermes-agent-helpintests/e2e/core/upgrade/test_fresh_process_entrypoints.py). Whichever of the two PRs lands second must drop that_XFAILentry, or the strict xfail will XPASS-fail.--no-venvlauncher branch writesexec hermes run_agent.py "$@". That prints "'run_agent.py' is not ahermescommand" for every invocation. It never starts a turn, so it is a different defect, left for a follow-up.--version/--helpintercept insiderun_agent.main(); superseded).Fixes #54648
Infographic