If somewhere was dobre chłopcy it was incorrect.
Chłopcy is a plural for of chłopiec, masculine personal, so only possible adjective forms are also pl.masc-pers.: dobrzy chłopcy, młodzi chłopcy, starzy chłopcy, głupi chłopcy.
On the other hand, there is a word chłopak, masculine but not personal, its plural is chłopaki, and it takes not-masc-personal adjectives: dobre chłopaki, młode chłopaki, stare chłopaki, głupie chłopaki…
It doesn't depend only on whether they're masculine, they have to be masculine personal - i.e. include at least one male person.
"Policjant" is masculine and "policjanci" are masculine personal, ergo: dobrzy policjanci
"Dom" is masculine but "domy" are not masculine-personal, ergo: dobre domy
but why "chłopaki" (all of them are masculine persons, aren't they?) are suddenly "dobre" as it written before?
Same here. It's because we're not accustomed to the 'y' sound. Also, I tend to imagine any unfamiliar vowel as a variant of Serbian a, e, i, o, or u vowel (because I grew up hearing only them). However, after only 2 days of learning Polish, I started differentiating 'y' sound from very short 'e' sound.