mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-30 06:41:51 +00:00
## What broke After `hermes gateway install --system`, the systemd service ExecStart uses the uv-managed Python path instead of the venv Python path. This causes immediate crash with `ModuleNotFoundError: No module named 'yaml'` because the uv Python has no packages installed. ExecStart=/root/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/bin/python3.11 Should be: ExecStart=/root/.hermes/hermes-agent/venv/bin/python3.11 ## Root cause `get_python_path()` in hermes_cli/gateway.py fell back to `sys.executable` when `_detect_venv_dir()` returned None. In uv-managed environments, `sys.executable` returns the uv Python path which has no packages. Meanwhile, `generate_systemd_unit()` already uses `PROJECT_ROOT/venv` as fallback for `venv_dir` (line 819), creating an inconsistency: - `venv_dir` = PROJECT_ROOT/venv (correct) - `python_path` = sys.executable (wrong - uv path) ## Why this fix is minimal Added 11 lines to `get_python_path()` to add a middle fallback tier: 1. detected_venv/bin/python (existing - highest priority) 2. PROJECT_ROOT/venv/bin/python (NEW - matches generate_systemd_unit) 3. sys.executable (existing - final fallback) This makes `get_python_path()` consistent with `venv_dir` calculation in `generate_systemd_unit()`. No behavior change when venv is detected. ## What I tested Added test suite tests/hermes_cli/test_gateway_python_path.py with 8 tests: - test_fallback_to_project_root_venv_when_detect_fails - test_detect_venv_dir_returns_valid_venv - test_fallback_chain_order - test_consistency_with_venv_dir_in_systemd_unit - test_windows_fallback_uses_scripts_python_exe - test_execstart_not_uv_python_path - test_system_unit_execstart_uses_venv_python - test_user_unit_execstart_uses_venv_python All verify ExecStart uses venv/bin/python, not uv Python path. ## What I intentionally did not change - No changes to _detect_venv_dir() logic - No changes to generate_systemd_unit() venv_dir calculation - No opportunistic refactoring - No changes to launchd plist generation (similar pattern) Fixes #9201 |
||
|---|---|---|
| .. | ||
| acp | ||
| agent | ||
| cli | ||
| cron | ||
| e2e | ||
| environments/benchmarks | ||
| fakes | ||
| gateway | ||
| hermes_cli | ||
| honcho_plugin | ||
| integration | ||
| plugins | ||
| run_agent | ||
| skills | ||
| tools | ||
| __init__.py | ||
| conftest.py | ||
| run_interrupt_test.py | ||
| test_batch_runner_checkpoint.py | ||
| test_cli_file_drop.py | ||
| test_cli_skin_integration.py | ||
| test_ctx_halving_fix.py | ||
| test_empty_model_fallback.py | ||
| test_evidence_store.py | ||
| test_hermes_constants.py | ||
| test_hermes_logging.py | ||
| test_hermes_state.py | ||
| test_honcho_client_config.py | ||
| test_ipv4_preference.py | ||
| test_mcp_serve.py | ||
| test_minisweagent_path.py | ||
| test_model_picker_scroll.py | ||
| test_model_tools.py | ||
| test_model_tools_async_bridge.py | ||
| test_ollama_num_ctx.py | ||
| test_packaging_metadata.py | ||
| test_project_metadata.py | ||
| test_retry_utils.py | ||
| test_sql_injection.py | ||
| test_subprocess_home_isolation.py | ||
| test_timezone.py | ||
| test_toolset_distributions.py | ||
| test_toolsets.py | ||
| test_trajectory_compressor.py | ||
| test_trajectory_compressor_async.py | ||
| test_utils_truthy_values.py | ||