Skip to content

Add Build Failure Analysis agentic workflow - #17125

Merged
Evangelink merged 38 commits into
dotnet:mainfrom
YuliiaKovalova:copilot/onboard-build-failure-analysis
Jul 21, 2026
Merged

Evangelink merged 38 commits into
dotnet:mainfrom
YuliiaKovalova:copilot/onboard-build-failure-analysis

Conversation

@YuliiaKovalova

@YuliiaKovalova YuliiaKovalova commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Onboards the microsoft/testfx-style Build Failure Analysis agentic (gh-aw) workflow to dotnet/arcade, adapted to reuse the binary logs from the failed Azure DevOps build instead of rebuilding.

Arcade's authoritative PR build runs on Azure DevOps (dnceng-public/public, pipeline arcade-pr, definitionId 283) and publishes each build leg's binlog as a Logs_Build_<leg> pipeline artifact. When that build's GitHub check reports failure, this workflow downloads those already-produced binlogs (anonymously — public project) and delegates to the build-failure-analyst agent, which queries them live via the containerized binlog-mcp MCP server, posts a root-cause summary comment, and attaches inline suggestion blocks.

It performs no build of its own — no ./build.sh on GitHub Actions.

Files

  • .github/workflows/build-failure-analysis.md (+ .lock.yml) — check_run: completed trigger + workflow_dispatch
  • .github/workflows/build-failure-analysis-command.md (+ .lock.yml) — /analyze-build-failure slash command
  • .github/workflows/shared/build-failure-analysis-shared.md — shared delegation prompt
  • .github/agents/build-failure-analyst.agent.md — analyst agent
  • .github/aw/actions-lock.json — action SHA pins

