Skip to content

Add read-only workflow failure classifier - #9543

Open
malmstein wants to merge 5 commits into
developfrom
feature/david/workflow_failure_classifier
Open

Add read-only workflow failure classifier#9543
malmstein wants to merge 5 commits into
developfrom
feature/david/workflow_failure_classifier

Conversation

@malmstein

@malmstein malmstein commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1214901934989258/task/1217636465596685
Tech Design URL (if applicable):
API Proposals URL(s) (if applicable):

Description

Adds an agentic workflow that diagnoses a failed release-blocking nightly run and writes up the likely cause, so the engineer on maintenance rotation gets a diagnosis instead of a bare "job failed" task. It reads the failing step, the job logs, the Maestro per-flow results or the Flank test/failure pairs, the recent run history, and the commits between the last green run and the failing SHA; it does not create tasks (the existing steps in nightly.yml, privacy.yml and the Maestro reporter already do that) and it does not judge release-blocking severity, which is a lookup from which workflow failed rather than a judgement. This first version is read-only: no safe-outputs are configured, so it can only write to the run summary, and the report itself leads with a likely cause from a fixed set (flaky test, feature-flag rollout, recent change, infrastructure, unclear) under a 12-line cap, per review feedback from the maintenance AoR.

The one non-obvious thing: roles: all deliberately drops the membership gate. A workflow_run started by a scheduled nightly inherits an actor that cannot be relied on to hold a repo role, and if it does not, every automatic diagnosis is skipped silently. The workflow reads only same-repo, non-fork runs on develop and writes nothing, and the fork and same-repository guards stay in place.

Steps to test this PR

Compilation

  • gh aw compile workflow-failure-classifier reports 0 errors, 0 warnings
  • recompiling leaves no uncommitted diff in the lock file

Read-only guarantees, in the lock file

  • GITHUB_READ_ONLY: "1" is set on the GitHub MCP server
  • no GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG appears anywhere
  • the agent job has actions: read and no write permissions

Trigger

  • the activation job requires github.event.workflow_run.conclusion == 'failure', so a green nightly starts nothing
  • the activation job keeps the same-repository and non-fork guards

Live run, only possible once this is on develop, since workflow_dispatch is only registered for workflows on the default branch

  • gh workflow run workflow-failure-classifier.lock.yml --ref develop -f run_id=32324415014
  • the run summary reports a likely cause of "flaky test", names GpcTest#whenProtectionsAreEnableGpcSetCorrectly, and references Pin HttpsUpgradesTest interactions to the tab's WebView #9534
  • nothing was written anywhere: no Asana comment, no issue, no PR

UI changes

Before After
No UI changes No UI changes

malmstein and others added 4 commits August 19, 2026 22:51
The nightly release-blocking workflows already auto-create an Asana task
when they fail, but that task carries only the run URL and, for e2e, a
one-line assertion message. Everything that makes a failure actionable
still has to be reconstructed by hand on maintenance day: which step
failed, whether it is our change or infrastructure, how often it has
happened recently, and which commits could have caused it.

This agentic workflow does that reconstruction from the run itself. It
reads the failed job and step, the job logs, the Maestro per-flow
results, the recent run history for the same workflow, and the commits
between the last green run and the failing SHA. It also checks whether a
fix has already landed after the failing SHA, since a human often fixes a
nightly hours before anyone reads the task.

This first version is deliberately read-only: the diagnosis goes to the
run summary and nowhere else. No safe-outputs are configured, so it
cannot comment, open issues or PRs, or write to Asana. The intent is to
review a week of real diagnoses before granting it any write access.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A second dry run, against a Privacy Tests failure, exposed three gaps.

The Flank instrumentation logs carry a jq'd block of Test / Failure / URL
triples and a matrix line with the pass/fail count. Without those the
agent has exception traces it cannot attribute to a test, so name them
the way the Maestro flow results are already named.

The already-fixed search needed a direction check. A candidate fix only
explains a failure away when it is not already an ancestor of the failing
SHA; when it is, the failure is a recurrence or a new symptom, which is a
more serious finding rather than a lesser one.

When a previous PR fixed one occurrence of an error signature, sibling
tests often still carry the unfixed pattern. That is the cheapest finding
to act on and it is invisible from the failure alone, so look for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review feedback from the maintenance AoR: helpful, but too much text.
The run URL, the workflow name and the release-blocking classification
are all already on the task the reader is looking at, so repeating them
was pure length. What the DRI actually wants is the likely cause, in one
line, from a bounded set: flaky test, feature-flag rollout, recent
change, infrastructure, or unclear.

The report now leads with that cause and carries only the failing test,
one error excerpt, the single fact supporting the cause, and the two
context lines worth having. Every line is droppable when it says
nothing, under a hard 12-line budget.

The per-suite E2E failure tasks are being retired to cut noise, so the
report must also stand alone as a comment on the one workflow failure
task rather than assume a suite-specific task is open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The example the team signed off on separates clauses with commas, so
match it in the template and say so explicitly, since the report is
posted where the team reads it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@malmstein
malmstein marked this pull request as ready for review August 20, 2026 15:22

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0178566. Configure here.

Comment thread .github/workflows/workflow-failure-classifier.md
Comment thread .github/workflows/workflow-failure-classifier.md
Two review findings on the trigger.

The membership gate required the actor to hold admin, maintainer or
write. This workflow is started by a scheduled nightly rather than by a
person, so relying on the inherited actor to carry a role risks silently
skipping every automatic diagnosis. It reads only same-repo, non-fork
runs on develop and writes nothing, so the gate can only cost us
legitimate runs. Drop it with roles: all, keeping the fork and
same-repository guards the compiler adds.

The trigger also had no conclusion filter, so a green nightly still
started the whole agent just to have it report that nothing failed.
Gate the activation on the run having failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants