Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions hermes_cli/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,22 @@ def _remap_path_for_user(path: str, target_home_dir: str) -> str:

/root/.hermes/hermes-agent -> /home/alice/.hermes/hermes-agent
/opt/hermes -> /opt/hermes (kept as-is)

Note: this function intentionally does NOT resolve symlinks. A venv's
``bin/python`` is typically a symlink to the base interpreter (e.g. a
uv-managed CPython at ``~/.local/share/uv/python/.../python3.11``);
resolving that symlink swaps the unit's ``ExecStart`` to a bare Python
that has none of the venv's site-packages, so the service crashes on
the first ``import``. Keep the symlinked path so the venv activates
its own environment. Lexical expansion only via ``expanduser``.
"""
current_home = Path.home().resolve()
resolved = Path(path).resolve()
current_home = Path.home()
p = Path(path).expanduser()
try:
relative = resolved.relative_to(current_home)
relative = p.relative_to(current_home)
return str(Path(target_home_dir) / relative)
except ValueError:
return str(resolved)
return str(p)


def _hermes_home_for_target_user(target_home_dir: str) -> str:
Expand Down
Loading