Skip to content

Bug 2084334 - Part 2: Add perftest-repair Hackbot agent for perf test intermittents - #7204

Open
Andrej1198 wants to merge 1 commit into
mozilla:masterfrom
Andrej1198:perftest/2-agent
Open

Andrej1198 wants to merge 1 commit into
mozilla:masterfrom
Andrej1198:perftest/2-agent

Conversation

@Andrej1198

@Andrej1198 Andrej1198 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Adds perftest-repair, a Hackbot agent that diagnoses failing perf test jobs (mozperftest, raptor/browsertime, talos) from their Bugzilla bug and logs. With a confident fix, it pushes it to try with rebuilds and reports to #perftest-intermittent-hackbot on Slack.

@Andrej1198
Andrej1198 requested a review from a team as a code owner October 16, 2026 13:37
@Andrej1198
Andrej1198 marked this pull request as draft October 16, 2026 13:37
@Andrej1198

Copy link
Copy Markdown
Contributor Author

Not ready for review

@Andrej1198 Andrej1198 changed the title WIP: Perftest/2 agent Bug 2084334 - Part 2: Add perftest-repair Hackbot agent for perf test intermittents Oct 20, 2026
@Andrej1198
Andrej1198 marked this pull request as ready for review October 20, 2026 19:56
@Andrej1198

Copy link
Copy Markdown
Contributor Author

Ready for review!

@marco-c

marco-c commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

@Andrej1198 as a first step, we'd need review from somebody who is familiar with perf tests, then we can review the agent parts.
There is a @hackbot-performance team, but maybe we need a separate one specifically for perf tests?

@marco-c

marco-c commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

(also, need to rebase now given part 1 landed)

@marco-c

marco-c commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Ah I see you added @hackbot-perftest to CODEOWNERS, but the team doesn't exist yet. I can create it for you, and I will add you to the team. Let me know who else should be added to the team.

Comment thread .github/CODEOWNERS Resolved
@Andrej1198

Copy link
Copy Markdown
Contributor Author

Thanks for the advice Marco, I'll get @92kns to review this. I spoke with Suhaib and he recommended keeping the patches that interact with infra code outside of this big initial commit as much as possible.

Comment thread docs/hackbot/agents.md Outdated
| `bug-fix` | Triage a Bugzilla bug and produce a candidate fix as a Phabricator revision. Also handles `@hackbot` follow-ups on an existing revision, and Bugzilla `needinfo?` requests. | yes | yes | **yes** |
| `test-repair` | Classify a CI test failure as regression or intermittent, blame the culprit commit, hand it on to `test-repair-fix`. | yes | no | no |
| `test-repair-fix` | Propose a patch for the culprit a `test-repair` run blamed, for its author to squash in and reland. | yes | yes | no |
| `perftest-repair` | Diagnose a perf test intermittent (mozperftest, raptor/browsertime, talos), push a suggested fix to try with retriggers, and report to Slack. | yes | optional | try + Slack |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mention AWSY

