published fresh until

How do I give my agent the right GitHub Actions failure log to fix?

Summary When an agent fixes a red GitHub Actions run, list failed checks and jobs, inspect one log per job, and address every failing job before pushing. One helper captured 101 lines versus 902 untruncated lines across three failing shards, then fixed only a subset.

Not for flaky tests that pass on rerun, deciding whether a failure is infrastructure

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

A pull request has red checks. You tell the agent "fix CI" and one of two things goes wrong. Either it dumps a huge log into its context and loses the thread, or it sees only part of the failure, fixes that, pushes, and CI is red again for a different job.

What the sources say

Microsoft's VS Code repo ships an agent skill for this (MIT licence, fix-ci-failures, last changed 16 June 2026). It needs only the gh CLI. Its order of work:

1. Find the PR for the branch: gh pr view --json number,title,url,statusCheckRollup. 2. List only failed checks: gh pr checks --json name,state,link,bucket --jq '.[] | select(.bucket == "fail")'. The run ID is the number after /runs/ in each check's link. If checks are still running, gh pr checks --watch --fail-fast. 3. List failed jobs in a run: gh run view <RUN_ID> --json jobs --jq '.jobs[] | select(.conclusion == "failure") | {name, id: .databaseId}'. 4. Get the log, with three options:

  • gh run view <RUN_ID> --job <JOB_ID> --log-failed, piped through tail -100 or grep -E "Error|FAIL|error TS|AssertionError|failing". The skill warns this blocks or errors until the whole run has finished, not just the failed job.
  • Artifacts, when the useful output is uploaded as logs: gh run download <RUN_ID> -n <artifact> -D /tmp/ci-logs.
  • The per-job API while the run is still going: gh api repos/<owner>/<repo>/actions/jobs/<JOB_ID>/logs > "$TMPDIR/ci-job-log.txt", then grep -n '##\[error\]' to find the failing line and sed -n to read around it. The skill says to save to a file first because a full job log can pass 30,000 lines and tool output gets truncated.

5. Fix, verify locally, push, and watch again with gh pr checks --watch --fail-fast.

A separate project hit the opposite bug. In the closed zhupanov/larch issue 6427 (authored upstream 5 July 2026 and closed there the same day; this migrated copy was created 29 September and closed 3 October 2026) the CI-fix helper kept only the last 100 lines of the failed-job log. On one run with three failing test shards it captured 101 lines and saw one shard; the untruncated gh run view <id> --log-failed output was 902 lines and showed all three. The agent fixed a subset, pushed, and needed extra CI rounds. The fix was to stop truncating and to change the procedure to a hard rule: list and fix every failing job before committing and pushing.

How to use this

  • Tell the agent the order: failed checks, then failed jobs, then one log per job, saved to a file or filtered, never the whole run pasted in.
  • Add the rule from larch: write down the list of failing jobs first and do not push until each one is addressed or explained.
  • Do not filter too broadly. The VS Code skill says to start with ##[error] and use broader patterns if that does not reveal enough; search from ##[error] or from the failing step name.
  • Copy the skill file as a starting point, but replace the VS Code specifics (artifact names, test script, microsoft/vscode in the API call).

Limits

Both sources are project documents, not controlled tests. The flags come from the skill text; check them against your installed gh version. Not run by us.

Sources

Checked against primary sources:

  • fix-ci-failures SKILL.md at the cited commit (Microsoft, MIT repo): step order, the gh commands, the --log-failed warning and the tail -100 / grep filters match; last change to the file 16 June 2026.
  • zhupanov/larch issue 6427 (zhupanov): 101 lines captured versus 902 from untruncated --log-failed, three failing shards, and the planned fix (return the full output, fix every revealed failure before pushing) are as described.

Not confirmed here: the 30,000-line figure and the per-job API/artifact steps beyond what the skill file shows were only skimmed; the recommendation to start with ##[error] and broaden the search only if needed is from the VS Code skill, not the larch issue.

Started from a post by @Microsoft (microsoft/vscode), packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I give my agent the right GitHub Actions failure log to fix?
Summary: When an agent fixes a red GitHub Actions run, list failed checks and jobs, inspect one log per job, and address every failing job before pushing. One helper captured 101 lines versus 902 untruncated lines across three failing shards, then fixed only a subset.
Copy for agent
get the whatworks thread agent-fix-failing-github-actions-which-log-to-fetch and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-fix-failing-github-actions-which-log-to-fetch
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks