Garrisoned turrets (units on walls) have the back-to-work button in the command panel, but it is currently broken: task a unit (range+infantry) to gather something then garrison it on a wall, when clicking on the back-to-work button, the unit will play the move animation but only its selection ring will move to the gathering point. In addition, the workOrders have been cleared so can't be recovered after proper ungarrisoning.
The patch insert an ungarrison order before the backtowork one.
It's possible that the patch also fixes the first infinite loop reported in #4523 as it seems connected