diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index 05dc69e23823..552f457cd3a4 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -6147,16 +6147,6 @@ def _gateway_command_inner(args): sys.exit(1) elif subcmd == "stop": - # Defense: refuse self-targeting gateway stop from inside the gateway. - # Prevents agent-initiated kill loops when combined with supervisor KeepAlive. - if os.getenv("_HERMES_GATEWAY") == "1": - print_error( - "Refusing to stop the gateway from inside the gateway process.\n" - "This command was blocked to prevent restart loops.\n" - "Use `hermes gateway stop` from a shell outside the running gateway." - ) - sys.exit(1) - stop_all = getattr(args, "all", False) system = getattr(args, "system", False) @@ -6240,16 +6230,6 @@ def _gateway_command_inner(args): print(f"✓ Stopped {get_service_name()} service") elif subcmd == "restart": - # Defense: refuse self-targeting gateway restart from inside the gateway. - # Prevents agent-initiated kill loops when combined with supervisor KeepAlive. - if os.getenv("_HERMES_GATEWAY") == "1": - print_error( - "Refusing to restart the gateway from inside the gateway process.\n" - "This command was blocked to prevent restart loops.\n" - "Use `hermes gateway restart` from a shell outside the running gateway." - ) - sys.exit(1) - # Try service first, fall back to killing and restarting service_available = False system = getattr(args, "system", False)