From 917f11820f887f1116f481dbe3282f51fcb8e46f Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 2 Dec 2026 12:08:02 +0000 Subject: [PATCH] Check for existing core bugs in the webcompat-diagnosis agent Ask the agent to get a list of possible root cause bugs when it's completed a diagnosis, and return these as part of the result. The instructions are an abbreviated version of what frontend-triage uses when searching for dupes, and designed to avoid overloading bugzilla, and only returning the most promising candidates. --- .../autowebcompat_diagnosis/agent.py | 14 +++++++++++++- .../autowebcompat_diagnosis/result.py | 11 +++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/agent.py b/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/agent.py index eb35dc276aa..8dd8969fae5 100644 --- a/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/agent.py +++ b/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/agent.py @@ -54,6 +54,7 @@ class AutowebcompatDiagnosisResult(BaseModel): root_cause: str | None evidence: str | None testcase_url: str | None + existing_bugs: list[int] class Task(BaseTask[ResultT]): @@ -391,7 +392,17 @@ def system_prompt(self) -> str: matching this schema: {json.dumps(DiagnosisText.model_json_schema(), indent=2)} -6. Submit your diagnosis via `submit_result` (see "Reporting your result"). +6. If the difference is a browser engine implementation difference, query + bugzilla.mozilla.org for existing core bugs that describe the same problem. + Do not query bugzilla more than 3 times in total to obtain a candidate set. + Consider only unresolved bugs. Once you have a candidate set, select at most + one bug per identified issue. Prefer to select no bugs rather than ones with + low confidence of being the root cause. When querying do not select + large fields such as descriptions, comments or attachments. Once you have + high confidence candidates you may additionally select descriptions and comments + to verify your pick. + +7. Submit your diagnosis via `submit_result` (see "Reporting your result"). """ ) ) @@ -437,6 +448,7 @@ def into_result(self) -> AutowebcompatDiagnosisResult: root_cause=diagnosis.root_cause if diagnosis is not None else None, evidence=diagnosis.evidence if diagnosis is not None else None, testcase_url=self.testcase_url, + existing_bugs=self.diagnosis_result.existing_bugs if self.diagnosis_result else [], ) diff --git a/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/result.py b/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/result.py index 6c3050b1a35..ec6f289feb3 100644 --- a/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/result.py +++ b/agents/autowebcompat-diagnosis/hackbot_agents/autowebcompat_diagnosis/result.py @@ -271,6 +271,17 @@ class DiagnosisResult(BaseModel): ), ] + existing_bugs: Annotated[ + list[int], + Field( + description=( + "List of bug ids from bugzilla.mozilla.org that may correspond to the root " + "cause identified by diagnosis. Empty if no candidate bugs were found." + ), + ), + ] + + @field_validator("diagnosis_path", "testcase_path", mode="after") @classmethod def validate_paths(cls, path: Path | None) -> Path | None: