The length restriction in this regex is not about the whole hostname, but about the single dot-separated labels making up the hostname. (As in <label>[.<label>[.<label>[...]]][.]) These do have an upper limit of 63 chars according to http://tools.ietf.org/html/rfc2181#page-13 .
Even if hostnames longer than 255 characters are sometimes spotted in the wild, this is technically a broken configuration. I don't know if it's sensible to support that.

As a possible way to sidestep this whole issue, instead of validating the hostname with a regex, we might just try to resolve it once to see if that works. The downside to this would be, of course, that agents' hostnames will have to actually be resolvable, which might make deployment more complex for home users.
Yet another way would be to not have the agent submit a hostname in the first place and just do a reverse lookup on its IP address.

About the comma-setting issue:

I have found that the comma-on-next line style makes it easier to insert, remove, append or move around entries when you are working with lengthy lists (i.e. viewing the comma and space after it as logically belonging to the next item). However, if you prefer the comma-on-previous-line style, that's fine, too.