The Unit tests check on an agent-authored pull request is red. Its last visible line is a setup message, and the agent says the patch is ready. Before you rerun failed GitHub Actions jobs, find out whether the run is still active, whether the available logs explain the failure, and whether the run belongs to the revision you are reviewing. Those checks tell you whether to wait, retry once, or send the patch back for a fix.
This guide is for the maintainer making that call. Use an authenticated GitHub CLI and a disposable GitHub repository with an existing CI workflow that only builds and tests. You need repository read access to inspect run history and a maintainer with repository write access to perform the rerun or cancellation. Use the read commands together and issue each state-changing command separately after checking its prerequisites. The worked case and its outcomes are illustrative. No example commands were executed for this article. GitHub workflow run history · GitHub rerun permissions and behavior
Identify the failed attempt and the PR head
- Open the PR’s checks and identify the workflow that owns Unit tests. Follow the check link to the Actions run and record the run ID. Use the repository containing that workflow for the run commands.
- Read the current PR head and the workflow run snapshot. Record the run ID, attempt, full head SHA, status, and conclusion before opening logs.
- Confirm that the check belongs to the PR revision you intend to review. In this exercise the workflow run’s
headShamatches the PR’sheadRefOid. If your workflow reports a different revision, establish the check’s association with the current PR before proceeding, including whether the workflow uses a merge revision.
The example is task:actions-retry-01 in example-maintainer/ci-retry-lab, PR 42, with workflow CI and run ID 12345. The workflow builds and tests a small parser. Its independent Build job passed. Unit tests is the only failed job, and no job depends on it. That makes the set of jobs eligible for the failed-jobs rerun easy to predict. Substitute your authorized disposable repository, PR number, and run ID. Verify the repository and check link before acting. Keep the same shell open for the remaining blocks so the variables refer to the same case.
repo='example-maintainer/ci-retry-lab'
pr=42
run=12345
gh pr checks "$pr" --repo "$repo" --json name,workflow,bucket,link
gh pr view "$pr" --repo "$repo" --json number,headRefOid,url
gh run view "$run" --repo "$repo" --json databaseId,attempt,headSha,status,conclusion,workflowName,url
The first command gives you the workflow, check name, and link together. Use all three when a PR has several checks with similar names. The check’s bucket summarizes its state as pass, fail, pending, skipping, or cancel. Open the link for the check you are investigating and compare its run with the run view output. The PR view’s headRefOid is the branch-head value you can reread when a teammate or agent pushes. Record the run response’s databaseId and keep the full SHA so another maintainer can compare it directly. GitHub CLI PR checks · GitHub CLI PR view · GitHub CLI run view
In the main example, the PR head and run head SHA are both a1b2c3d4e5f678901234567890abcdef1234567890. The run reports databaseId 12345, attempt 1, status completed, and conclusion failure. Status describes whether the run has finished. Conclusion describes the outcome once it finishes. Keep them together. An active run can already contain a failed job while other work is underway, so use the run’s own status before choosing a branch below. If the checks query returns an error or the expected check is missing, verify the PR number and open the PR in the browser before using a run found elsewhere.
The attempt number matters because a single run ID can refer to successive executions. The unpinned snapshot helps you find the latest attempt. Once you have recorded its number, use that number when reading the corresponding job list and logs. If a second maintainer reruns the workflow while you are opening its details, you can still judge the original failure against attempt 1. A separate latest snapshot then tells you whether a newer attempt exists. The workflow run history page also lets you select a previous attempt from its Latest dropdown. GitHub rerun history
Read the logs and decide whether to wait, fix, or retry
- If the run is active, watch it or return for a fresh snapshot. Hold the rerun decision until the run finishes.
- For a completed failure, list the jobs for the recorded attempt and read its failed steps. Locate the step that explains the failure.
- If useful lines are missing, open the workflow in the browser and select the same attempt. Keep the cause unresolved while the available evidence is incomplete.
- Choose the response that addresses the evidence. Investigate a concrete assertion, or consider one retry when a transient setup error has cleared and the jobs are safe to repeat.
For the active branch, use the watcher below on this one run, then reread the metadata command from the previous section. --compact shows relevant and failed steps. The GitHub CLI manual says gh run watch does not support fine-grained personal access tokens. If that limitation applies, use the browser or return for another gh run view snapshot. If you need to wait for several workflows or reviews across a PR, see the guide to waiting for check-suite and review events. GitHub CLI run watch · Wait for PR reviews and check suites
gh run watch "$run" --repo "$repo" --compact
For the completed branch, use the recorded attempt number. The first command gives you the attempt and job list to compare with the workflow result. The second retrieves failed-step logs for that attempt. If the excerpt lacks the setup context, use the full-attempt log command and locate the matching job and step. In this example, Unit tests is the job and Install dependencies is the step to inspect. GitHub CLI run view
gh run view "$run" --repo "$repo" --attempt 1 --json attempt,jobs
gh run view "$run" --repo "$repo" --attempt 1 --log-failed
# Use this when the failed-step excerpt lacks context.
gh run view "$run" --repo "$repo" --attempt 1 --log
An empty excerpt leaves the cause open. A log retrieval error tells you the command could not supply the evidence. The CLI documents that some lines can appear under UNKNOWN STEP when it cannot associate them with a step. It may also fall back to fetching job logs individually if it cannot match jobs to logs in the archive. That fallback is slower and fails if more than 25 job logs are missing. Use the job summary to identify the failed job, then inspect the selected attempt in the browser and expand that job if the CLI cannot show lines you can attribute. If both views lack evidence, record the known conclusion, the affected job, and the missing output so the next check can start there. GitHub CLI log caveats · GitHub workflow run history
A service update can explain why waiting for logs is reasonable. On December 4, 2026, GitHub Status reported at 01:37 UTC that services had recovered and warned that Actions logs could still be stale while a backlog was processed. GitHub posted the resolution at 02:30 UTC. The earlier 01:00 UTC post announced an investigation into degraded Actions performance. The chart measures the intervals between those posts. Use the timeline as context for missing output and establish the cause of your failure from the run’s own job and step records. GitHub Status incident with Actions

