bugbug 0.0.650__tar.gz → 0.0.652__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. {bugbug-0.0.650 → bugbug-0.0.652}/PKG-INFO +1 -1
  2. bugbug-0.0.652/VERSION +1 -0
  3. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/bug_features.py +7 -3
  4. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/qaneeded.py +6 -0
  5. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/stepstoreproduce.py +3 -1
  6. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/testconfigselect.py +10 -2
  7. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/testselect.py +13 -6
  8. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/agent.py +5 -1
  9. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/data_types.py +13 -1
  10. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/prompts.py +8 -4
  11. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/scorer.py +58 -0
  12. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/utils.py +2 -0
  13. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/data_types.py +23 -0
  14. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/regressor_finder.py +38 -9
  15. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/shadow_scheduler_stats.py +257 -64
  16. bugbug-0.0.650/VERSION +0 -1
  17. {bugbug-0.0.650 → bugbug-0.0.652}/.gitignore +0 -0
  18. {bugbug-0.0.650 → bugbug-0.0.652}/LICENSE +0 -0
  19. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/__init__.py +0 -0
  20. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/bug_snapshot.py +0 -0
  21. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/bugzilla.py +0 -0
  22. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/build_platforms.py +0 -0
  23. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/__init__.py +0 -0
  24. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/function_search.py +0 -0
  25. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/mozilla.py +0 -0
  26. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/parser.py +0 -0
  27. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/searchfox_api.py +0 -0
  28. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/searchfox_data.py +0 -0
  29. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/code_search/searchfox_download.py +0 -0
  30. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/commit_features.py +0 -0
  31. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/db.py +0 -0
  32. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/feature_cleanup.py +0 -0
  33. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/github.py +0 -0
  34. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/issue_features.py +0 -0
  35. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/issue_snapshot.py +0 -0
  36. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/annotateignore.csv +0 -0
  37. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/bug_nobug.csv +0 -0
  38. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task.csv +0 -0
  39. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_e.csv +0 -0
  40. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_h.csv +0 -0
  41. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_p.csv +0 -0
  42. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/defect_enhancement_task_s.csv +0 -0
  43. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/regression_bug_nobug.csv +0 -0
  44. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/regressionrange.csv +0 -0
  45. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/str.csv +0 -0
  46. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels/tracking.csv +0 -0
  47. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/labels.py +0 -0
  48. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/model.py +0 -0
  49. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/model_calibration.py +0 -0
  50. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/__init__.py +0 -0
  51. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/accessibility.py +0 -0
  52. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/annotate_ignore.py +0 -0
  53. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/assignee.py +0 -0
  54. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/backout.py +0 -0
  55. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/browsername.py +0 -0
  56. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/bugtype.py +0 -0
  57. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/component.py +0 -0
  58. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/component_specific.py +0 -0
  59. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/defect.py +0 -0
  60. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/defect_enhancement_task.py +0 -0
  61. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/devdocneeded.py +0 -0
  62. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/fenixcomponent.py +0 -0
  63. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/fixtime.py +0 -0
  64. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/invalid_compatibility_report.py +0 -0
  65. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/needsdiagnosis.py +0 -0
  66. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/perf_regression_predictor.py +0 -0
  67. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/performancebug.py +0 -0
  68. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/rcatype.py +0 -0
  69. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/regression.py +0 -0
  70. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/regressionrange.py +0 -0
  71. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/regressor.py +0 -0
  72. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/severity.py +0 -0
  73. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/spambug.py +0 -0
  74. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/testconfigdimensions.py +0 -0
  75. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/testfailure.py +0 -0
  76. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/tracking.py +0 -0
  77. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/uplift.py +0 -0
  78. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/models/worksforme.py +0 -0
  79. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/nlp.py +0 -0
  80. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/__init__.py +0 -0
  81. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/commit_risk.py +0 -0
  82. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/datasets.py +0 -0
  83. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/extraction.py +0 -0
  84. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/label_policy.py +0 -0
  85. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/push_status.py +0 -0
  86. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/regression_commits.py +0 -0
  87. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/regression_labeling.py +0 -0
  88. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/selection_pairs.py +0 -0
  89. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/sql/__init__.py +0 -0
  90. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/sql/perf_alerts.sql +0 -0
  91. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/sql/perf_pushes.sql +0 -0
  92. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/sql/perf_task_costs.sql +0 -0
  93. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/task_costs.py +0 -0
  94. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/perf/task_labels.py +0 -0
  95. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/phabricator.py +0 -0
  96. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/redash.py +0 -0
  97. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/repository.py +0 -0
  98. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/rust_code_analysis_server.py +0 -0
  99. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/swarm.py +0 -0
  100. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/test_scheduling.py +0 -0
  101. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/test_scheduling_features.py +0 -0
  102. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/__init__.py +0 -0
  103. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/base.py +0 -0
  104. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/__init__.py +0 -0
  105. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/database.py +0 -0
  106. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/langchain_tools.py +0 -0
  107. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/protocols.py +0 -0
  108. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/review_context.py +0 -0
  109. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/code_review/review_context_schema.py +0 -0
  110. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/comment_matching/agent.py +0 -0
  111. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/comment_matching/prompts.py +0 -0
  112. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/comment_resolution/__init__.py +0 -0
  113. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/comment_resolution/agent.py +0 -0
  114. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/__init__.py +0 -0
  115. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/connection.py +0 -0
  116. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/exceptions.py +0 -0
  117. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/llms.py +0 -0
  118. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/platforms/__init__.py +0 -0
  119. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/platforms/base.py +0 -0
  120. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/platforms/bugzilla.py +0 -0
  121. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/platforms/patch_apply.py +0 -0
  122. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/platforms/phabricator.py +0 -0
  123. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/text.py +0 -0
  124. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/core/validators.py +0 -0
  125. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/patch_summarization/__init__.py +0 -0
  126. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/patch_summarization/agent.py +0 -0
  127. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/patch_summarization/prompts.py +0 -0
  128. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/__init__.py +0 -0
  129. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/agent.py +0 -0
  130. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/tools/suggestion_filtering/prompts.py +0 -0
  131. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/utils.py +0 -0
  132. {bugbug-0.0.650 → bugbug-0.0.652}/bugbug/vectordb.py +0 -0
  133. {bugbug-0.0.650 → bugbug-0.0.652}/pyproject.toml +0 -0
  134. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/__init__.py +0 -0
  135. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/analyze_training_metrics.py +0 -0
  136. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/backout_related_test_regressions.py +0 -0
  137. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/bug_classifier.py +0 -0
  138. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/bug_retriever.py +0 -0
  139. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/check.py +0 -0
  140. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/check_all_metrics.py +0 -0
  141. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/ci_failures_matching.py +0 -0
  142. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/comment_classifier.py +0 -0
  143. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/comment_level_labeler.py +0 -0
  144. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/comment_resolver_runner.py +0 -0
  145. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/commit_classifier.py +0 -0
  146. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/commit_retriever.py +0 -0
  147. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/compatibility_report_classifier.py +0 -0
  148. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/gcp_logs_retriever.py +0 -0
  149. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/generate_landings_risk_report.py +0 -0
  150. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/generate_sheet.py +0 -0
  151. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/get_type_labels.py +0 -0
  152. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/get_untriaged.py +0 -0
  153. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/github_issue_classifier.py +0 -0
  154. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/github_issue_retriever.py +0 -0
  155. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/inline_comments_data_collection.py +0 -0
  156. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/integration_test.sh +0 -0
  157. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/maintenance_effectiveness_indicator.py +0 -0
  158. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/microannotate_generator.py +0 -0
  159. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/past_bugs_by_unit.py +0 -0
  160. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/perf_alerts_retriever.py +0 -0
  161. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/perf_regression_predictor.py +0 -0
  162. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/redundant_failures.py +0 -0
  163. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/retrieve_ci_failures.py +0 -0
  164. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/retrieve_training_metrics.py +0 -0
  165. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/retrieve_try_pushes.py +0 -0
  166. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/review_comments_retriever.py +0 -0
  167. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/revision_retriever.py +0 -0
  168. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/test_scheduling_history_retriever.py +0 -0
  169. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/testing_policy_stats.py +0 -0
  170. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/trainer.py +0 -0
  171. {bugbug-0.0.650 → bugbug-0.0.652}/scripts/trainer_extract_args.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bugbug
