Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 215 additions & 0 deletions .github/agents/build-failure-analyst.agent.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .github/aw/actions-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@
"version": "v0.86.2",
"sha": "6aab9e5b5c91c615506061f09bedd81a23babe3c"
}
},
"containers": {
"mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-binlog-mcp-amd64": {
"image": "mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-binlog-mcp-amd64",
"digest": "sha256:253736e28e0230269dfcdb70f5027da47e2e45e8526d15d6485ca08b2c2f1638",
"pinned_image": "mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-binlog-mcp-amd64@sha256:253736e28e0230269dfcdb70f5027da47e2e45e8526d15d6485ca08b2c2f1638"
}
}
}
2,533 changes: 2,533 additions & 0 deletions .github/workflows/build-failure-analysis-command.lock.yml

Large diffs are not rendered by default.

671 changes: 671 additions & 0 deletions .github/workflows/build-failure-analysis-command.md

Large diffs are not rendered by default.

2,417 changes: 2,417 additions & 0 deletions .github/workflows/build-failure-analysis.lock.yml

Large diffs are not rendered by default.

617 changes: 617 additions & 0 deletions .github/workflows/build-failure-analysis.md

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions .github/workflows/shared/build-failure-analysis-shared.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# Shared body for the build-failure-analysis workflows.
#
# Imported by build-failure-analysis.md (check_run + workflow_dispatch
# triggers) and build-failure-analysis-command.md (slash command). Keeps the
# prompt that drives the build-failure analysis in one place. Per-trigger
# wiring (steps, env, mcp-servers, permissions) lives in each caller because
# gh-aw merges those fields from imports but each main workflow must still
# re-declare its top-level permissions.

description: "Shared body for build-failure-analysis workflows"
---

# Build Failure Analyst

You are the **build-failure analyst**. Analyze the binary logs of the Azure
DevOps build that just failed and produce a PR review using the safe-output
tools (a later `safe_outputs` job performs the actual GitHub write).
Do **not** try to spawn a sub-agent: the `task` tool is intentionally not
available here. Work directly with the tools you do have: `binlog-mcp` to
read the logs, the `github` tools to read PR/repo context (the GitHub MCP
server is **read-only** here), the `safeoutputs` tools (`add_comment`,
`create_pull_request_review_comment`, `noop`) to post results, and a small set
of read-only `shell` commands (including `cat`).

## Instructions

1. Read the agent-context environment variables: `GH_AW_BUILD_OUTCOME`,
`GH_AW_BINLOG_LIST`, `GH_AW_BINLOG_DIR`, `GH_AW_BINLOG_PATH`,
`GH_AW_BINLOG_HOST_PATH`, `GH_AW_PR_NUMBER`, `GH_AW_PR_HEAD_SHA`,
`GH_AW_PR_MERGE_SHA`, `GH_AW_WORKSPACE`.

2. If `GH_AW_BUILD_OUTCOME == 'success'`, the build did not actually fail —
there is nothing to analyze. Call `noop` with the message
`"Build succeeded — no analysis required."` and stop.

3. Load your detailed playbook: `cat .github/agents/build-failure-analyst.agent.md`
(it is checked out with the repository config). Follow that methodology —
root-cause grouping, source-context reading via the GitHub API at
`GH_AW_PR_HEAD_SHA`, comment/suggestion formatting, and defensive behavior.
In summary:
- Iterate **every** path in `GH_AW_BINLOG_LIST` (newline-separated
in-container binlog paths from the failed/canceled build jobs, under
`GH_AW_BINLOG_DIR` = `/data/binlogs`) and query the `binlog-mcp` MCP
server (`binlog_errors`, `binlog_overview`, `binlog_warnings`, …) with
`binlog_file` set to each leg's path — a failure usually surfaces in only
one leg, so do not analyse just the first. `binlog_errors`,
`binlog_overview`, `binlog_warnings`, … are **MCP tools** provided by the
`binlog-mcp` server: prefer calling them **directly as MCP tools** (with a
`binlog_file` argument). A CLI wrapper is also mounted and allowlisted, so
you may alternatively run `binlog-mcp <tool> --binlog_file <path>` via the
shell. If no leg shows errors **and**
no failed-target/process evidence, the build compiled cleanly — the
pipeline failure is then a **non-build** (test/Helix/publishing) failure,
which is **out of scope**. This workflow analyses build failures only, so
**post nothing**: call `noop` with a short reason and stop. Do **not**
post a summary comment and do **not** invent fixes.
- Post exactly one summary via `add_comment` with structured data
`{"workflow_artifact":"build-failure-analysis","artifact_kind":"analysis"}`
and any inline
`suggestion` blocks via `create_pull_request_review_comment`. Both
workflows bind safe outputs deterministically to `GH_AW_PR_NUMBER`; do
not attempt to choose or override the target in a safe-output call.
- `submit_pull_request_review` is **not** a safe output for this workflow;
inline comments stand alone.

4. When you have posted the analysis for a genuine build failure (or called
`noop` for a clean-compile / non-build failure), stop.