Skip to main content
| Autofix helps you resolve review feedback faster by applying code changes for unresolved CodeRabbit findings in your pull request. Use Autofix when you want CodeRabbit to implement fixes automatically, then review the resulting commit or stacked PR.

Usage

You can trigger Autofix from a pull request comment on GitHub, GitLab, Azure DevOps, or Bitbucket Cloud. On supported GitHub pull-request flows, you can also use the Finishing Touches Autofix checkbox in CodeRabbit’s PR .
Open a separate stacked PR with fixes
Apply fixes to your current PR branch
GitHub, GitLab, Azure DevOps, and Bitbucket Cloud support @coderabbitai autofix for direct commits to the current branch and @coderabbitai autofix stacked pr for a stacked pull request. The interactive Autofix checkbox is currently available on supported GitHub pull-request flows only.

GitHub checkbox triggers

On supported GitHub PR flows, CodeRabbit renders an expanded Autofix section with interactive checkboxes in the pull request review comment (alongside actionable comments).
  • Push a commit to this branch: Runs Autofix and commits fixes to the current PR branch.
  • Create a new PR with the fixes: Runs Autofix and opens a stacked PR with the generated changes.
These checkbox actions map to the same Autofix execution paths as the PR comment commands.

How it works

1

Trigger autofix

Comment @coderabbitai autofix in the pull request thread, or @coderabbitai autofix stacked pr to request a separate stacked PR. On supported GitHub pull-request flows, you can also use the Autofix checkbox section in the pull request review comment.
2

Collect fix instructions

CodeRabbit scans unresolved review threads started by CodeRabbit and gathers fix instructions from the Prompt for AI Agents blocks.
3

Generate and verify fixes

The coding agent applies fixes, then runs a repository setup + build verification step. Even if verification fails, the generated changes are still delivered so you can continue iterating.
4

Deliver the result

CodeRabbit either pushes a commit to the current branch or opens a stacked PR, depending on which command or checkbox option you selected.

Output options

Commit to current branch

Use @coderabbitai autofix to push a commit directly to your current branch. This is the fastest path when you want fixes in the same review, and it is supported on GitHub, GitLab, Azure DevOps, and Bitbucket Cloud.

Create stacked PR

Use @coderabbitai autofix stacked pr to open a new branch off your working branch and submit a separate stacked pull request, which lets you review the generated changes independently.

Configuration

Autofix is enabled by default. To turn it off for a repository, set reviews.finishing_touches.autofix.enabled to false in your .coderabbit.yaml:
FieldRequiredDefaultDescription
enabledNotrueSet to false to disable Autofix for the repository.
When Autofix is disabled:
  • The Autofix checkboxes are hidden from the pull request review comment.
  • The @coderabbitai autofix command is removed from the CodeRabbit help output.
  • CodeRabbit declines any @coderabbitai autofix request and points to this setting.
Autofix also requires a Pro plan or higher. The configuration toggle only controls availability once your plan already supports Autofix.

Scope and limitations

  • Autofix runs only on pull request events.
  • Autofix only processes unresolved CodeRabbit review threads with valid fix instructions.
  • When the pull request has merge conflicts, Autofix exits without making changes. Resolve the conflicts against the base branch, then trigger Autofix again.
  • If no valid unresolved instructions are found, Autofix skips execution and reports that no fixes were applied.
  • Autofix may be rate-limited. If limits are exceeded, CodeRabbit responds with a wait time before retrying.

Command reference

Also supported aliases include auto-fix and auto fix forms, with or without stacked pr.

Troubleshooting

Autofix only acts on unresolved CodeRabbit review comments that include structured fix instructions. Resolve state, missing instruction blocks, or non-CodeRabbit threads can lead to no-op runs.
Build/verification can fail after code edits. In this case, CodeRabbit still keeps and delivers the generated autofix changes so you can continue iteration.
Autofix stops before cloning or generating changes when the platform reports that the pull request is not mergeable. Resolve the conflicts with the base branch, then run Autofix again.CodeRabbit will also suggest running @coderabbitai resolve merge conflict from the Autofix reply. See Resolve merge conflicts for details.
Stacked PR creation may fail due to platform or API limitations. If this happens, use @coderabbitai autofix to apply the fixes as a direct commit to your current branch instead.
If the Autofix checkboxes are absent, the command is missing from help, or CodeRabbit replies that Autofix is disabled for the repository, Autofix has been turned off in your configuration. Set reviews.finishing_touches.autofix.enabled to true in your .coderabbit.yaml (see Configuration). Autofix also requires a Pro plan or higher.

What’s next

Finishing Touches overview

See all available finishing touches and how to trigger them from any PR

Custom recipes

Define reusable, named recipes that encode your team’s repeated tasks into one-click agentic actions

Resolve merge conflicts

Let CodeRabbit analyze the intent behind conflicting changes and commit a clean resolution to your branch