3
- Version: 0.0.650
3
+ Version: 0.0.652
4
4
  Summary: ML tools for Mozilla projects
5
5
  Author-email: Marco Castelluccio <mcastelluccio@mozilla.com>
6
6
  License-Expression: MPL-2.0
bugbug-0.0.652/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.652
@@ -203,7 +203,9 @@ class DeltaRequestMerge(SingleBugFeature):
203
203
  def __call__(self, bug, **kwargs):
204
204
  for history in bug["history"]:
205
205
  for change in history["changes"]:
206
- if change["added"].startswith("approval-mozilla"):
206
+ if change["field_name"] == "flagtypes.name" and change[
207
+ "added"
208
+ ].startswith("approval-mozilla"):
207
209
  uplift_request_datetime = datetime.strptime(
208
210
  history["when"], "%Y-%m-%dT%H:%M:%SZ"
209
211
  ).replace(tzinfo=timezone.utc)
@@ -223,7 +225,8 @@ class DeltaNightlyRequestMerge(SingleBugFeature):
223
225
  for history in bug["history"]:
224
226
  for change in history["changes"]:
225
227
  if not (
226
- change["added"].startswith("approval-mozilla")
228
+ change["field_name"] == "flagtypes.name"
229
+ and change["added"].startswith("approval-mozilla")
227
230
  and change["added"].endswith("?")
228
231
  ):
