Skip to content

[Github Agent] add prFiles and prFailedChecks read actions - #2974

Merged
George Ng (GeorgeNgMsft) merged 4 commits into
mainfrom
georgengmsft-github-pr-diagnostics
Sep 4, 2026
Merged

[Github Agent] add prFiles and prFailedChecks read actions#2974
George Ng (GeorgeNgMsft) merged 4 commits into
mainfrom
georgengmsft-github-pr-diagnostics

Conversation

@GeorgeNgMsft

@GeorgeNgMsft George Ng (GeorgeNgMsft) commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

When a pull request is failing, you usually need two things before you can say anything useful about it: what the PR actually changed, and what the red checks are complaining about. Today the github-cli agent can tell you a PR exists and that its checks are red, but not much more, so answering either question means leaving the agent and running gh by hand.

This adds two read-only actions that answer those two questions directly.

prFiles lists the files a pull request changes, with each file's status and line counts, and optionally a short excerpt of each file's diff.

image

prFailedChecks explains why the checks are red. For each failing check it reports the workflow, timing, and a link, plus the error annotations GitHub recorded against it — usually the actual compiler or test error, with its file and line.

image

Highlights:

  • Deterministic fast actions. Both are typed, read-only, and handled directly: they run gh, parse its JSON, and return a stable rawData payload. No reasoning step is involved, so an external MCP client can discover and call them on its own.
  • Bounded output, honestly labelled. File counts, patch sizes, check counts, and annotation counts all have caps, and every result says explicitly what got truncated instead of quietly dropping it.
  • Diffs are opt-in. When patches aren't requested, they're stripped server-side via --jq, so listing the files of a large PR doesn't download its whole diff.
  • Works on other repos, including by link. Omit repo to use the current checkout, or pass an OWNER/REPO slug — or just the pull request's web link, which gh --repo itself rejects. The host is carried through, so GitHub Enterprise links work too.
  • Degrades instead of failing. Missing logs, in-progress checks, checks from non-GitHub providers, forks, and permission errors each produce a clear partial result and a hint, rather than an error.
  • Natural language too. Grammar rules are added so phrases like "what files did PR 123 change" and "why is PR 123 failing" work, but they're additive — the actions stand on their own.

Tests cover argument construction, JSON parsing and structured results, repo/link normalization, pagination and truncation boundaries, grammar, and the error paths.

@GeorgeNgMsft George Ng (GeorgeNgMsft) changed the title github-cli: add prFiles and prFailedChecks read actions [Github-CLI] add prFiles and prFailedChecks read actions Sep 4, 2026
@GeorgeNgMsft George Ng (GeorgeNgMsft) changed the title [Github-CLI] add prFiles and prFailedChecks read actions [Github Agent] add prFiles and prFailedChecks read actions Sep 4, 2026
@robgruen

robgruen commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

If you're in here adding fun features I would ask you to add "review PR for me" and "investigate PR failure" and variations thereof. (although the latter requires copilot cli).

Image Image

Two read-only actions for diagnosing a pull request without leaving the
agent:

- `prFiles` lists the files a PR changes, with per-file status and line
  counts, and optionally a bounded excerpt of each file's diff.
- `prFailedChecks` explains why a PR's checks are red, pairing each failing
  check with the error annotations GitHub recorded for it.

Both are deterministic fast actions: they shell out to `gh`, parse its JSON,
and return a typed `rawData` payload, so an external MCP client can select
and call them directly with no reasoning step. Output is bounded and every
result states explicitly what was truncated.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread ts/packages/agents/github-cli/src/github-cliActionHandler.ts
Comment thread ts/packages/agents/github-cli/src/github-cliSchema.agr Outdated
Comment thread ts/packages/agents/github-cli/src/github-cliSchema.agr
Comment thread ts/packages/agents/github-cli/src/github-cliSchema.agr Outdated
Comment thread ts/packages/agents/github-cli/src/github-cliSchema.ts Outdated
@GeorgeNgMsft
George Ng (GeorgeNgMsft) force-pushed the georgengmsft-github-pr-diagnostics branch from 0f46d17 to 2f14903 Compare September 4, 2026 06:33
@GeorgeNgMsft

Copy link
Copy Markdown
Contributor Author

If you're in here adding fun features I would ask you to add "review PR for me" and "investigate PR failure" and variations thereof. (although the latter requires copilot cli).

Image Image

I can add this in a follow up PR later on, but right now I'm generally covering common Git related actions that are deterministic with no model dependency. Trying to make sure our list of useful fast actions is well curated for the average dev scenario.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@GeorgeNgMsft
George Ng (GeorgeNgMsft) added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 1d56d20 Sep 4, 2026
27 checks passed
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