[Github Agent] add prFiles and prFailedChecks read actions - #2974
Open
George Ng (GeorgeNgMsft) wants to merge 1 commit into
Open
[Github Agent] add prFiles and prFailedChecks read actions#2974George Ng (GeorgeNgMsft) wants to merge 1 commit into
George Ng (GeorgeNgMsft) wants to merge 1 commit into
Conversation
George Ng (GeorgeNgMsft)
enabled auto-merge
September 4, 2026 06:16
Collaborator
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>
robgruen
approved these changes
Sep 4, 2026
| try { | ||
| const { stdout, stderr } = await execFileAsync("gh", args, { | ||
| timeout: timeoutMs, | ||
| maxBuffer: 8 * 1024 * 1024, |
Collaborator
There was a problem hiding this comment.
maybe a comment here on why we are doing 8MB
| number | ||
| } | ||
| } | ||
| | what files does PR $(number:number) change -> { |
Collaborator
There was a problem hiding this comment.
"change", "touch", "edit", "modify"
| number | ||
| } | ||
| } | ||
| | show files changed in PR $(number:number) in $(repo:wildcard) -> { |
Collaborator
There was a problem hiding this comment.
"show what's changed in ...."
| number | ||
| } | ||
| } | ||
| | why is CI failing on PR $(number:number) -> { |
| // patches are large; turn it on to see the actual code changes. | ||
| includePatch?: boolean; | ||
|
|
||
| // How many files to return, newest API order. 1-300, default 50. |
Collaborator
There was a problem hiding this comment.
is 50 the default that comes out of the tool itself? If so no need to change...if you want it to be 50 then you could define: maxFiles: number | 50;
George Ng (GeorgeNgMsft)
force-pushed
the
georgengmsft-github-pr-diagnostics
branch
from
September 4, 2026 06:33
0f46d17 to
2f14903
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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-cliagent 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 runningghby hand.This adds two read-only actions that answer those two questions directly.
prFileslists the files a pull request changes, with each file's status and line counts, and optionally a short excerpt of each file's diff.prFailedChecksexplains 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.Highlights:
gh, parse its JSON, and return a stablerawDatapayload. No reasoning step is involved, so an external MCP client can discover and call them on its own.--jq, so listing the files of a large PR doesn't download its whole diff.repoto use the current checkout, or pass anOWNER/REPOslug — or just the pull request's web link, whichgh --repoitself rejects. The host is carried through, so GitHub Enterprise links work too.Tests cover argument construction, JSON parsing and structured results, repo/link normalization, pagination and truncation boundaries, grammar, and the error paths.