Skip to content

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

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-baa570d1
May 30, 2026
Merged

feat: set process title to 'hermes' in ps/top/htop#35143
teknium1 merged 2 commits into
mainfrom
hermes/hermes-baa570d1

Conversation

@teknium1

@teknium1 teknium1 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

hermes now shows up as hermes in ps/top/htop/pgrep/docker top instead of python3.xx.

Salvage of #35111 by @wenchengxucool, with the mandatory setproctitle dependency dropped so this stays zero-new-deps.

Changes

  • hermes_cli/main.py: new _set_process_title(), called first thing in main().
    • Tries setproctitle (optional, best-effort via ImportError guard) — when present, rewrites the full command line so even the ps aux args column reads hermes.
    • Falls back to ctypes prctl(PR_SET_NAME) on Linux / pthread_setname_np on macOS — sets the kernel comm field (htop/top/ps -o comm/pgrep -x hermes/pkill hermes).
    • No-op on Windows and on any failure.
  • scripts/release.py: AUTHOR_MAP entry for the contributor's commit email.

No dependency added — the original PR made setproctitle a hard core dep; we keep it strictly optional.

Validation

Both paths exercised live on Linux against the worktree source:

setproctitle /proc/self/comm ps -o args
present hermes hermes
absent (ctypes fallback) hermes unchanged (kernel comm only)

Credit

Implementation by @wenchengxucool (#35111). The function design — try setproctitle, fall back to ctypes — is theirs; we only removed the dependency add so it degrades gracefully when setproctitle isn't installed.

Infographic

process-title

wenchengxucool and others added 2 commits May 29, 2026 21:27
Adds _set_process_title() in hermes_cli/main.py, called first thing in
main(). Tries setproctitle (optional) for a full ps-args rewrite, then
falls back to ctypes prctl(PR_SET_NAME) on Linux / pthread_setname_np on
macOS. No-op on Windows and on any failure. No new dependency: the
setproctitle path is best-effort via ImportError guard.

Fixes #35108
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-baa570d1 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9474 on HEAD, 9473 on base (🆕 +1)

🆕 New issues (1):

Rule Count
unresolved-import 1
First entries
hermes_cli/main.py:84: [unresolved-import] unresolved-import: Cannot resolve imported module `setproctitle`

✅ Fixed issues: none

Unchanged: 4920 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@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
@alt-glitch

Copy link
Copy Markdown
Collaborator

Salvage/supersedes #35111 (same feature, drops the hard setproctitle dependency). Closes #35108.

@teknium1
teknium1 merged commit e5765e6 into main May 30, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-baa570d1 branch May 30, 2026 07:30

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Overview

Clean implementation of process title setting with zero new dependencies. 45 additions across 2 files. Fallback strategy from setproctitle -> ctypes prctl on Linux -> pthread_setname_np on macOS -> no-op on Windows.

What's Right

  • Zero new deps: setproctitle is optional (ImportError guard), falls back to ctypes
  • Platform-aware: Linux prctl(PR_SET_NAME), Darwin pthread_setname_np, Windows no-op
  • Non-fatal: wrapped in try/except at every level
  • Proper placement: called first thing in main() before any I/O
  • Comment block explains the strategy clearly
  • AUTHOR_MAP update credits the original contributor

Safety Assessment

  • No security concerns (cosmetic only)
  • ctypes calls are well-documented with PR_SET_NAME = 15
  • Thread name is limited to 16 bytes including null terminator ("hermes" is 6 bytes)
  • No performance impact (runs once at startup)

Reviewed by Hermes Agent (cron)

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.

4 participants