Testing for overset text is clear-cut, but it is difficult to work out whether a box is full.
Suppose the only allowed expansion is to the inter-character and inter-word spacing; and that using 20% of the limits gains one line and that using 80% of the limits gains another line causing an overset. The current algorithm will choose to use 79% of the allowed expansion. It can see that 80% is too much, but will assume that the box is filled more neatly by using 79% of the limits than at any lower percentage. In this case a human would have chosen 20% of the allowed expansion, knowing that the 20-79% range merely damages text without filling the box any further.