Skip to content

fix(update): detect launchd-style dashboard/serve cmdlines when scanning stale processes - #68968

Open
nelsonwang2026 wants to merge 1 commit into
NousResearch:mainfrom
nelsonwang2026:fix/dashboard-stale-scan
Open

fix(update): detect launchd-style dashboard/serve cmdlines when scanning stale processes#68968
nelsonwang2026 wants to merge 1 commit into
NousResearch:mainfrom
nelsonwang2026:fix/dashboard-stale-scan

Conversation

@nelsonwang2026

Copy link
Copy Markdown

Root cause

The stale-process scanner in _find_stale_dashboard_pids (hermes_cli/main.py) matched the dashboard/serve subcommand via a contiguous substring, e.g. "hermes_cli.main dashboard". Real launch cmdlines interpose flags between the module and the subcommand. On macOS the launchd dashboard agent spawns:

python -m hermes_cli.main --profile orchestrator dashboard --skip-build

The substring never matched, so hermes update left the old backend process running. The frontend kept reporting the previous version via /api/status (frontend/backend version mismatch) until the user manually ran launchctl kickstart -k.

Fix

Switch from contiguous-substring matching to token-based matching: require the standalone token dashboard or serve AND a Hermes process marker (hermes_cli / hermes). This still excludes unrelated cmdlines that merely contain the word "dashboard" (e.g. a chat session mentioning it). Applied to both the POSIX (ps) and Windows (wmic) scan paths.

Regression / verification

  • A harness asserts the real launchd cmdline python -m hermes_cli.main --profile orchestrator dashboard ... is now detected.
  • A noise cmdline containing "dashboard" as a chat token is rejected.
  • Both POSIX and Windows branches match.
  • py_compile passes; patch verified to apply cleanly on pristine main (git apply --check).

Scope

Single file hermes_cli/main.py (3 hunks, +30/-13). No behavior change for the normal hermes dashboard foreground path.


🤖 Generated with Hermes Agent

…ing stale processes

The stale-process scanner in _find_stale_dashboard_pids matched the
dashboard/serve subcommand via a contiguous substring
("hermes_cli.main dashboard"). Real launch cmdlines interpose flags
between the module and the subcommand, e.g. launchd spawns
'python -m hermes_cli.main --profile orchestrator dashboard ...'.
The substring never matched, so hermes update left the old backend
running and the dashboard kept reporting the previous version via
/api/status (frontend/backend mismatch).

Switch to token-based matching: require the standalone token
'dashboard' or 'serve' AND a Hermes process marker. This still
excludes unrelated cmdlines that merely contain the word 'dashboard'
(e.g. a chat session).

Regression: a harness asserts the launchd cmdline is now detected,
noise is rejected, and both POSIX (ps) and Windows (wmic) paths match.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor platform/windows Native Windows-specific behavior or breakage sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows needs-decision Awaiting maintainer decision before any implementation labels Jul 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related competing fixes: #44165, #56723, and #56745 address the same stale dashboard/serve scan when flags precede the subcommand. This patch uses broad token-plus-Hermes-marker matching; the others use positional parsing or selector stripping. Maintainer choice is needed.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for addressing a real stale-runtime gap: current main still uses contiguous dashboard/serve command patterns in hermes_cli/dashboard_procs.py:56-66,103,136, so selectors before the subcommand are missed.

Problems

  • Blocking: the proposed _is_hermes_web_server_cmd() at hermes_cli/main.py:6111-6117 only checks whether dashboard/serve occurs anywhere in a whitespace-split command line. It does not verify that token is the subcommand. A non-server Hermes process with a bare dashboard argument satisfies the marker and token checks, then reaches the kill path used by update cleanup (hermes_cli/update_cmd.py:486).
  • Current main moved the active scanner into hermes_cli/dashboard_procs.py in c64a4d7; this PR changes only the former main.py location and adds no test file.

Suggested changes

  • Port a positional, entrypoint-aware matcher to _scan_dashboard_processes and consume known global selectors before requiring dashboard or serve as the first positional command.
  • Add POSIX and WMIC coverage for the profile-prefixed launch form and for prompt/profile-value false positives.

Automated hermes-sweeper review.

Comment thread hermes_cli/main.py

def _is_hermes_web_server_cmd(command: str) -> bool:
toks = command.split()
if not any(tok in web_server_subcommands for tok in toks):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This accepts dashboard or serve anywhere in argv, including a non-server Hermes prompt/argument. Because lines 6113-6117 only establish that it is a Hermes process, the update cleanup can kill that unrelated process. Parse from the Hermes entrypoint and require the first positional subcommand after recognized global flags instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants