The infinite loop is a landmine left in the field.
Handling the negative -1 with a log error and an assert, would be better than an infinite loop.
Infinite loops can damage even other programs by hogging the cpu. They are far worse than an exception or an std::exit.
I think in the authors example, having sway fail to parse JSON would have been a better fallback than having the entire system lock up.
I don't want to be over dramatic but leaving that infinite loop in there is the type of mindset that leads to horrendous code bases decades from now.
Sway and Wayland was created to get away from the warts of X11. This infinite loop is bringing the new effort closer in line with its ugly older cousin.