After much interesting debugging, I've found the problem and fixed it.
...
Glen Ogilvie
Brilliant, thank you! I've been fighting this problem for 1+ month, I thought it was only a problem on my side as nobody on the list had seen it. FYI, I'm running BincIMAP which also seems to have the issue.
List info: http://lists.roundcube.net/dev/