Skip to content

Add an agent to find simple perftest bugs that bug-fix can solve. - #7769

Open
gmierz wants to merge 1 commit into
mozilla:masterfrom
gmierz:hackbot-capable
Open

gmierz wants to merge 1 commit into
mozilla:masterfrom
gmierz:hackbot-capable

Conversation

@gmierz

@gmierz gmierz commented Dec 2, 2026

Copy link
Copy Markdown

This patch adds a new hackbot agent that will be used to determine if a bug is simple to fix with the bug-fix agent. If it is, it will add a [hackbot-capable] whiteboard tag along with a comment with the reasoning. If it isn't, nothing is added to the bug but the reasoning for why would still be found in the dashboard. This information will then be used by us to trigger a hackbot bug-fix run from bugzilla if we find the reasoning is good, and it makes sense to trigger it.

This agent would be triggered from the bugbot rule here on an hourly basis: mozilla/bugbot#3125

This is restricted to only mozilla-employee filled bugs from the bugbot rule as well.

@gmierz
gmierz requested a review from a team as a code owner December 2, 2026 04:27
Copilot AI balanced review requested due to automatic review settings December 2, 2026 04:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The agent can send security-marked bugs to Claude and overwrite newer Bugzilla whiteboard edits, while its broker exposes an unnecessary file-writing tool.

9 open issues
What changed in this PR

This PR adds hackbot-capable, a Hackbot agent that screens Firefox performance-testing bugs for the existing bug-fix agent. The companion Bugbot rule is intended to run hourly on newly filed bugs from Mozilla employees. The new agent recommends candidates without starting a fix run.

Changes:

  • Reads Bugzilla reports and uses Searchfox to check whether a fix is small, well defined, and testable on Linux.
  • Tags positive candidates with [hackbot-capable] and posts an explanation in Bugzilla. Negative verdicts leave the bug unchanged and keep the reasoning in the dashboard.
  • Adds the agent to the Hackbot API and dashboard, with local containers, deployment configuration, and tests.
File Description
uv.lock Registers the agent and its dependencies in the workspace lockfile.
services/​hackbot-ui/​lib/​agents.ts Adds the agent to dashboard selectors.
services/​hackbot-api/​tests/​test_actions_applier.py Updates the expected set of agents that can auto-apply actions.
services/​hackbot-api/​app/​schemas.py Defines the agent’s API inputs.
services/​hackbot-api/​app/​agents.py Registers the job and its auto-apply policy.
docs/​hackbot/​security.md Lists the agent among those that use a credential broker.
docs/​hackbot/​agents.md Adds the agent to the Hackbot catalog.
docker-compose.yml Includes the agent’s local Compose configuration.
agents/​hackbot-capable/​VERSION Sets the initial agent version.
agents/​hackbot-capable/​tests/​test_agent.py Tests verdict handling, whiteboard updates, and container configuration.
agents/​hackbot-capable/​README.md Documents behavior, triggers, and local setup.
agents/​hackbot-capable/​pyproject.toml Defines packaging, dependencies, and test settings.
agents/​hackbot-capable/​hackbot.toml Sets Cloud Run resources for the agent and broker.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​templates/​comment.md Defines the Bugzilla comment format.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​prompts/​system.md Defines the model’s eligibility criteria and response format.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​broker.py Serves Bugzilla tools from a separate container that holds the API key.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​agent.py Fetches bug context, obtains a verdict, and records Bugzilla actions.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​__main__.py Loads run settings and starts the agent.
agents/​hackbot-capable/​hackbot_agents/​hackbot_capable/​__init__.py Marks the agent’s Python package.
agents/​hackbot-capable/​Dockerfile Builds separate agent and broker images.
agents/​hackbot-capable/​compose.yml Runs the agent and broker together locally.
.taskcluster.yml Runs the agent’s tests in continuous integration.
.github/​workflows/​hackbot-prod-deploy.yml Adds the agent to the production deployment selector.
.github/​CODEOWNERS Assigns ownership to the Hackbot performance team.

Review effort: Balanced

return f"the bug is already resolved ({bug['resolution']})"
if WHITEBOARD_TAG in (bug.get("whiteboard") or ""):
return f"the bug already has {WHITEBOARD_TAG}"
return None
await bugzilla_actions.update_bug(
actions_recorder,
bug_id=bug,
changes={"whiteboard": f"{whiteboard} {WHITEBOARD_TAG}".strip()},
)
)
ctx = BugzillaContext(client=client)
sdk_config = build_sdk_server("bugzilla", ctx, bugzilla.TOOLS)
- ${HOME}/hackbot/artifacts:/artifacts
depends_on:
hackbot-capable-broker:
condition: service_started
Comment on lines +84 to +87
bugs = json.loads(text).get("bugs") or []
if not bugs:
raise AgentError(f"bug {bug}: not found or not accessible")
return bugs[0]
bug_fields, bugzilla_mcp_server=bugzilla_mcp_server, **judge_options
)

if verdict.capable:
Comment on lines +206 to +221
whiteboard = latest.get("whiteboard") or ""
if WHITEBOARD_TAG not in whiteboard:
# Recorded, not applied: the apply step sends the two as one Bugzilla
# update, so the tag never lands without its explanation.
await bugzilla_actions.update_bug(
actions_recorder,
bug_id=bug,
changes={"whiteboard": f"{whiteboard} {WHITEBOARD_TAG}".strip()},
reasoning=verdict.reasoning,
)
await bugzilla_actions.add_comment(
actions_recorder,
bug_id=bug,
text=render_comment(verdict.reasoning),
reasoning=verdict.reasoning,
)
auto_apply_actions=False,
auto_apply_requires_consent=True,
),
"hackbot-capable": AgentSpec(
# the bug capable, and vouches for exactly those runs with
# `findings.auto_apply`.
auto_apply_actions=True,
auto_apply_requires_consent=True,
@marco-c

marco-c commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

@gmierz why not also attempting the fix directly? It will be cheaper because the bug info and the analysis of the agent will be in the model's cache.

@gmierz

gmierz commented Dec 2, 2026

Copy link
Copy Markdown
Author

@marco-c I can definitely do that! Mainly started with this since I'm not sure what the determination will look like, but I guess in the worst case, we could just abandon the proposed patch. I'll make the changes.

@marco-c

marco-c commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

You could also have a first pass that determines if it's simple enough, and the second pass within the same session that builds the fix.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants