Repository navigation
Bug 2084334 - Part 2: Add perftest-repair Hackbot agent for perf test intermittents - #7204
Andrej1198 wants to merge 1 commit into
Conversation
|
Not ready for review |
9810e91 to
d5a8542
Compare
|
Ready for review! |
|
@Andrej1198 as a first step, we'd need review from somebody who is familiar with perf tests, then we can review the agent parts. |
|
(also, need to rebase now given part 1 landed) |
|
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. |
f36bf62 to
ca0b0d2
Compare
|
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. |
| | `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 | |
| "perftest-repair": AgentSpec( | ||
| name="perftest-repair", | ||
| description=( | ||
| "Investigate an intermittent perf test failure bug (mozperftest, " |
| # 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>' |
There was a problem hiding this comment.
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>' |
There was a problem hiding this comment.
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 thantaskcluster/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"], |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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>
ca0b0d2 to
6a54b9e
Compare
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.