229
232
  continue
@@ -600,7 +603,8 @@ class CCNumber(SingleBugFeature):
600
603
  class IsUplifted(SingleBugFeature):
601
604
  def __call__(self, bug, **kwargs):
602
605
  return any(
603
- change["added"].startswith("approval-mozilla")
606
+ change["field_name"] == "flagtypes.name"
607
+ and change["added"].startswith("approval-mozilla")
604
608
  and change["added"].endswith("+")
605
609
  for history in bug["history"]
606
610
  for change in history["changes"]
@@ -97,6 +97,12 @@ class QANeededModel(BugModel):
97
97
  if not found_qa:
98
98
  for entry in bug_data["history"]:
99
99
  for change in entry["changes"]:
100
+ if change["field_name"] not in (
101
+ "keywords",
102
+ "flagtypes.name",
103
+ ):
104
+ continue
105
+
100
106
  if any(
101
107
  change["removed"].startswith(label)
102
108
  for label in ["qawanted", "qe-verify", "qaurgent"]
@@ -88,7 +88,9 @@ class StepsToReproduceModel(BugModel):
88
88
  else:
89
89
  for entry in bug_data["history"]:
90
90
  for change in entry["changes"]:
91
- if change["removed"].startswith("stepswanted"):
91
+ if change["field_name"] == "keywords" and change[
92
+ "removed"
93
+ ].startswith("stepswanted"):
92
94
  classes[int(bug_data["id"])] = 1
93
95
 
94
96
  logger.info(
@@ -369,6 +369,8 @@ class GroupCandidates(NamedTuple):
369
369
  class PushCandidates(NamedTuple):
370
370
  groups: Sequence[GroupCandidates]
371
371
  patch: PatchInfo = NO_PATCH_INFO
372
+ # Configs already selected for the push (e.g. for other groups), whose setup cost is paid.
373
+ used_configs: frozenset[str] = frozenset()
372
374
 
373
375
 
374
376
  def _plainest_cheapest(configs: Iterable[str]) -> str:
@@ -441,7 +443,7 @@ class ConfigSelector:
441
443
  """Select configs for the groups of each push (see select_configs)."""
442
444
  selected: list[list[list[str]]] = [[[] for _ in push.groups] for push in pushes]
443
445
  coverage = [[0.0 for _ in push.groups] for push in pushes]
444
- used: list[set[str]] = [set() for _ in pushes]
446
+ used: list[set[str]] = [set(push.used_configs) for push in pushes]
445
447
  active = {
446
448
  (p, g) for p, push in enumerate(pushes) for g in range(len(push.groups))
447
449
  }
@@ -520,6 +522,7 @@ class ConfigSelector:
520
522
  patch_files: Collection[str] = (),
521
523
  allowed_families: Collection[str] | None = None,
522
524
  very_likely_groups: Collection[str] = (),
525
+ used_configs: Collection[str] = (),
523
526
  ) -> dict[str, list[str]]:
524
527
  """Select the configs to run the groups of a push on.
525
528
 
@@ -533,6 +536,9 @@ class ConfigSelector:
533
536
  families building the modified files, see build_platforms), configs of other families are
534
537
  not candidates, unless a group has no candidate of the allowed families.
535
538
 
539
+ `used_configs` are configs already selected for other groups of the push (e.g. by a previous
540
+ call): their setup cost is considered paid.
541
+
536
542
  Groups without candidates are not in the result (callers should not restrict them).
537
543
  """
538
544
  patch = PatchInfo.from_files(patch_files) if patch_files else NO_PATCH_INFO
@@ -564,7 +570,9 @@ class ConfigSelector:
564
570
  )
565
571
  )