In the illustrative retry branch, attempt 1’s Unit tests job fails in Install dependencies. Once its logs are available, the step identifies a temporary upstream HTTP 503 while downloading a dependency. Run parser tests never begins. For this case, assume the maintainer confirms the dependency service has recovered. In your run, identify the service named by the failing step and look for a recovery update from that service or confirmation from its owner. A setup error can justify a retry when the test was interrupted before it ran and the condition that interrupted it has cleared. A missing dependency version or a recurring download error calls for investigation of the dependency setup.
In the illustrative code-fix branch, installation succeeds and Run parser tests reports that parse_quantity("0") returned None when the test expects 0. Check the contract for zero quantities and ask the patch author to correct the parser if the assertion expresses that contract. Keep the assertion in place and review the behavior on the revised commit. Give the author the test name, input, expected and actual values, and the original SHA. That describes a defect the author can reproduce and gives the reviewer a specific behavior to verify when the new check finishes. CI Failure to Fix
Rerun failed jobs once and verify the new attempt
- Read the workflow at the revision you are rerunning. Confirm that the failed jobs and any jobs depending on them are safe to repeat. In the example the eligible work installs dependencies and runs tests in CI.
- Reread the latest run snapshot and PR head. Proceed only if the latest run is still the failed attempt you diagnosed and the check still applies to the PR revision under review. Coordinate with anyone already handling that run.
- Have the maintainer with write access issue the single rerun command. Read the latest run snapshot again and look for attempt 2 under the same run ID and head SHA.
- After attempt 2 finishes, read its pinned summary and job list. Check the outcome of Unit tests and then reread the PR head and checks before recording the result.
GitHub keeps the original event’s GITHUB_SHA and GITHUB_REF for a rerun and uses the privileges of the actor who initially triggered the workflow. The maintainer’s write access authorizes the rerun. Assess the execution using the original workflow’s permissions and behavior. Jobs depending on the failed jobs rerun, and jobs outside the rerun keep their previous outputs for use by newly run jobs. Trace those downstream jobs before issuing the command. If the eligible work can deploy, publish, or write to shared systems, this build-and-test example no longer covers the rerun. For run 12345, Build is independent and had already passed. Expect new execution of Unit tests and attribute the Build result to attempt 1. GitHub Docs on workflow and job reruns
# Read both snapshots just before deciding whether to rerun.
gh pr view "$pr" --repo "$repo" --json number,headRefOid,url
gh run view "$run" --repo "$repo" --json databaseId,attempt,headSha,status,conclusion
In the main case, the PR head still matches the baseline and the run still reports attempt 1, completed, and failure. A newer attempt means the evidence you read is historical, so inspect the newer attempt before deciding on any action. If the head changed, take the new-revision path below. These checks are separate reads. Coordinate the retry with the other reviewer when both of you are working on the same failure.
Keep the following command in its own step. The --failed flag chooses the failed-jobs rerun for run 12345. In a workflow with several failed jobs it can repeat more than the single job you were investigating. If the request times out or returns an unclear response, first read the latest snapshot and check the run’s history to find out what GitHub accepted. This case uses the failed-jobs scope because it contains exactly the work the maintainer intends to repeat. GitHub CLI rerun options
gh run rerun "$run" --repo "$repo" --failed
# Look for attempt 2 with the same databaseId and headSha.
gh run view "$run" --repo "$repo" --json databaseId,attempt,headSha,status,conclusion
If the latest snapshot still shows attempt 1 just after submission, give GitHub time and read again. Use the run’s attempt selector in the browser if you need another view. If the request was refused, read the error and confirm repository access and workflow eligibility. GitHub documents a 30-day window from the initial run, a maximum of 50 reruns for a workflow run, and a restriction on rerunning a disabled workflow. The single retry in this guide is a maintainer decision for this case. If someone else already started attempt 2, verify that attempt and record who took the action. GitHub rerun limits
Once the run shows attempt 2 and the SHA matches, use the watcher if the run is active. Then query attempt 2 explicitly. The watcher takes a run ID. If more attempts appear while you are watching, use the pinned read to describe attempt 2 and check the latest run and current PR checks to see what the PR now reports. In the illustrative success case, attempt 2 has status completed and conclusion success. Unit tests succeeds after Run parser tests executes. Inspect that step’s result or log before stating that the parser tests actually ran. A skipped test and an executed passing test support different statements in the handoff. GitHub CLI run view
# Run once attempt 2 exists. Repeat this read after completion if needed.
gh run view "$run" --repo "$repo" --attempt 2 --json databaseId,attempt,headSha,status,conclusion,jobs
# Inspect the test step in attempt 2.
gh run view "$run" --repo "$repo" --attempt 2 --log
If attempt 2 fails, run gh run view "$run" --repo "$repo" --attempt 2 --log-failed. An assertion after successful setup puts you on the code-fix branch. A second setup failure leaves the dependency or runner issue open. Share both attempts and their distinct observations with the owner who can address the remaining error. A passing test completes this part of the review. The maintainer still reviews the patch and follows the repository’s merge requirements. Agents Propose, Humans Merge
Recheck the PR after a push or stop a superseded run
- Reread the PR head and inspect its checks. If the head has moved, find the check and workflow run for the new revision. Record the previous attempt against its original SHA.
- If an earlier attempt is still active and the maintainer decides to stop it, confirm the old run ID and current attempt immediately before sending the cancellation. The cancel command targets the run ID.
- Read the stopped attempt again and record its terminal conclusion. Review the steps that completed before cancellation and handle any effects separately.
gh pr view "$pr" --repo "$repo" --json number,headRefOid,url
gh pr checks "$pr" --repo "$repo" --json name,workflow,bucket,link
For an illustrative head change, suppose PR 42 now reports b2c3d4e5f678901234567890abcdef1234567890a1 after the parser correction. The Unit tests check might be pending for that revision. Follow its check link to the associated Actions run and use the same run view fields to inspect its SHA, status, and conclusion. A passing retry under run 12345 applies to the earlier SHA. If the new revision’s check is missing, leave CI verification pending and check whether the intended workflow has been triggered. If someone pushes between reading the head and reading the checks, repeat the comparison before recording a verdict. GitHub CLI PR view · GitHub CLI PR checks
A superseded build can finish on its own. If you need to stop it, use ordinary cancellation on the old run while the intended attempt is still active. For the example below, attempt 2 is active and the maintainer has verified that 12345 identifies the obsolete run. Read the pinned result after cancellation and again if it is still active. Expect completed with cancelled when cancellation takes effect. If the attempt finishes first, record the terminal conclusion it actually reached. GitHub CLI run cancel · GitHub Docs on canceling a workflow run
# Confirm the old run and its active attempt before issuing cancellation.
gh run view "$run" --repo "$repo" --json databaseId,attempt,headSha,status,conclusion
# Optional. Authorized maintainer only, after verifying the old run above.
gh run cancel "$run" --repo "$repo"
gh run view "$run" --repo "$repo" --attempt 2 --json databaseId,attempt,headSha,status,conclusion,jobs
Cancellation addresses work still in progress. Steps that already ran can leave effects that require separate cleanup. In the disposable example, preserve useful log evidence and continue with the new revision’s check. If a real workflow wrote an artifact to a shared destination before cancellation, inspect the destination and use the repository’s normal cleanup procedure if required. Keep the old attempt’s conclusion and the new revision’s check in the handoff so the next reviewer can tell which work was stopped and which workflow still needs review. AgentOps · Reconstructing agent work from its records
Record the decision for run 12345
Read the first three rows as the main case. Each later row gives an alternate starting condition. The results are illustrative, and the shell variables refer to the repository, PR, and run defined above.
| Input | Action | Expected result |
|---|---|---|
task:actions-retry-01, PR 42, CI run 12345, original SHA a1b2c3d4e5f678901234567890abcdef1234567890 |
Run gh run view "$run" --repo "$repo" --json databaseId,attempt,headSha,status,conclusion and compare with the PR head snapshot. |
Attempt 1 shows 12345, the original SHA, completed, and failure. The current PR head matches in this fixture. |
| Same case, completed attempt 1 with failed Unit tests | Run gh run view "$run" --repo "$repo" --attempt 1 --log-failed and examine Install dependencies. |
The illustrative failure is an upstream HTTP 503 during setup. The parser tests did not start. Verify recovery before authorizing the retry. |
| Same case, upstream recovered and the build-and-test jobs are safe to repeat | Run gh run rerun "$run" --repo "$repo" --failed once. Confirm attempt 2 with the latest snapshot, then run gh run view "$run" --repo "$repo" --attempt 2 --json databaseId,attempt,headSha,status,conclusion,jobs. |
Run ID and SHA match the baseline. Attempt 2 reaches completed and success with a successful Unit tests job in the illustrative recovery. |
| Alternative, run 12345 is still active on attempt 1 | Run gh run watch "$run" --repo "$repo" --compact, then reread the latest run snapshot. |
The active run gets time to finish. Its terminal status and conclusion determine whether failure logs are needed. |
| Alternative, attempt 1 is complete but its failed-step logs are stale | Select attempt 1 in the run’s Latest dropdown, expand Unit tests, and check its setup step. | If the relevant lines are still missing, the job failure can be recorded and the cause stays open. Recheck the same attempt when the logs are available. |
Alternative, attempt 1 logged parse_quantity("0"), expected 0, got None |
Read gh run view "$run" --repo "$repo" --attempt 1 --log-failed. Send the assertion and SHA to the patch author for correction, then inspect the revised PR checks. |
The code change is reviewed on its new revision. The failed assertion remains attributable to the original SHA. |
Alternative, PR 42 advanced to b2c3d4e5f678901234567890abcdef1234567890a1 and attempt 2 of run 12345 is still active |
Confirm the old run, then if cancellation is needed run gh run cancel "$run" --repo "$repo" and gh run view "$run" --repo "$repo" --attempt 2 --json status,conclusion,jobs. |
Successful cancellation ends attempt 2 with completed and cancelled. Inspect the new revision’s check and any completed steps of the old run. |
A handoff for the main case can read as follows. “PR 42, CI run 12345 at a1b2c3d4e5f678901234567890abcdef1234567890. Attempt 1 completed with failure. Unit tests stopped in Install dependencies on HTTP 503. After dependency recovery, the maintainer reran failed jobs once. Attempt 2 completed with success on the same SHA, and the parser tests passed. The PR head still matched when the reviewer checked.” If you can report only that GitHub accepted the retry, leave the outcome pending. Close the CI investigation when you can name the terminal attempt, describe what the relevant job did, and connect the result to the revision under review.

