AI CI Fixer for GitHub Actions That Opens the Fix as a PR

An AI CI fixer for GitHub Actions: when a workflow run fails, it reads the logs, reproduces the failure, fixes the cause and opens a pull request.

· 4 min read

READY-MADE AGENT

A red build stops everyone. Someone has to open the run, scroll the logs, work out whether it's the code, a flaky test or a missing secret, reproduce it, fix it and push. Lark's CI fixer picks that up the moment it happens. When a GitHub Actions run fails, it reads the failed job's logs, reproduces the failure on its own machine, fixes the cause, runs the suite and opens a pull request that explains what went wrong in two sentences. If it isn't a code problem, it tells you what is, instead of opening a PR. A green build stops being anyone's chore: it's a loop Lark keeps turning, and you only approve the fix.

What the CI fixer does when a build fails

The agent's instructions are short and specific:

  1. Checks the conclusion. It only acts if the workflow run's conclusion is failure. Otherwise it finishes in one line.
  2. Reads the failed job's logs through the GitHub API.
  3. Reproduces the failure locally, on its own machine, with the repository checked out at the failing branch.
  4. Fixes the cause, not the test, unless the test itself is wrong.
  5. Runs the suite to confirm the fix.
  6. Pushes a new branch and opens a pull request that explains the cause in two sentences.

Not every red build is a code problem

Some failures can't be fixed with a commit. When the agent finds one, it says which kind it is and what you should do instead of opening a pull request:

  • a flaky test that fails and passes on its own;
  • an outage in a service the build depends on;
  • a missing secret the workflow needs.

That keeps your repository free of pull requests that paper over the wrong problem.

How it runs: a GitHub webhook on every finished workflow

The trigger is a GitHub webhook on workflow_run.completed. The workflow's name, the branch, the repository, the conclusion and a link to the run are folded into the task, so the agent knows exactly which run to look at. The trigger allows up to 20 runs a day.

Each run gets its own Linux machine in the cloud with a terminal and files, with the repository checked out at the failing branch. This agent doesn't need a browser: everything it does happens in the terminal and through the GitHub API.

If it needs something only you can decide, it asks. Questions reach you by Slack, email or text, and you answer in a tap. To learn more about how webhooks start agents, see running AI agents on a schedule and from webhooks.

What you get back

For a code problem, a pull request on a new branch with the fix and a two-sentence explanation of the cause.

Its final message:

  • the failing job;
  • the cause, in one or two sentences;
  • the PR link;
  • whether the suite passes with the fix.

For a problem that isn't in the code (a flaky test, an outage, a missing secret), the final message says which it is and what to do instead. A run that finished green ends in one line.

Setting up the CI fixer in Lark

  1. Open the Agents page and pick CI fixer under Ready-made agents. The form opens with its instructions and trigger filled in.
  2. There's no repository to fill in: each webhook names the repository, branch and run.
  3. Connect GitHub. The agent reads job logs and opens pull requests with a GITHUB_TOKEN.
  4. Turn the trigger on. It starts paused until you do.

It runs on Claude Code by default, and you can choose the model and agent per agent. The docs cover the API and SDKs if you want to start runs from your own tooling.

Guardrails

  • It never pushes to the failing branch directly. The fix always goes on a new branch with its own pull request.
  • It fixes the cause, not the test, unless the test is what's wrong.
  • It only acts on failures. Successful or cancelled runs end in one line.
  • It doesn't open a PR for problems code can't fix. Flaky tests, outages and missing secrets are reported to you instead.
  • It doesn't merge. A person reviews the pull request.

Costs

Lark runs on credit. Free includes $1 of agent credit a month; Pro is $29 a month and Team $99, and all of it comes back as credit. Credit pays for the AI model and machine time each run uses, at the providers' prices plus 20%. See pricing for plan limits.

Every run shows its cost as it works, and a monthly budget stops your agents exactly where you set it. Runs on a green build end in one line, and the trigger's cap of 20 runs a day limits what a bad day of failures can start. For more, read how much AI agents cost to run.

FAQ

Can AI fix failing GitHub Actions builds automatically?

For failures caused by the code, yes. The CI fixer reads the failed job's logs, reproduces the failure, fixes the cause, runs the suite and opens a pull request. You review and merge it.

What happens if the failure is a flaky test or a missing secret?

It doesn't open a pull request. Its final message says it's a flaky test, an outage or a missing secret, and what you should do about it. Those need a person, not a commit.

Will it change my tests to make the build pass?

Only when the test itself is wrong. Its instructions are to fix the cause, not the test, and the pull request explains the cause in two sentences so you can judge it.

Does it push to my branch?

No. It never pushes to the failing branch. It opens a new branch and a pull request. For catching bugs before they reach CI, see the overnight bug hunter, and for reviewing PRs by running them, P-Rex.

Want red builds to come with a fix attached? Start free.

KEEP READING

Hand this job to Lark tonighttoday

One less loop for you to run: each Lark agent owns its job on its own cloud computer, starts on a schedule or when something happens, and brings you in only to approve.

Start free