566
572
 
567
- selected = self._select([PushCandidates(groups, patch)], threshold)[0]
573
+ selected = self._select(
574
+ [PushCandidates(groups, patch, frozenset(used_configs))], threshold
575
+ )[0]
568
576
  return {g.group: sorted(configs) for g, configs in zip(groups, selected)}
569
577
 
570
578
  def _print_evaluation(
@@ -409,13 +409,20 @@ TUNED_XGBOOST_PARAMS = {"n_estimators": 400, "learning_rate": 0.03, "max_depth":
409
409
 
410
410
  # Number of runnables per push that the model should select at each confidence level used by the
411
411
  # Firefox taskgraph (e.g. bugbug-*-low/medium/high): roughly what the models selected at the fixed
412
- # 0.7/0.8/0.9 thresholds before the sample weighting and tuning changed their scale. Groups at the
413
- # "very_high" level run on a config of each OS family (see the HTTP service's config selection):
414
- # in offline evaluations, failing pushes caught at the same cost were ~2.3 points higher with one
415
- # such group per push, and about as high with 0.5 to 3.
412
+ # 0.7/0.8/0.9 thresholds before the sample weighting and tuning changed their scale. The
413
+ # "very_low" level, used by the taskgraph on expanded pushes, selects three times as many as "low".
414
+ # Groups at the "very_high" level run on a config of each OS family (see the HTTP service's config
415
+ # selection): in offline evaluations, failing pushes caught at the same cost were ~2.3 points
416
+ # higher with one such group per push, and about as high with 0.5 to 3.
416
417
  CONFIDENCE_LEVEL_TARGETS = {
417
- "label": {"low": 26.0, "medium": 15.0, "high": 5.5},
418
- "group": {"low": 103.0, "medium": 36.0, "high": 11.0, "very_high": 1.0},
418
+ "label": {"very_low": 78.0, "low": 26.0, "medium": 15.0, "high": 5.5},
419
+ "group": {
420
+ "very_low": 309.0,
421
+ "low": 103.0,
422
+ "medium": 36.0,
423
+ "high": 11.0,
424
+ "very_high": 1.0,
425
+ },
419
426
  }
420
427
 
421
428
  # Minimum share of the failing test pushes where the model selects a failure at the "low"
@@ -51,6 +51,7 @@ from bugbug.tools.code_review.utils import (
51
51
  convert_generated_comments_to_inline,
52
52
  format_patch_set,
53
53
  )
54
+ from bugbug.tools.core.data_types import CommentCategory, CommentSeverity
54
55
  from bugbug.tools.core.exceptions import (
55
56
  LargeDiffError,
56
57
  RecursionLimitError,
@@ -317,10 +318,13 @@ class CodeReviewTool(GenerativeModelTool):
317
318
  filtered_suggestions = self.suggestion_filterer.run(unfiltered_suggestions)
318
319
 
319
320
  # The patch-scope suggestion is a deliberate, meta-level comment, so it
320
- # bypasses the suggestion filterer and is always sorted last.
321
+ # bypasses the suggestion filterer, is always sorted last, and always
322
+ # has a fixed `minor` severity regardless of what the model chose.
321
323
  scope_suggestions = await self.assess_patch_scope(patch, patch_summary)
322
324
  for offset, suggestion in enumerate(scope_suggestions):
323
325
  suggestion.order = len(filtered_suggestions) + offset + 1
326
+ suggestion.severity = CommentSeverity.MINOR
327
+ suggestion.category = CommentCategory.SCOPE
324
328
 
325
329
  inline_comments = list(
326
330
  convert_generated_comments_to_inline(
@@ -6,7 +6,11 @@ import tenacity
6
6
  from pydantic import BaseModel, Field, PrivateAttr
7
7
 
8
8
  from bugbug.tools.core.connection import get_http_client
9
- from bugbug.tools.core.data_types import InlineComment
9
+ from bugbug.tools.core.data_types import (
10
+ CommentCategory,
11
+ CommentSeverity,
12
+ InlineComment,
13
+ )
10
14
 
11
15
 
12
16
  class GeneratedReviewComment(BaseModel):
@@ -31,6 +35,14 @@ class GeneratedReviewComment(BaseModel):
31
35
  description="An integer representing the priority of the comment, with 1 being the highest confidence/importance."
32
36
  ),
33
37
  ]
38
+ severity: Annotated[
39
+ CommentSeverity,
40
+ Field(description="How much the issue matters, from critical to nit."),
41
+ ]
42
+ category: Annotated[
43
+ CommentCategory,
44
+ Field(description="The kind of problem the comment reports."),
45
+ ]
34
46
 
35
47
 
36
48
  class AgentResponse(BaseModel):
@@ -33,10 +33,14 @@ Follow this systematic approach to review the patch:
33
33
  - When uncertain about an issue, use available tools to verify before commenting
34
34
  - Do not suggest issues you cannot verify with available context
35
35
 
36
- **Step 4: Sort and Order Comments**
37
- - Sort comments by descending confidence and importance
38
- - Start with issues you are certain are valid and that are most critical
39
- - Assign each comment a numeric order starting at 1
36
+ **Step 4: Classify Each Comment**
37
+ - Assign a `severity` using this rubric:
38
+ - `critical`: a security vulnerability, data loss or corruption, a crash, or a break that would affect users if the patch landed
39
+ - `major`: a functional bug, logic error, or regression on a realistic code path; the code does not do what the patch intends
40
+ - `minor`: correct but not ideal; performance, robustness, error handling, or maintainability problems that will not break users
41
+ - `nit`: style, naming, readability, or a coding-standard preference that is safe to ignore
42
+ - Assign a `category`: `security`, `correctness`, `performance`, `maintainability`, `style`, or `scope`
43
+ - When unsure between two severities, pick the lower one
40
44
 
41
45
  **Step 5: Write Clear, Constructive Comments**
42
46
  - Use direct, declarative language - state the problem definitively, then suggest the fix
@@ -4,6 +4,7 @@ from logging import getLogger
4
4
  import weave
5
5
 
6
6
  from bugbug.tools.comment_matching.agent import CommentMatchingTool
7
+ from bugbug.tools.core.data_types import CommentSeverity
7
8
  from bugbug.tools.suggestion_filtering.agent import SuggestionFilteringTool
8
9
 
9
10
  logger = getLogger(__name__)
@@ -212,6 +213,12 @@ class LLMCommentMatchingScorer(weave.Scorer):
212
213
  "matched_valid_excluded": matched_valid_excluded,
213
214
  "matched_invalid_retained": matched_invalid_retained,
214
215
  "matched_invalid_excluded": matched_invalid_excluded,
216
+ # Severity breakdown
217
+ "severity_breakdown": build_severity_breakdown(
218
+ generated_comments,
219
+ matched_valid_retained + matched_valid_excluded,
220
+ matched_invalid_retained + matched_invalid_excluded,
221
+ ),
215
222
  }
216
223
 
217
224
  def summarize(self, score_rows: list[dict]) -> dict:
@@ -291,4 +298,55 @@ class LLMCommentMatchingScorer(weave.Scorer):
291
298
  if total_matched_invalid > 0
292
299
  else 0
293
300
  ),
301
+ **summarize_severity_breakdowns(score_rows),
294
302
  }
