fix(gateway): block uninstall from gateway child - #20489
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for identifying the launchd child-process hazard. The restart and stop portions have since been covered on current main: hermes_cli/gateway.py:6778 and :6871 reject gateway-child stop/restart, while tools/terminal_tool.py:2257 blocks matching lifecycle commands before execution.
Problems
- The
launchd_stop()guard and its dispatch tests duplicate those current command-level protections, so they need rework rather than a direct cherry-pick. - A narrower gap remains:
hermes_cli/gateway.py:6681dispatches uninstall tolaunchd_uninstall(), whoselaunchctl bootoutat:4165is not guarded. The current terminal lifecycle pattern incron/lifecycle_guard.py:54covers onlyrestart|stop.
Suggested changes
- Re-scope the salvage to protect
gateway uninstallfrom a gateway child, using the existing marker guard or the proposed ancestry check, and add a regression for that current path. - Update stop/restart tests to assert the existing command-level behavior.
Automated hermes-sweeper review.
16a8087 to
ba90d22
Compare
ba90d22 to
e5a6099
Compare
e5a6099 to
beddbb8
Compare
|
Merged via PR #93336 (c94ee2e) — your uninstall guard was cherry-picked with your authorship preserved in git log, adapted to the PID-ownership gate that replaced the raw env check (#92560), so CLI sessions spawned under the gateway tree can still uninstall while the gateway itself cannot self-target. The |
Summary
hermes gateway uninstallwhen_HERMES_GATEWAY=1hermes gateway uninstalland directlaunchctl bootout ... hermes.gatewaycommandslaunchd_stop()Tests
scripts/run_tests.sh tests/hermes_cli/test_gateway_restart_loop.py -q(70 passed)ruff check hermes_cli/gateway.py cron/lifecycle_guard.py tests/hermes_cli/test_gateway_restart_loop.pyRebased onto current
main(e589b73).