Code review

How automated code review works in GitHub

Capy team

Automated code review is software, often built on coding agents, that reads a pull request on GitHub and posts what it finds as comments on the changed lines. It runs when the pull request opens or gets new commits, alongside your CI, so every diff has been read once before a person opens it. It doesn't approve the change. The people with write access still decide what merges.

Where automated review sits in a pull request

A pull request on GitHub already collects feedback in two places. Status checks report whether builds, tests and scans passed, and a branch protection rule can require them before a merge. Reviews carry comments on specific lines, plus a verdict: comment, approve or request changes.

An automated reviewer posts reviews. CI answers "does it build, and do the tests we wrote pass?" The reviewer answers a different question: "is there a bug or a risk the tests don't cover?"

What a review run does

Most automated reviewers follow the same steps on each run:

  1. Start on an event. The pull request opens, a commit arrives, or someone asks for a review in a comment.
  2. Check out the code at the pull request's head. The diff alone is rarely enough. A changed function has callers, and a changed query has a schema it runs against.
  3. Read the change in context. The reviewer traces what the changed lines touch and compares them with the conventions the repository writes down.
  4. Write findings. Each one names a file and line, what goes wrong, and how serious it is.
  5. Post what clears a threshold. Serious findings become inline comments. Minor ones can stay off the pull request, so the comments that do post are worth reading.
  6. Review again on the next push. A good re-review reads only what changed since the last round and closes the findings the new commits fixed.

What it catches and what it leaves to people

An automated reviewer finds problems that show in the code: a missed edge case, a condition that reads the wrong field, a query built from user input, a convention the team wrote down and someone broke. It gives the 2,000-line pull request the same attention as the 20-line one, which people rarely do.

It can't tell you whether the change is the right thing to build, and it wasn't in the meeting where your team agreed on it. It doesn't replace your tests or CI either. Treat it as one more reviewer whose comments someone reads, not as the approval.

A worked example: one pull request, two rounds

The image above shows an example pull request in Capy. The change disables the merge button while CI is red.

  1. The pull request opens and the first round posts its findings. The high finding says the merge gate reads only check_run rows, so a failing commit status wouldn't block the merge. Medium and investigate findings come with it.
  2. The Capy thread that opened the pull request reads the findings, fixes the gate copy, and pushes a new commit.
  3. The push starts a second round. It reviews only the new commit, with the whole pull request as context, marks the fixed finding resolved, and its summary says the fix holds and one earlier risk, the high finding, still stands.
  4. A person reads the open findings, accepts the remaining risk or asks for a fix, and merges.

The reviewer approved nothing. It put the risks in front of the person who merges.

Where Capy fits

Capy is a platform that orchestrates agent swarms, and its review agent is the reviewer in the example:

  • It reads the diff in a real checkout of your repository at the pull request's exact head and posts findings as inline GitHub comments.
  • Each finding has a category, a severity, a confidence, and a file and line. Findings at or above the repository's posting threshold post to GitHub. The default threshold is medium.
  • Set each repository's review mode to Off, Once or Every push in Settings → Review, and turn on Status check if you want a capy/review commit status. You can also comment @capy review on a pull request, with extra instructions after it if you want, or start a round from the app or the API.
  • Re-reviews cover only the code changed since the last reviewed head. A finding marked irrelevant is never raised again.
  • When a Capy thread owns the pull request, that thread triages the findings and fixes the high-severity ones before it reports the pull request ready. For red builds on branches no thread owns, an automation can fix failing CI.
  • The review agent enforces the rules in your repository's AGENTS.md files on the same footing as logic bugs. Settings → Review → Agent config adds organization-wide or path-scoped Custom instructions, PR filters that skip pull requests by label or author, and Ignore paths for files it should skip.
  • Machines that run reviews can read your repository but can't push.

And where it doesn't:

  • The review agent never merges, and Capy never merges a pull request unless you ask for that merge.
  • It works with repositories on GitHub.com. GitHub Enterprise Server and other git hosts aren't supported.
  • Each review uses your plan's monthly review credits first, 1 for Low effort, 5 for Medium and 10 for High, covering the model and the machine. Past that, reviews bill your organization's Capy credits. They don't use the subscriptions and keys you connect for your own threads.
  • It doesn't replace CI. Your checks still have to pass.

Follow-up questions

Does an automated review count as an approval?

No. Your branch protection decides what a merge needs, and a person makes the merge. The review hands that person a list of risks to decide on.

How do I stop the same false positive from coming back?

In Capy, mark the finding irrelevant, and re-reviews never raise it again. For a pattern that's always fine in your codebase, add a rule to AGENTS.md or to Custom instructions under Settings → Review → Agent config, or exclude generated files under Ignore paths.

Should it review every push or only once?

Every push keeps the findings current on a pull request that changes a lot, and each re-review reads only the commits since the last reviewed head. Once uses fewer review credits. Set the mode per repository in Settings → Review, and the effort for first and follow-up reviews in Settings → Review → Agent config.

Can it review pull requests that people opened?

Yes. Automatic review covers ready pull requests in every repository you turn it on for, whoever opened them. Drafts wait until they're marked ready. Any member of your Capy organization with a connected GitHub account can also ask for a round with @capy review.