"perftest-repair": AgentSpec(
name="perftest-repair",
description=(
"Investigate an intermittent perf test failure bug (mozperftest, "

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: mention awsy

Comment thread agents/perftest-repair/Dockerfile Outdated
# Built from the evgenyrp fork until the User-Agent fix (Treeherder rejects requests
# without one) is released upstream: https://github.com/padenot/treeherder-cli/pull/12
FROM rust:1-slim-bookworm AS treeherder-cli
ARG TREEHERDER_CLI_GIT=https://github.com/evgenyrp/treeherder-cli.git

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FWIW the fork + build from source bits here are copied from build-repair/test-repair and are a bit stale now. padenot/treeherder-cli merged back in october, and 0.4 (released last week) ships linux aarch64 + x86_64 binaries, so cargo binstall treeherder-cli should just work (gecko-triage already does it that way, though on 0.3.1).

probably worth doing that here

one thing to watch if this moves to 0.4: it can now retrigger/cancel/add jobs on a push.
I think the agent has no taskcluster creds so it can't actually do it, but might be worth banning those in system.md like --watch, since it would get around the single try push gate (which matters a lot for android/mac).

# How many times the try push runs the failing job. A permafail fails every run,
# so a few green runs show the fix; an intermittent needs more.
TRY_REBUILD_INTERMITTENT = 10
TRY_REBUILD_PERMAFAIL = 3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

android and mac perf pools are pretty limited, and since try_server.push is in always_apply_actions these go out with no review.
10 rebuilds of an android or mac perf job is a real chunk of device time, and a few bad fixes in a row could probably back up other people's try runs.

could we either skip the auto push for android/mac labels (just report the fix and let a person push it), or at least drop the rebuild count way down for those? linux/windows I think are fine as is.

also FWIW 10 green runs doesn't say a whole lot for a low rate intermittent, so might be worth saying that in the slack message so nobody reads green as "fixed"

- **Fix in tree, high confidence:** make the smallest change that addresses the root cause, and leave it uncommitted in the working tree.
{verify_step}
Say in `analysis.md` what you verified, and how.
Then record one `try_server_push` of the fix: `tasks` is the failing job's task label, `rebuild={try_rebuild_permafail}` for a permafail or `rebuild={try_rebuild_intermittent}` for an intermittent, and a `title` of the form "Bug {bug_id} - <what the fix does>". Read the label from the failing task's definition (`tags.label` at `https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/<task id>`); do not guess it. If the bug covers several jobs, list each failing label once, and make sure the fix covers each of them; say in `analysis.md` if it covers only some.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i might be mixing up terminology here so please double check... but copying the label from the failing task won't always work on try. some perf jobs are cron or m-c only so I think the push would either fail or schedule nothing. maybe have it check the label is actually in try's task graph first, and fall back to a diagnosis otherwise?

- **the harness mishandles CaR**: browsertime or raptor code specific to
`custom-car`, which is ours.

## car-mechanic

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

car-mechanic can do a fair bit more than diagnose/triage. could we have it run car-mechanic agents first (it prints its own usage guide) and check car-mechanic <cmd> --help before reasoning from scratch? risk is pretty useful for permafails since it shows recent upstream changes to files that tend to break CaR. and search does more than keyword search (reading files at a given ref, extra flags get passed through), so probably better to let the agent poke at the help output than list it all here. that way this file also doesn't drift when car-mechanic adds stuff.

before reasoning from scratch. Always pass `--json`.

1. `car-mechanic diagnose --json --url <task id>`: matches the failure log of a CaR
task against known patterns. Give it the toolchain task when the toolchain

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

diagnose --url reports "no failures" when sheriffs have starred the CaR jobs as intermittent, which is exactly the kind of bug this agent gets. might be worth telling it to fetch logs with treeherder-cli ... --include-intermittent --cache-dir <dir> and grep FAILED: / error: in them if diagnose comes back empty.


- Raising a timeout without evidence that the operation legitimately takes
longer. A timeout is usually a symptom.
- Disabling or skipping a test, a platform or a subtest. The exception is when

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the [stockwell disable-recommended] exception says "and the harness ruleset says how to do it", but none of the rulesets say how, so AFAICT this never kicks in. I'd lean towards just removing the exception and leaving disabling to sheriffs/test owners. what do you think?

## Permafail or intermittent

- **Permafail:** every recent run of the job fails the same way, starting at
one push. Use `treeherder-cli <rev> --repo <project> --filter '<job>'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

are --suspects, --similar-history and --lookback in the pinned evgenyrp fork rev (0095956a)? if not, the agent will probably burn a few turns figuring that out

settings. Treat measurement settings as off limits (see `triage.md`).
- Browsertime support scripts (custom test scripts, pageload and interactive
drivers) are under `testing/raptor/browsertime/`.
- Jobs are defined under `taskcluster/kinds/`. `git grep '<label fragment>'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

a few things that might help here:

  • the android "adb/device errors before the test starts are infra" signature is only in mozperftest.md, but raptor android jobs hit this way more often (LT/bitbar). worth copying over
  • jobs are in taskcluster/kinds/browsertime/ (desktop.yml / mobile.yml), which is a bit more precise than taskcluster/kinds/
  • playback recordings are listed in testing/raptor/raptor/tooltool-manifests/playback/, might help it tell a stale recording apart from a missing manifest
  • the "no raptor test results were found" / perfherder schema validation failures are pretty common and probably belong in the harness bucket

if source_repo is None:
return "diagnosis"
changed = subprocess.run(
["git", "-C", str(source_repo), "status", "--porcelain"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: git status --porcelain also counts untracked files, so if the agent leaves something stray in the tree (e.g. a scratch file written to a relative path) the outcome flips to "fix" and that triggers a try push. maybe check git diff HEAD plus untracked files under the harness/test paths instead?

@92kns 92kns 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.

thanks for putting this together @Andrej1198 ! a few comments and suggestions otherwise looks really good to have as a base we can iterate on.

i'd say main concerns are the treeherder-cli fork maybe being way too old and potentially watching out for pushing to try on our limited hardware pools

… intermittents

Given the Bugzilla bug tracking a failing mozperftest, raptor/browsertime
or talos job, the agent reads the bug through a Bugzilla-only broker,
fetches the logs of every failing job and platform, and works out whether
the failure is in the test, the harness, Firefox or the infrastructure.
With a confident fix it pushes it to try, rebuilding the failing jobs 3
times for a permafail or 10 for an intermittent, and every run posts a
report to #perftest-intermittent-hackbot. It never writes to Bugzilla.

Bugs with no failures in the last 7 days are skipped before any session.
Chromium-as-Release failures are diagnosed with car-mechanic, pinned to a
commit in the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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