Key behaviors

  • Reuse, not rebuild: downloads every Logs_Build_* binlog into /data/binlogs; the agent triages all legs and focuses on the one(s) with errors (test/Helix-only failures leave build binlogs clean → it says so instead of inventing fixes).
  • No fork-PR code execution: only artifacts (data) are downloaded; nothing is checked out or run.
  • Scoped to PRs targeting main / release/*.
  • Validation: dispatch verifies the build is definition 283, failed, and belongs to the given PR; the slash command skips if the PR's latest completed build is no longer failing.
  • Source for suggestions is read via the GitHub API at the PR head SHA (the runner workspace is not the PR).

Lock files compiled with gh aw v0.77.5 (matching the repo), LF endings.

Ports the microsoft/testfx "Build Failure Analysis" gh-aw workflow to
dotnet/arcade. On every PR (and via the /analyze-build-failure slash
command) it runs ./build.sh --binaryLog; when the build fails it delegates
to the build-failure-analyst agent, which queries the binary log live
through the containerized binlog-mcp MCP server, posts a root-cause summary
comment, and attaches inline `suggestion` blocks tied to the diff.

The workflow is advisory only (does not gate the PR check) and is gated on
build failure so a green build never invokes the AI agent.

Files:
- .github/workflows/build-failure-analysis.md (+ .lock.yml)
- .github/workflows/build-failure-analysis-command.md (+ .lock.yml)
- .github/workflows/shared/build-failure-analysis-shared.md
- .github/agents/build-failure-analyst.agent.md
- .github/aw/actions-lock.json (new action SHA pins)

Adapted for arcade: pull_request branches [main, release/*], arcade
build.sh, binlog under artifacts/log, and the internal-SDK global.json
(NuGet MCP install runs from /tmp).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 15, 2026 16:06

Copilot AI 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.

Pull request overview

Introduces an agentic GitHub Actions workflow pair to run ./build.sh --binaryLog on PRs and via a /analyze-build-failure slash command, and (only on build failure) delegate binlog-driven root-cause analysis to a reusable build-failure-analyst agent via a containerized binlog-mcp MCP server.

Changes:

  • Adds PR-triggered and slash-command-triggered build-failure analysis workflows, sharing a common prompt body.
  • Adds a reusable build-failure-analyst agent definition intended to query binlogs live and post summary + inline suggestions.
  • Extends the repo’s agentic workflow action SHA pin map for core actions used by these workflows.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
.github/workflows/shared/build-failure-analysis-shared.md Shared workflow body/prompt that launches the analyst sub-agent on failures.
.github/workflows/build-failure-analysis.md PR + manual dispatch workflow wiring (build + artifact handoff + agent tooling/safe-outputs).
.github/workflows/build-failure-analysis.lock.yml Compiled/locked workflow version executed by Actions.
.github/workflows/build-failure-analysis-command.md Slash-command workflow wiring to rerun analysis on demand for a PR.
.github/workflows/build-failure-analysis-command.lock.yml Compiled/locked slash-command workflow version executed by Actions.
.github/aw/actions-lock.json Adds SHA pins for actions referenced by the new workflows.
.github/agents/build-failure-analyst.agent.md Defines the analyst agent behavior, including binlog + NuGet MCP usage and comment/suggestion output format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/aw/actions-lock.json Resolved
- Fix NuGet MCP invocation: use `NuGet.Mcp.Server` (the global tool's
  command name) instead of `dotnet NuGet.Mcp.Server`, which would resolve a
  non-existent `dotnet-NuGet.Mcp.Server` subcommand (2 places in the agent).
- Align the documented inline-suggestion cap with the workflow config
  (25, not 10).
- Drop the hard-coded `model: "claude-opus-4.6"` from the shared prompt so
  the workflow-level default model applies (robust to allowlist changes).
- Raise timeouts for Arcade's long `./build.sh`: build job 30 -> 120 min,
  agent job 30 -> 60 min (both workflows), so a slow-but-healthy build is
  not misclassified as a failure.
- SHA-pin the gh-aw setup action (github/gh-aw-actions@3ea13c02...)
  and record the setup-cli bootstrap action SHA in actions-lock.json.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 15, 2026 16:22
@YuliiaKovalova

Copy link
Copy Markdown
Member Author

Thanks for the review — addressed in 3b30e63:

  • NuGet MCP invocation (agent.md :88, :111): Changed dotnet NuGet.Mcp.Server → NuGet.Mcp.Server. The package installs a global tool whose command is NuGet.Mcp.Server (already on the bash allowlist); the dotnet-prefixed form would look for a non-existent dotnet-NuGet.Mcp.Server subcommand.

  • Inline-suggestion cap mismatch (agent.md :186): Doc now says 25, matching create-pull-request-review-comment.max: 25 in both workflows (with a note that the agent should still target ~5 issues; the higher cap only absorbs Copilot CLI retry amplification).

  • Hard-coded model (shared.md :33): Removed model: "claude-opus-4.6"; the background task now uses the workflow-level default model so it won't break if that model name isn't in the repo allowlist.

  • 30-min timeouts (*.md :62/:96, :42/:71): Build job → 120 min, agent job → 60 min in both workflows, so a slow-but-healthy Arcade ./build.sh isn't misclassified as a failure.

  • Action SHA pinning (*.lock.yml :440, actions-lock.json :7): The main setup action is now SHA-pinned as github/gh-aw-actions/setup@3ea13c02... (consistent with the existing update-default-versions.lock.yml), and I recorded the setup-cli bootstrap SHA in actions-lock.json.

    ℹ️ One caveat: github/gh-aw/actions/[email protected] (the "Install gh-aw extension" bootstrap step) is emitted by tag by the gh aw compile compiler itself and cannot currently be SHA-pinned via actions-lock.json — it's the chicken-and-egg step that installs the gh-aw CLI before the pinning machinery is available. Its resolved SHA (489dbab8...) is now recorded in the lock file for auditability. This is a gh-aw toolchain limitation; happy to follow up upstream if you'd prefer.

Lock files were regenerated with gh aw compile (v0.77.5, LF endings) — 0 errors / 0 warnings.

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

YuliiaKovalova added a commit to YuliiaKovalova/arcade that referenced this pull request Jul 15, 2026
…otnet#17125)

Do not merge. Adds an undefined-symbol reference so ./build.sh fails and the
build-failure-analysis workflow triggers the analyst agent.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
- Set `persist-credentials: false` on the build-job checkout in both
  workflows so the job token isn't written into local git config while
  ./build.sh runs checked-out PR contents.
- Disable errexit (`set +e`) in the "Build with binary log" step so the
  explicit `exit "${PIPESTATUS[0]}"` always runs and we key off build.sh's
  real exit code rather than tee's / an early -e abort.
- Relax the "Locate binlog" step (`set +e; set +o pipefail`) so a missing
  artifacts/log directory (very early build failure) can't fail the find
  pipeline and turn this advisory workflow red.

Lock files regenerated with `gh aw compile` (v0.77.5, LF), 0 errors/warnings.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 15, 2026 16:37
YuliiaKovalova added a commit to YuliiaKovalova/arcade that referenced this pull request Jul 15, 2026
…otnet#17125)

Do not merge. Adds an undefined-symbol reference so ./build.sh fails and the
build-failure-analysis workflow triggers the analyst agent.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
@YuliiaKovalova

Copy link
Copy Markdown
Member Author

Addressed the second review round in 70d2076:

  • Checkout token exposure (build-failure-analysis.md, build-failure-analysis-command.md): Added persist-credentials: false to the build-job checkout in both workflows so the job token isn't written into local git config while ./build.sh runs checked-out PR contents.
  • errexit defeats the explicit exit-code logic (build step, both workflows): Added set +e before the ./build.sh … | tee pipeline so a failed build no longer aborts the step before exit "${PIPESTATUS[0]}"; nounset + pipefail are kept so we still read build.sh's real exit code (not tee's).
  • find can turn the advisory run red (Locate binlog step, both workflows): Added set +e; set +o pipefail so a missing artifacts/log directory (very early build failure) can't fail the find pipeline; the "no binlog" case is still handled explicitly.

Lock files regenerated with gh aw compile (v0.77.5, LF) — 0 errors / 0 warnings.

I'm also validating end-to-end on my fork: an intra-fork PR introduces a deliberate CS0103 so ./build.sh fails and the analyst runs against the fixed workflow.

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

- Include `inputs.pr-number` in the concurrency group so dispatching
  analyses for different PRs on the same ref no longer cancel each other.
- On `workflow_dispatch` with `pr-number`, check out that PR's merge ref in
  the build job so the analysed binlog matches the PR being commented on
  (pull_request events keep the default checkout).
- Command workflow: add a "Check PR origin" guard and gate the checkout /
  build / locate-binlog steps on it, so `/analyze-build-failure` never
  builds untrusted fork-PR code in the base-repo context. A skipped build
  reports `skipped` (not `failure`), so the analyst pipeline stays inert
  for fork PRs.

Permissions were intentionally left as `pull-requests: read` on the agent
job: gh-aw applies safe-outputs from a separate job that the compiler grants
`issues: write` + `pull-requests: write` (verified in the lock), keeping the
agent job least-privilege.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 15, 2026 16:55
@YuliiaKovalova

Copy link
Copy Markdown
Member Author

Third review round — addressed in cae53c5:

Fixed

  • Concurrency scoping (build-failure-analysis.md): added inputs.pr-number to the group key so workflow_dispatch analyses for different PRs on the same ref no longer cancel each other.
  • Dispatch checkout mismatch (build-failure-analysis.md): when dispatched with pr-number, the build job now checks out refs/pull/<n>/merge, so the analysed binlog matches the PR being commented on. pull_request events keep the default merge-ref checkout.
  • Fork-PR code execution (build-failure-analysis-command.md): added a Check PR origin step and gated the checkout / build / locate-binlog steps on same-repo == 'true'. /analyze-build-failure no longer builds untrusted fork-PR code in the base-repo context. A skipped build reports skipped (not failure), so the analyst pipeline stays inert for fork PRs — which also covers the "skipped checkout would fail the build" follow-up.

Not changed (by design)

  • pull-requests: read permissions: this is intentional and least-privilege. gh-aw runs the AI agent read-only and applies safe-outputs from a separate safe_outputs job that the compiler grants issues: write + pull-requests: write (visible in the generated *.lock.yml). The end-to-end validation on my fork confirms the summary comment and inline suggestions post correctly with these permissions; widening the agent job's scope would reduce security without changing behavior.
  • setup-cli pinned by tag (*.lock.yml manifest): github/gh-aw/actions/[email protected] is gh-aw's CLI-bootstrap action, emitted by tag by the gh aw compile compiler itself — it installs the gh-aw CLI before the lock-based pinning machinery is available, so it can't currently be SHA-pinned via actions-lock.json (its resolved SHA 489dbab8... is recorded there for auditability). The main github/gh-aw-actions/setup action is fully SHA-pinned. This is an upstream gh-aw limitation; happy to file an issue there.

Lock files regenerated with gh aw compile (v0.77.5, LF) — 0 errors / 0 warnings. Re-validating end-to-end on my fork with the updated workflow.

YuliiaKovalova added a commit to YuliiaKovalova/arcade that referenced this pull request Jul 15, 2026
…otnet#17125)

Do not merge. Adds an undefined-symbol reference so ./build.sh fails and the
build-failure-analysis workflow triggers the analyst agent.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

The slash-command workflow compiles into a workflow_dispatch entrypoint, so
event-payload fields aren't populated the way the source frontmatter assumed:

- Build job now also requests `pull-requests: read` so the `Check PR origin`
  step's `gh api .../pulls/<n>` call has the scope it needs (the job-level
  permissions block otherwise narrows the token to `contents: read`).
- Concurrency group falls back to the PR/issue number carried in
  `aw_context` (and finally `github.run_id`) instead of relying solely on
  `github.event.issue.number`, which is unset under workflow_dispatch and
  would otherwise collapse all command runs into one group and cancel each
  other.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 15, 2026 17:12
@YuliiaKovalova

Copy link
Copy Markdown
Member Author

Fourth review round — addressed in 6bcb932 (both specific to the command workflow, which compiles into a workflow_dispatch entrypoint):

  • Build-job token scope: the Check PR origin step calls gh api .../pulls/<n>, but the job-level permissions block narrowed the token to contents: read. Added pull-requests: read to the build job so the fork-check can read the PR.
  • Concurrency collapse under workflow_dispatch: github.event.issue.number is unset for the dispatched entrypoint, so the group degraded to build-failure-analysis- for every run (mutual cancellation). The group now falls back to the PR/issue number in aw_context (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) and finally github.run_id, matching gh-aw's own number-resolution pattern.

Recompiled with gh aw compile (v0.77.5, LF) — 0 errors / 0 warnings.

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

The "build failed but no binlog" fallback template wrapped
`<!-- build-failure-analysis -->` in backticks, so the agent would post it
as inline code rather than a real HTML comment — breaking marker detection
for `hide-older-comments`. Emit it as a raw HTML comment, matching the
Step 5 summary template.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 17, 2026 13:24

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

.github/aw/actions-lock.json:32

  • The new lock workflows were compiled with gh-aw v0.82.8 and pin github/gh-aw-actions/[email protected], but .github/aw/actions-lock.json only pins v0.77.5 today. If the repo expects actions-lock.json to cover every pinned action version used by workflows, add the v0.82.8 entry (or recompile lock files to match the repo’s pinned gh-aw version).
    "github/gh-aw-actions/[email protected]": {
      "repo": "github/gh-aw-actions/setup",
      "version": "v0.77.5",
      "sha": "3ea13c02d765410340d533515cb31a7eef2baaf0"
    }

Comment thread .github/aw/actions-lock.json Resolved
…inlogs

Validation showed the newer gh-aw runtime mounts binlog-mcp as a CLI wrapper
(.../mcp-cli/bin/binlog-mcp) and connects it, but only the native MCP tool was
allowlisted; when the agent invoked the wrapper via the shell it was denied,
so no binlog could be read. Add shell(binlog-mcp:*) to the bash allowlist and
document both invocation forms (native MCP tool or CLI wrapper) in the prompt
and playbook.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 17, 2026 13:42

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

.github/aw/actions-lock.json:32

  • This actions lock file is missing entries for action versions introduced by the new build-failure-analysis workflows (e.g., actions/[email protected], actions/cache/*@v6.1.0, and github/gh-aw-actions/[email protected]). Without these, gh aw compile will be unable to resolve/pin the actions consistently (or will rewrite this file during compilation).
    "github/gh-aw-actions/[email protected]": {
      "repo": "github/gh-aw-actions/setup",
      "version": "v0.77.5",
      "sha": "3ea13c02d765410340d533515cb31a7eef2baaf0"
    }

Same fix as the auto workflow: add shell(binlog-mcp:*) so the slash-command
agent can query the binlogs via the mounted CLI wrapper.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 17, 2026 13:53

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

.github/aw/actions-lock.json:32

  • The new lock workflows were generated with github/gh-aw-actions/[email protected] (sha 99d9d8...), but .github/aw/actions-lock.json only pins @v0.77.5. Add the v0.82.8 entry so action resolution remains reproducible when recompiling workflows.
    "github/gh-aw-actions/[email protected]": {
      "repo": "github/gh-aw-actions/setup",
      "version": "v0.77.5",
      "sha": "3ea13c02d765410340d533515cb31a7eef2baaf0"
    }

Comment thread .github/aw/actions-lock.json Resolved
The lock files had been regenerated with gh-aw v0.82.8, which pinned newer
runtime containers (gh-aw-mcpg v0.4.1, github-mcp-server v1.5.0) and actions
([email protected], [email protected]) inconsistent with dotnet/arcade's standard
v0.77.5 (see update-default-versions.lock.yml) and with .github/aw/actions-lock.json.
Recompiling with v0.77.5 restores [email protected] (present in actions-lock.json),
the v0.3.22 MCP gateway runtime (which exposes the containerized binlog-mcp
tools natively to Copilot), and a matching compiler_version. The binlog-mcp
CLI-wrapper allowlist is kept as a harmless fallback.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 17, 2026 14:11

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

The size-listing (unzip -l) and the entry-path traversal pre-scan (unzip -Z1)
ran on untrusted PR-produced archives without a timeout, so a hostile/huge
zip could hang the runner during listing. Worse, the traversal check piped
unzip -Z1 straight into grep, so if the listing errored or hung the grep saw
empty output, matched nothing, and extraction proceeded (fail-open).

- Wrap unzip -l with `timeout 60`; a timeout yields empty output that the
  existing numeric check rejects (skip).
- Capture unzip -Z1 under `timeout 60` into a variable, check its exit code,
  and skip the artifact (fail closed) on any error/timeout before grepping
  the captured entries for absolute/.. paths.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a
Copilot AI review requested due to automatic review settings July 20, 2026 08:10

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

The prior traversal check captured the full `unzip -Z1` output into a shell
variable (`entries=...`), which buffers every entry name in memory — a DoS
vector for an archive with very many entries even when the byte caps hold.
Stream the listing through `grep` under `timeout` instead, and use PIPESTATUS
to keep the fail-closed behavior: PIPESTATUS[0] (unzip/timeout) non-zero =>
listing error/timeout => skip; PIPESTATUS[1] (grep) == 0 => suspicious
absolute/.. path => skip; otherwise clean.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d7b11dbc-6cf1-440c-a28a-dfcc5ddff35a

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

.github/workflows/build-failure-analysis.md:23

  • The workflow header says the analysis pipeline “only downloads build artifacts (data)” and “does not build or execute PR code”, but it also performs an actions/checkout of the repository to load agent/workflow configuration. This is fine, but the wording can read as “no checkout occurs” (which also conflicts with the PR description). Consider tightening the wording here to explicitly distinguish “no PR code build/exec” from “repo checkout for workflow config.”
# only downloads build artifacts (data) and reads them — it does **not** build
# or execute PR code. (gh-aw's generated agent job **does** check out the
# repository — via `actions/checkout` — to load the workflow's own agent
# configuration; that checkout is for tooling only and uses the event's ref,
# **not** the PR head, so no PR code is built or executed.)

@YuliiaKovalova

Copy link
Copy Markdown
Member Author

@Evangelink please take a look

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

.github/workflows/build-failure-analysis-command.md:76

  • The fetch-binlog bash implementation (ADO validation + artifact download + zip-bomb guards + binlog extraction) is effectively duplicated between build-failure-analysis.md and build-failure-analysis-command.md. This duplication is likely to drift over time and makes future security/bug fixes harder to apply consistently. Consider extracting the shared logic into a single script in-repo (e.g. .github/scripts/fetch-ado-binlogs.sh) that both workflows invoke.
# Custom job that reuses the binlogs from the PR's most recent failed Azure
# DevOps `arcade-pr` build instead of rebuilding. Mirrors the fetch-binlog job
# in build-failure-analysis.md; it locates the build by the PR's merge branch
# (no `check_run` payload is available on a slash command).

Evangelink
Evangelink previously approved these changes Jul 21, 2026
When the gh api .../pulls/<n> call fails or returns no data (rate limit /
transient error), BASE_REF became empty and fell into the scope case's
*) branch, logging the PR as base '' "out of scope" and silently skipping
a valid PR for the wrong reason. Add an explicit empty-BASE_REF guard in
both the check_run workflow and the /analyze-build-failure command so
API/data-resolution failures are reported as such via emit_none. Lock files
recompiled with gh aw v0.77.5.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d22ca9be-7363-4a23-a0aa-ec1d38886fab

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

.github/workflows/build-failure-analysis.md:318

  • The uncompressed-size guard relies on parsing the last line of unzip -l output, but if timeout kills unzip the output can be partial and still end with a numeric first column (e.g., a file entry), which would undercount UNCOMP and allow a large/zip-bomb archive to reach extraction. Capture a failing unzip -l/timeout exit status (via a subshell with pipefail) and fail closed before trusting UNCOMP.
            UNCOMP=$(timeout 60 unzip -l /tmp/a.zip 2>/dev/null | tail -1 | awk '{print $1}')
            # Fail safe: if the uncompressed size isn't a plain integer (corrupt
            # zip / unexpected or timed-out `unzip -l` output), we can't verify
            # it — skip the artifact rather than let a non-numeric value bypass
            # the `-gt` guard.

.github/workflows/build-failure-analysis-command.md:242

  • Same issue as the auto-trigger workflow: if timeout kills unzip -l, the output can be partial but still parse as a numeric UNCOMP, defeating the zip-bomb/uncompressed-size guard. Fail closed by checking the unzip -l/timeout exit status (e.g., via a subshell with pipefail) before trusting the parsed value.
            UNCOMP=$(timeout 60 unzip -l /tmp/a.zip 2>/dev/null | tail -1 | awk '{print $1}')
            # Fail safe: if the uncompressed size isn't a plain integer (corrupt
            # zip / unexpected or timed-out `unzip -l` output), we can't verify
            # it — skip the artifact rather than let a non-numeric value bypass
            # the `-gt` guard.

If `timeout` killed `unzip -l` mid-listing, its partial output could still
end in a numeric first column, so `tail -1 | awk '{print \}'` would parse a
per-entry size instead of the archive total and undercount UNCOMP — letting an
oversized/zip-bomb archive slip past the size guard. Run the listing pipeline
in a subshell with `pipefail` and skip the artifact on any non-zero exit
(error/timeout), rather than trusting the parsed value. Applied to both the
check_run workflow and the /analyze-build-failure command; lock files
recompiled with gh aw v0.77.5.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d22ca9be-7363-4a23-a0aa-ec1d38886fab

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

.github/workflows/build-failure-analysis-command.md:76

  • The fetch-binlog implementation (download + zip guards + extraction + staleness checks) is duplicated between build-failure-analysis.md and build-failure-analysis-command.md. Keeping these large scripts in sync will be error-prone (e.g., security guard tweaks or API changes will likely be applied to one workflow but missed in the other). Consider factoring the shared logic into a single reusable script/composite action and calling it from both workflows, leaving only trigger-specific bits (build-id resolution vs PR-latest-build query) in each file.
# Custom job that reuses the binlogs from the PR's most recent failed Azure
# DevOps `arcade-pr` build instead of rebuilding. Mirrors the fetch-binlog job
# in build-failure-analysis.md; it locates the build by the PR's merge branch
# (no `check_run` payload is available on a slash command).

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