Triage CI Failure into a GitHub Issue
Investigate a failing GitHub Actions job, extract the root cause, and file a
well-structured bug issue against NVIDIA/Megatron-LM.
Workflow
1. Parse the URL
The argument is a GitHub Actions URL. It will be one of:
- Job URL:
https://github.com/<owner>/<repo>/actions/runs/<run_id>/job/<job_id> - Run URL:
https://github.com/<owner>/<repo>/actions/runs/<run_id>
Extract run_id and, if present, job_id.
2. Identify failed jobs
-
If a
job_idwas provided, use that job directly. -
If only a
run_idwas provided, list all failed jobs in the run:If multiple jobs failed, ask the user which one to triage, or triage all of them if they say so.
3. Fetch the failure logs
For each failed job, retrieve the logs and narrow them down to the failure:
Also capture the full job name:
If the grep output is sparse, download the full logs and look for the pytest
FAILURES section or the last non-zero exit signal.
4. Resolve the triggering PR and test author
Triggering PR: the run's head branch follows the pattern pull-request/<number>.
Extract it and resolve the PR:
Test file author: find the GitHub login of whoever last touched the failing
test file. The file may not exist on main — first determine the PR's base
branch, then search from there:
If the result is empty (file was introduced by the PR itself), query the PR's commits instead:
As a last resort, list the PR commits and pick the author of the commit whose message most closely relates to the failing test file.
5. Extract the root cause
From the logs, identify:
- Failed test(s): lines matching
FAILED tests/...::...give the exact pytest node IDs. - Error message: the assertion failure, exception type, or first meaningful traceback frame — keep it under ~30 lines.
- Job name: the GitHub Actions job name (e.g.
tests/unit_tests/transformer/moe/**/*.py - latest). - Run / job URLs and PR URL: for linking in the issue.
6. Check for duplicate issues
Search for open issues that already cover the same test:
- If a matching open issue exists, do not create a new one. Report the existing issue to the user and stop.
- If no match is found, proceed to file a new issue.
7. Create the issue
Pass --assignee <test-author-login> to assign the issue to the test file's
author. Include the triggering PR URL in the issue body.
Use the bug-report template body structure:
<core error message / traceback — 30 lines max>
Additional context
Triaged automatically via /triage-issue.


