Fix script error in `infer_roles` helper