fix(update): detect profile dashboard processes in stale-dashboard sweep#56723
fix(update): detect profile dashboard processes in stale-dashboard sweep#56723liuhao1024 wants to merge 1 commit into
Conversation
The post-update stale-dashboard sweep in `_find_stale_dashboard_pids()` used substring matching (e.g. `"hermes dashboard"`) against the full process command line. When a non-default profile launches a dashboard with `--profile <name>` between the binary and the subcommand, the contiguous pattern never matched - the process was invisible to the sweep and continued running stale code after the update. Normalise the command line by stripping `--profile <name>` / `-p <name>` tokens (and collapsing resulting double-spaces) before pattern matching. Applied to both the POSIX (`ps`) and Windows (`wmic`) code paths. Fixes NousResearch#56717
|
Hi @liuhao1024, thanks for putting together #56723. I checked it against #56717 and the root cause you identified looks right: a profile selector between While testing that path, I found two nearby edge cases in the same stale-runtime class:
I opened #56745 as a draft follow-up built on top of your branch/commit rather than reimplementing the fix from scratch, so your original work is preserved. The extra changes are intentionally small: token-aware profile-selector stripping for dashboard/serve process scans on POSIX and Windows WMIC, a shared Validated locally with: Happy to adjust or close #56745 if maintainers would rather fold these follow-ups directly into this PR. |
|
Thanks for the thorough review and the follow-up, @xiawiie! Glad the root cause analysis held up. The two additional edge cases you found — equals-form profile selectors and the narrower systemd glob — are good catches. I see #56745 extends the fix with token-aware profile-selector stripping and a shared Happy to rebase or adjust this PR if maintainers prefer folding the follow-ups directly here, or if #56745 lands first I can close this one. |
What does this PR do?
Fixes the stale-dashboard sweep after
hermes updateso that dashboard processes launched with--profile <name>(non-default profiles) are correctly detected and killed.Root cause:
_find_stale_dashboard_pids()uses substring matching against the process command line (e.g."hermes dashboard"). When a non-default profile launches a dashboard with--profile <name>between the binary and the subcommand —hermes --profile bruce dashboard --isolated— the contiguous pattern never matches. The process is invisible to the sweep and continues running stale Python code after the update, causingImportErrorwhen new symbols (likeis_output_cap_error) are added.Fix: Strip
--profile <name>/-p <name>tokens from the command line (and collapse resulting double-spaces) before pattern matching. Applied to both the POSIX (ps) and Windows (wmic) code paths.Related Issue
Fixes #56717
Type of Change
Changes Made
hermes_cli/main.py: Normalise process command lines in_find_stale_dashboard_pids()by stripping--profile/-pflags before pattern matching (both POSIX and Windows code paths). +21/-2 lines.tests/hermes_cli/test_stale_dashboard_profile_detection.py: 3 regression tests covering--profile,-p, and default (no profile) cases.How to Test
python -m pytest tests/hermes_cli/test_stale_dashboard_profile_detection.py -v— all 3 tests should pass.python -m pytest tests/hermes_cli/test_update_stale_dashboard.py tests/hermes_cli/test_dashboard_lifecycle_flags.py -v— all 22+10 existing tests should pass (no regressions).hermes --profile test dashboard), then runhermes update— the profile dashboard should be detected and killed (previously it was invisible).Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A