Skip to content

fix(cli): warn about stale dashboard processes after hermes update#16895

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-ae277474
Apr 28, 2026
Merged

fix(cli): warn about stale dashboard processes after hermes update#16895
teknium1 merged 2 commits into
mainfrom
hermes/hermes-ae277474

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages #16881 (@Societus) with a follow-up tightening commit.

What this PR does

After hermes update finishes (both git and zip paths), scans the process table for running hermes dashboard processes and prints a warning with PIDs + restart instructions.

Why

v0.11.0 added X-Hermes-Session-Token. A dashboard process started before the update keeps the old Python backend in memory while the JS bundle on disk gets replaced — the new frontend sends headers the stale backend doesn't recognize, so every API call returns 401 with no visible error (HTML loads, all data empty). Fixes #16872.

The dashboard has no service manager (unlike the gateway, which systemd/launchd auto-restart), so we can only warn — not auto-kill.

Changes

  • hermes_cli/main.py: new _warn_stale_dashboard_processes() called from _cmd_update_impl (git path) and _update_via_zip (zip path). Cross-platform: ps on Linux/macOS, wmic on Windows. Excludes self-PID. Swallows FileNotFoundError/TimeoutExpired/OSError.
  • tests/hermes_cli/test_update_stale_dashboard.py: 10 unit tests — warning fires/doesn't, multi-PID, self excluded, missing binary, timeout, malformed lines, grep-line filter, and a regression guard for the previously greedy pattern.

Follow-up tightening (commit 63b71c5)

The original Linux branch used pgrep -f "hermes.*dashboard" — a greedy regex that matches any cmdline containing both words (e.g. a chat session discussing "dashboard" or an unrelated grafana/dashboard-server). Replaced with ps -A -o pid=,command= + the explicit patterns list already used on the Windows branch and in hermes_cli.gateway._scan_gateway_pids:

  • hermes dashboard
  • hermes_cli.main dashboard
  • hermes_cli/main.py dashboard

Validation

  • 10/10 unit tests pass
  • E2E: spawned fake python3 -m hermes_cli.main dashboard --port 9119 via exec -a, confirmed detection. Also detected a real pre-existing dashboard on the same machine.

Closes #16881.
Fixes #16872.

Societus and others added 2 commits April 28, 2026 01:12
The dashboard is a long-lived server process users start and forget.
When hermes update replaces files on disk, the running process holds
the old Python backend in memory while the JS bundle gets updated,
producing a silent frontend/backend mismatch (e.g. v0.11.0 changed
the session token header -- old backends reject every API call).

Scan for running dashboard processes after a successful update (both
git and ZIP paths) and print a warning with their PIDs and restart
instructions. Mirrors the existing pattern for gateway processes.

Fixes #16872
Replace the Linux/macOS pgrep regex ("hermes.*dashboard") with a ps
scan + the same explicit patterns list already used on the Windows
branch and in hermes_cli.gateway._scan_gateway_pids:

    hermes dashboard
    hermes_cli.main dashboard
    hermes_cli/main.py dashboard

The old greedy regex would match any cmdline containing both words —
e.g. a chat session whose argv mentions "dashboard" or an unrelated
grafana/dashboard-server process. Added regression tests for both.

Follow-up tightening on #16881.
@teknium1 teknium1 merged commit 9048fd0 into main Apr 28, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-ae277474 branch April 28, 2026 08:14
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 28, 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.

hermes update doesn't warn about stale dashboard processes (frontend/backend version mismatch)

3 participants