303
+
304
+
305
+ def build_severity_breakdown(
306
+ generated_comments: list,
307
+ matched_valid: list[dict],
308
+ matched_invalid: list[dict],
309
+ ) -> dict[str, dict[str, int]]:
310
+ """Count generated and matched comments per severity for one example.
311
+
312
+ Comments without a severity, e.g. from runs before severities existed, are
313
+ left out of the breakdown.
314
+ """
315
+ breakdown = {
316
+ severity.value: {"generated": 0, "matched_valid": 0, "matched_invalid": 0}
317
+ for severity in CommentSeverity
318
+ }
319
+
320
+ def count(comment, key: str) -> None:
321
+ severity = getattr(comment, "severity", None)
322
+ if severity is not None:
323
+ breakdown[severity][key] += 1
324
+
325
+ for comment in generated_comments:
326
+ count(comment, "generated")
327
+ for match in matched_valid:
328
+ count(match["generated_comment"], "matched_valid")
329
+ for match in matched_invalid:
330
+ count(match["generated_comment"], "matched_invalid")
331
+
332
+ return breakdown
333
+
334
+
335
+ def summarize_severity_breakdowns(score_rows: list[dict]) -> dict:
336
+ """Aggregate per-severity counts across examples into flat summary metrics."""
337
+ summary: dict[str, float] = {}
338
+ for severity in CommentSeverity:
339
+ totals = {"generated": 0, "matched_valid": 0, "matched_invalid": 0}
340
+ for row in score_rows:
341
+ row_counts = row.get("severity_breakdown", {}).get(severity.value, {})
342
+ for key in totals:
343
+ totals[key] += row_counts.get(key, 0)
344
+
345
+ summary[f"{severity}_generated"] = totals["generated"]
346
+ summary[f"{severity}_matched_valid"] = totals["matched_valid"]
347
+ summary[f"{severity}_matched_invalid"] = totals["matched_invalid"]
348
+ summary[f"{severity}_valid_match_rate"] = (
349
+ totals["matched_valid"] / totals["generated"] if totals["generated"] else 0
350
+ )
351
+
352
+ return summary
@@ -391,4 +391,6 @@ def convert_generated_comments_to_inline(
391
391
  on_removed_code=not scope["has_added_lines"],
392
392
  explanation=comment.explanation,
393
393
  order=comment.order,
394
+ severity=comment.severity,
395
+ category=comment.category,
394
396
  )
