Skip to content

feat: set kernel process title to 'hermes' in ps/top/htop - #35111

Closed
wenchengxucool wants to merge 3 commits into
NousResearch:mainfrom
wenchengxucool:feat/set-process-title
Closed

feat: set kernel process title to 'hermes' in ps/top/htop#35111
wenchengxucool wants to merge 3 commits into
NousResearch:mainfrom
wenchengxucool:feat/set-process-title

Conversation

@wenchengxucool

@wenchengxucool wenchengxucool commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

On Linux and macOS, hermes shows up as python3.11 (or whatever Python version) in process monitoring tools like ps, top, and htop. This is confusing — users naturally look for the app name, not the interpreter.

This PR sets the process title to hermes so the process is immediately recognizable.

Changes

  • hermes_cli/main.py: added _set_process_title() — tries three strategies in order:
    1. setproctitle.setproctitle("hermes") — cross-platform, works on Linux/macOS/BSD
    2. Fallback: prctl(PR_SET_NAME) via ctypes (Linux, stdlib)
    3. Fallback: pthread_setname_np via ctypes (macOS, stdlib — kernel thread name only)
      Called at the very top of main(), before any other initialization.
  • pyproject.toml: added setproctitle==1.3.7 as core dependency (pure C, very stable)
  • No-op on Windows (the .exe name is already hermes.exe).
  • No-op on any error/failure — purely cosmetic.

Example

Before:

$ ps aux | grep hermes
# nothing — it shows as python3.11

After:

$ ps aux | grep hermes
user  12345  hermes chat                      # clearly Hermes

Notes

Uses ctypes (stdlib, no new dependency) to call prctl on Linux and
pthread_setname_np on macOS so the process shows up as 'hermes' instead
of 'python3.xx' in ps, top, htop.  No-op on Windows (hermes.exe is
already the visible name).

Closes NousResearch#35108
Adds setproctitle as a core dependency (pure C, very stable) to change
the process title from 'python3.xx' to 'hermes' on Linux, macOS, and BSD.

Strategy:
  1. setproctitle.setproctitle('hermes') — works everywhere, no 15-char limit
  2. Fallback: ctypes prctl(PR_SET_NAME) on Linux (stdlib)
  3. Fallback: ctypes pthread_setname_np on macOS (stdlib, kernel thread name)

Closes NousResearch#35108
@wenchengxucool
wenchengxucool requested a review from a team May 30, 2026 03:23
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set process title so 'ps' shows 'hermes' instead of 'python3.xx'

2 participants