It usually just threads emails with the same subject, but...
It sometimes doesn't thread emails with the same subject, but after someone else has replied to the first one. You have to put "Re:" in the second email, since the reply automatically added "Re:" and I guess that's too different for gmail to accept, yet...
If you try to separate your emails by environment, a completely keyword in the subject often isn't enough to stop the emails from threading.
Even if you filter and label your email by the subject lines, emails that get threaded together get all labels.
You can't even give gmail feedback like "This email does not belong in this thread". The only options are to accept their threading or turn off threading entirely.