Skip to content

bug(gateway): systemd service unit hardcodes venv/ path, breaks when virtualenv is .venv #2492

@joeynyc

Description

@joeynyc

Description

generate_systemd_unit() and get_python_path() in hermes_cli/gateway.py hardcode venv as the virtualenv directory name. When the virtualenv is created as .venv (which setup-hermes.sh and .gitignore both reference), the generated systemd unit has incorrect VIRTUAL_ENV and PATH environment variables pointing to a nonexistent venv/ directory.

Impact

  • ExecStart works correctly because get_python_path() falls back to sys.executable when venv/bin/python doesn't exist
  • But VIRTUAL_ENV and PATH in the unit file point to PROJECT_ROOT/venv/ which doesn't exist
  • This can cause subprocesses, tools, or pip invocations within the gateway to resolve incorrectly

Steps to Reproduce

  1. Install hermes-agent with .venv as the virtualenv directory name
  2. Run hermes gateway install
  3. Inspect the generated unit file at ~/.config/systemd/user/hermes-gateway.service
  4. Observe VIRTUAL_ENV and PATH reference venv/ instead of .venv/

Suggested Fix

In hermes_cli/gateway.py:

  • get_python_path() (lines 376-378): check for both .venv and venv
  • generate_systemd_unit() (lines 402-403): detect the actual virtualenv directory instead of hardcoding venv
  • Simplest approach: use sys.prefix to get the active virtualenv path at install time

Environment

  • OS: Ubuntu 22.04 on WSL2
  • Python: 3.11.13
  • Hermes Agent: v0.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions