Conversation
Collaborator
|
Thanks for the focused fix. The premise is verified on current main: The PR's separate Automated hermes-sweeper review. |
This branch has not been deployed
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.
What does this PR do?
Fixes the legacy
hermes-agentconsole script so metadata/probe invocations are side-effect free.Today
pyproject.tomlmapshermes-agentdirectly torun_agent:main. A generated console script calls that function with no parsed CLI args, sohermes-agent --version,hermes-agent --help, and even barehermes-agentcan fall into the default Python 3.13 demo prompt and start a live agent/provider request.This PR adds a small argparse wrapper for the legacy entry point and points the packaged script at it. The wrapper handles
--version,--help, and no-argument invocations without callingmain(), while preserving explicit runs through--query, positional prompt text, and the existing model/toolset flags.Related note: #13712 also touches adjacent legacy version handling, but it is a broad 5k+ line integration PR. This PR keeps the fix narrow and reviewable.
Related Issue
Fixes #54648
Type of Change
Changes Made
run_agent.py: addlegacy_cli_main()and a legacy argparse parser forhermes-agent.pyproject.toml: pointhermes-agentatrun_agent:legacy_cli_main.tests/run_agent/test_legacy_cli_entrypoint.py: cover--version,--help, no args, explicit query dispatch, and packaged script target.tests/hermes_cli/test_verify_console_scripts.py: update the fake pyproject fixture to match the real script target.How to Test
Reproduced on Windows with the installed
hermes-agent.exe --version, which started the default Python 3.13 demo agent path and attempted a provider request before failing.Validated the fix with:
uv run --extra dev python -m pytest tests\run_agent\test_legacy_cli_entrypoint.py -q5 passeduv run --extra dev python -m pytest tests\hermes_cli\test_verify_console_scripts.py -q6 passeduv run --extra dev python -m pytest tests\test_hermes_bootstrap.py::TestEntryPointsImportBootstrap::test_entry_point_imports_bootstrap -q6 passeduv run --extra dev python -m ruff check run_agent.py tests\run_agent\test_legacy_cli_entrypoint.py tests\hermes_cli\test_verify_console_scripts.py# noqadirective inrun_agent.pypython -m py_compile run_agent.py.venv\Scripts\hermes-agent.exe --version.venv\Scripts\hermes-agent.exe --help.venv\Scripts\hermes-agent.exeI first tried the canonical
bash scripts/run_tests.sh tests/run_agent/test_legacy_cli_entrypoint.py -q, but this Windows worktree had no.venv/venvand the script's POSIX$HOME/.hermes/hermes-agent/venvfallback did not match the local Windows install location.Checklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) - N/Acli-config.yaml.exampleif I added/changed config keys - N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - N/AScreenshots / Logs
No raw failing provider output is included because the failing path can print credential-bearing request metadata. The regression tests and console-script smoke cover the side-effect-free behavior directly.