fix(cli): warn about stale dashboard processes after hermes update#16895
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #16881 (@Societus) with a follow-up tightening commit.
What this PR does
After
hermes updatefinishes (both git and zip paths), scans the process table for runninghermes dashboardprocesses 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:pson Linux/macOS,wmicon Windows. Excludes self-PID. SwallowsFileNotFoundError/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 unrelatedgrafana/dashboard-server). Replaced withps -A -o pid=,command=+ the explicit patterns list already used on the Windows branch and inhermes_cli.gateway._scan_gateway_pids:hermes dashboardhermes_cli.main dashboardhermes_cli/main.py dashboardValidation
python3 -m hermes_cli.main dashboard --port 9119viaexec -a, confirmed detection. Also detected a real pre-existing dashboard on the same machine.Closes #16881.
Fixes #16872.