@@ -6,6 +6,27 @@
6
6
  """Core data types used across bugbug tools."""
7
7
 
8
8
  from dataclasses import dataclass
9
+ from enum import StrEnum
10
+
11
+
12
+ class CommentSeverity(StrEnum):
13
+ """How much a review comment matters, from most to least urgent."""
14
+
15
+ CRITICAL = "critical"
16
+ MAJOR = "major"
17
+ MINOR = "minor"
18
+ NIT = "nit"
19
+
20
+
21
+ class CommentCategory(StrEnum):
22
+ """The kind of problem a review comment reports."""
23
+
24
+ SECURITY = "security"
25
+ CORRECTNESS = "correctness"
26
+ PERFORMANCE = "performance"
27
+ MAINTAINABILITY = "maintainability"
28
+ STYLE = "style"
29
+ SCOPE = "scope"
9
30
 
10
31
 
11
32
  @dataclass
@@ -28,6 +49,8 @@ class InlineComment:
28
49
  is_generated: bool | None = None
29
50
  explanation: str | None = None
30
51
  order: int | None = None
52
+ severity: CommentSeverity | None = None
53
+ category: CommentCategory | None = None
31
54
  details: dict | None = None
32
55
 
33
56
 
@@ -82,6 +82,22 @@ def get_deleted_lines(patch: bytes) -> dict[str, list[int]]:
82
82
  return deleted_lines
