9 setups · GitHub Actions, overnight PRs, cross-review
AI code review agents: how to set up AI PR review, with 9 setups
Last updated · by Thomas, editor · How we verify
An AI code review agent reads each pull request and leaves comments, and a person merges. Below: how to set up a PR review bot, then nine setups people and teams run: a bot on every PR, a night shift that turns labeled bugs into draft PRs, scheduled routines whose fixes merge only on proof, a fault-test loop that turns each failure into a failing test and a fix, and the rule that whoever wrote the code doesn't review it.
What they share is permissions: reviewers comment, humans merge, and the limits are enforced by GitHub settings, not just by the prompt.
How to set one up
- Add your Anthropic or OpenAI API key as a repository secret. (recipe)
- Install the official workflow: the Claude action's quick start, or the review example in the Codex README. (recipe)
- Keep it read-only:
contents: read, and only the comment step can write. (recipe) - Add a review prompt (starter below) and ask for real problems only, ranked by risk. (recipe)
- Open a test PR and check the comments. On a busy repo, trigger on an @claude mention or a label instead of every PR. (recipe)
- Protect the default branch and require CI, so humans merge even if a bot ignores its prompt. (recipe)
Starter prompt: from OpenAI's codex-action README example
What does an AI code review agent actually do?
It reads the diff on a pull request and posts comments. Anthropic's official action runs Claude Code on your own GitHub runner to review PRs and answer @claude questions (recipe). OpenAI's codex-action runs Codex CLI in a workflow with locked-down privileges, and its README example posts a review comment on each new PR (recipe).
Can AI review every pull request automatically?
Yes, but you choose the trigger. Running on every new PR suits a quiet repo; on a busy one, the Claude action's failure list warns that costs grow, so teams trigger on an @claude mention or a label instead. recipe
Can an AI agent fix bugs and open PRs while I sleep?
Two setups here do. A Grok Bot night shift turns labeled GitHub bugs into reproduced, fixed and independently reviewed draft PRs, with a morning report that separates done from attempted (recipe). In OpenAI's guide, an engineer points Codex at low-coverage modules overnight and reviews runnable test PRs in the morning (recipe). In both, a person merges.
Why have a different AI review the code?
Because a reviewer that didn't write the code catches different mistakes. One fleet rule: whichever model wrote a piece of work never reviews it, a different vendor's agents review every lane, and repeated failure forces a redesign (recipe). The simplest version is Claude Code building and Codex reviewing the same branch (recipe); more splits are in Claude Code vs Codex.
Which one fits your repo
Where each reviewer runs, what starts it, and how much it may change.
@claude in pull requests (GitHub Action)
Runs on GitHub Actions, Anthropic API key. Starts on: PR or @claude mention.
⏱ Setup: 15 min✋ Limit tools so it comments, not pushesYour own PR review bot with Codex
Runs on GitHub Actions, OpenAI API key. Starts on: PR opened.
⏱ Setup: 15 min✋ contents: read; only the comment step writesOvernight test coverage PRs with Codex
Runs on Codex connected to GitHub. Starts on: Queued before you log off.
⏱ Setup: 20 min✋ Opens PRs; humans mergeNight shift: labeled GitHub bugs → reviewed draft PRs by morning
Runs on Grok Bot, GitHub, cloud coding agents, CI. Starts on: Nightly, on a label.
⏱ Setup: Half a day to set up✋ Draft PRs only; branch protection blocks mergesSplit a big task into a DAG of small subagents
Runs on Claude Code plugin, Node.js, git. Starts on: Per large task.
⏱ Setup: 20 min✋ Dispatch after you approve the graphClaude Code fault-test loop found 55 Ceph bugs
Runs on Claude Code, subagent reviewers, a fault injector. Starts on: Each failure in an overnight fault run.
⏱ Setup: His first two long sessions were 87 hours of Claude Code work (one overnight, one over a weekend); later runs ran overnight✋ Draft PRs and trackers only after you approve the exact text7 Claude Code routines that look after a solo app
Julien Renaux builds EVPick, a free assistant for choosing an electric car, on his own. Seven scheduled Claude Code routines now watch its search traffic, security, bugs and car data, turn problems into pull requests and check a week later that each fix held. In the week he measured, 46% of their PRs merged on automated checks alone; the rest took him three to four hours.
⏱ Setup: About 3 to 4 hours of his time in the week he measured, more than half of it on car-data questions✋ Opens PRs; only machine-provable changes auto-merge, all code waits for himThe writer never reviews its own lane
Runs on Agents from two or more vendors. Starts on: Every change.
⏱ Setup: 10 min✋ Nothing merges without a non-author passClaude Code builds, Codex reviews
Use one agent as the builder and the other as a second pair of eyes that hunts bugs and challenges architecture before you accept the result.
⏱ Setup: 5 min✋ The reviewer is read-only
Details come from each recipe's source. Setup time is shown only where the recipe states it.
Review bots on every PR
Official GitHub Actions you install in your repo.
@claude in pull requests (GitHub Action)
Anthropic's official action runs Claude Code on your own GitHub runner to review PRs, answer @claude questions and implement small changes.
Your own PR review bot with Codex
OpenAI's action runs Codex CLI inside a workflow with locked-down privileges; the README's example posts a code review comment on each new PR.
Agents that open PRs for you
Work happens overnight; you review in the morning.
Overnight test coverage PRs with Codex
OpenAI's internal guide lists seven Codex use cases; one engineer points it at low-coverage modules overnight and reviews runnable test PRs in the morning.
Night shift: labeled GitHub bugs → reviewed draft PRs by morning
A Chief bot and four specialists turn labeled GitHub bugs into reproduced, fixed, independently reviewed draft PRs overnight, with a morning report that separates done from attempted.
Split a big task into a DAG of small subagents
A Claude Code plugin that breaks work into atomic tasks with dependencies and gives each subagent only the context it needs, in parallel worktrees.
Claude Code fault-test loop found 55 Ceph bugs
Alex Ainscow, who works on Ceph's erasure coding, let Claude Code run a loop on upstream Ceph: inject faults into a one-machine test cluster, catch what breaks, work out why, write a unit test that fails, fix it, rebuild and go again. Across his runs it found 55 real defects, 32 of them in code already on main, for about $840 of API time on the first two sessions.
7 Claude Code routines that look after a solo app
Julien Renaux builds EVPick, a free assistant for choosing an electric car, on his own. Seven scheduled Claude Code routines now watch its search traffic, security, bugs and car data, turn problems into pull requests and check a week later that each fix held. In the week he measured, 46% of their PRs merged on automated checks alone; the rest took him three to four hours.
Review by a different agent
A second model that didn't write the code.
The writer never reviews its own lane
A fleet rule: whichever model wrote a piece of work never reviews it; a different vendor's agents review every lane, and repeated failure forces a redesign.
Claude Code builds, Codex reviews
Use one agent as the builder and the other as a second pair of eyes that hunts bugs and challenges architecture before you accept the result.
How to choose
- Trigger on mention on busy repos. The Claude action's failure list warns costs grow if it runs on every PR. (recipe)
- Treat PR text as untrusted. Prompt injection from PR or issue text is the first listed failure; keep tokens read-only.
- Enforce 'never merge' outside the prompt. The night shift protects the default branch and requires CI so the rule holds even if the agent ignores it. (recipe)
- Read the assertions. Overnight test PRs can lock in current bugs if the tests only assert today's behavior. (recipe)
Common questions
What is an AI code review agent?
A bot that runs on each pull request, reads the changes and posts review comments. Anthropic's claude-code-action and OpenAI's codex-action both do this inside a GitHub Actions workflow, with your own API key.
Should an AI agent be allowed to merge PRs?
None of these setups allow it. They comment or open draft PRs, and a person merges; the night-shift setup enforces that with branch protection.
Claude or Codex for PR review?
Both have official GitHub Actions, and both are listed here with their permission setups. Several recipes deliberately use a different model to review than the one that wrote the code.
Is it safe to give an AI reviewer access to my repo?
Keep it read-only. In these setups prompt injection from PR or issue text is the first listed failure, so the Codex workflow gets contents: read with only the comment step allowed to write, the Claude action has its tools limited so it comments instead of pushing, and branch protection blocks merges even if a bot ignores its prompt.
Get the next money recipe. Free.
New recipes every week, plus the top 10 agent setups pack. One email, no spam.
Unsubscribe anytime. Privacy
More guides: Make money with AI agents · AI voice agent business · AI agent agency ideas · Claude Code use cases · Grok Bot use cases · Claude Code vs Codex · AI agents for small business · AI email agents · Parallel coding agents · AI agents that save you money · AI refund agents · Autonomous agents that made money · AI agents for content creators · AI research agents