How are brackets decided (bug?)

Like I posted in another topic, IMHO this is the main issue (but that’s just my opinion!!)