I am an attorney for children (but not in CA). The custody story line has been pretty incredible all season. While I understand that this is a drama, I cannot imagine any scenario like the last courtroom scene where the boys would be present, whether to hear the proceedings, rulings or the random "closing statements" by ML and Celeste, especially at their ages. While they may have expressed their preferences in chambers to the judge (which we didn't see, but was hinted at during Celeste's discussions with them while getting ready and in a previous episode), they still would not be allowed in the courtroom for the exact reason demonstrated by this show: they would potentially hear bad things about the important people in their lives.