83
83
 
84
84
 
85
+ def annotate_path(
86
+ hg: hglib.client.hgclient, rev: str, path: str, skip: str | None
87
+ ) -> bytes:
88
+ """Return the node that last touched each line of path, as of the parent of rev."""
89
+ return hg.rawcommand(
90
+ hglib.util.cmdbuilder(
91
+ b"annotate",
92
+ b"path:" + path.encode("utf-8"),
93
+ r=f"p1({rev})",
94
+ w=True,
95
+ skip=skip,
96
+ T="{lines % '{node}\\n'}",
97
+ )
98
+ )
99
+
100
+
85
101
  def find_bug_introducing_revs(
86
102
  hg: hglib.client.hgclient,
87
103
  rev: str,
@@ -107,16 +123,29 @@ def find_bug_introducing_revs(
107
123
  continue
108
124
 
109
125
  skip = " + ".join(ignored_revs_by_path.get(path, [])) or None
110
- annotate = hg.rawcommand(
111
- hglib.util.cmdbuilder(
112
- b"annotate",
113
- b"path:" + path.encode("utf-8"),
114
- r=f"p1({rev})",
115
- w=True,
116
- skip=skip,
117
- T="{lines % '{node}\\n'}",
126
+
127
+ try:
128
+ annotate = annotate_path(hg, rev, path, skip)
129
+ except hglib.error.ServerError:
130
+ # Mercurial can crash while annotating (e.g. IndexError in
131
+ # dag_util._annotatepair when skipping revisions). The command
132
+ # server is dead at this point, so restart it and retry without
133
+ # skipping revisions, which is the code path that crashes.
134
+ # Remove this workaround once Mercurial fixes the bug:
135
+ # https://foss.heptapod.net/mercurial/mercurial-devel/-/work_items/10162
136
+ logger.exception(
137
+ "hg annotate crashed for %s at %s, retrying without --skip", path, rev
118
138
  )
119
- )
139
+ hg.open()
140
+ if skip is None:
141
+ continue
142
+ try:
143
+ annotate = annotate_path(hg, rev, path, None)
144
+ except hglib.error.ServerError:
145
+ logger.exception("hg annotate crashed again for %s at %s", path, rev)
146
+ hg.open()
147
+ continue
148
+
120
149
  line_revs = annotate.decode("ascii").splitlines()
121
150
  bug_introducing_revs.update(
122
151
  line_revs[lineno - 1] for lineno in linenos if lineno <= len(line_revs)