Skip to content

Add regression-range hackbot agent (mozregression --prompt bisection)#6354

Open
msujaws wants to merge 1 commit into
mozilla:masterfrom
msujaws:regression-range-6259
Open

Add regression-range hackbot agent (mozregression --prompt bisection)#6354
msujaws wants to merge 1 commit into
mozilla:masterfrom
msujaws:regression-range-6259

Conversation

@msujaws

@msujaws msujaws commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Resolves #6259 — a hackbot agent that automatically finds a regression range for a regression bug.

What it does

Given a Bugzilla bug id, the agent:

  1. Fetches the bug (fields + comments) and decides whether it is an automatable regression (declines cleanly otherwise: not_a_regression / not_automatable).
  2. Determines good/bad bounds — using a suspected regressor's landing (via mozilla_vcs) when available, anchoring good just before it.
  3. Resolves any required prefs/feature-gating via searchfox (never guesses pref names) and authors a natural-language good/bad reproduction directive.
  4. Runs mozregression --prompt (mozilla/mozregression#2197) to drive a real bisection — each candidate build is classified GOOD/BAD by an agent driving the Firefox DevTools MCP (the natural-language equivalent of git bisect run).
  5. Reports the resulting changeset/pushlog range and records a Bugzilla comment plus, at high confidence, proposed field updates (cf_has_regression_range, regressed_by, clearing regressionwindow-wanted). Actions are recorded for human review — never auto-applied.

Key components

  • libs/agent-tools/agent_tools/mozregression.py — framework-neutral run_mozregression tool: an async subprocess wrapper that builds the CLI invocation and parses the final range. Handles both regression (Last good/First bad) and --find-fix (First good/Last bad) wording, takes the last pushlog URL, and falls back to the pushlog fromchange/tochange. Always returns a dict; never raises.
  • agents/regression-range/ — the agent, mirroring the frontend-triage structure (brokered Bugzilla read + searchfox + mozilla_vcs + the mozregression tool + recorded actions). The system prompt scopes to reproductions that are deterministic in a fresh headless profile (including about:/chrome pages and browser UI — menus, tabs, sidebars, toolbars), resolves prefs via searchfox, anchors bounds to a suspected regressor's landing, and runs scroll/layout checks at a realistic window size.
  • services/hackbot-api — registers the agent (RegressionRangeInputs + AGENT_REGISTRY).
  • services/hackbot-ui — label overrides for the new finding fields.
  • Tests for the tool's argv construction / range parsing and the registry entry.

Verification (local)

  • The run_mozregression tool drove a real #2197 --prompt bisection to a changeset/pushlog range.
  • The full agent ran end-to-end via docker compose on real bugs: correct scoping decisions, searchfox-verified prefs, regressor-anchored bounds, and honest inconclusive reporting when a symptom wasn't observable headless (while still identifying the likely regressor).

Notes

Adds a new hackbot agent that automatically finds a regression range for a
regression bug by bisecting with mozregression's --prompt mode
(mozilla/mozregression#2197): it reads the bug, determines good/bad bounds and a
natural-language reproduction directive, drives a real bisection, and reports
the resulting changeset/pushlog range -- recording a Bugzilla comment and, at
high confidence, proposed field updates (recorded, never auto-applied).

- libs/agent-tools/agent_tools/mozregression.py: framework-neutral run_mozregression
  tool (async subprocess wrapper) that invokes mozregression --prompt and parses
  the final range. Handles both regression ("Last good"/"First bad") and
  --find-fix ("First good"/"Last bad") wording, takes the last pushlog URL, and
  falls back to the pushlog fromchange/tochange. Always returns a dict; never raises.
- agents/regression-range/: the agent (mirrors frontend-triage) -- bugzilla read
  + searchfox + mozilla_vcs + the mozregression tool + recorded actions. System
  prompt: scope to deterministic-in-fresh-headless-profile repros (incl. about:/
  chrome pages and browser UI: menus, tabs, sidebars, toolbars); resolve pref
  names via searchfox (never guess); anchor the good bound just before a suspected
  regressor's landing; run scroll/layout checks at a realistic window size.
- services/hackbot-api: register the agent (RegressionRangeInputs + AGENT_REGISTRY).
- services/hackbot-ui: label overrides for the new finding fields.
- Tests for the tool's argv construction and range parsing, and the registry entry.

Issue mozilla#6259
@msujaws
msujaws requested a review from a team as a code owner July 20, 2026 16:15
@marco-c

marco-c commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

This is great, I wanted to talk to you about doing this, but you did it earlier than I reached out :)

What are your thoughts on the split between this and frontend-triage? Should frontend-triage use this as a sub-agent instead of them running separately?

Comment on lines +20 to +25
# mozregression is installed from the fork carrying PR #2197 (the --prompt mode
# is not yet in a release), so it lives outside the workspace lockfile. Pin to a
# specific commit once the PR settles; the branch tracks the PR for now.
ARG MOZREGRESSION_REF="git+https://github.com/msujaws/mozregression.git@prompt-devtools-mcp-verdict"
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --python /opt/venv "mozregression @ ${MOZREGRESSION_REF}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we instead use [tool.uv.sources] in pyproject.toml so it gets installed with other deps without a custom step in Dockerfile?

@suhaibmujahid suhaibmujahid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You might want to add the new agent to the CODEOWNERS file.

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.

Create hackbot agent to automatically try to find a regression range for regression bugs

3 participants