How Custom Checks Work
Custom checks run in a secure, read-only environment against your PR. The agent has access to:- Changed files, code snippets, and relevant git history
- PR title, description, linked issues, and review discussion
- CodeRabbitâs posted review comments, with severity and resolution status (see Gate on CodeRabbit review comments)
- Pattern and code search tools (ast-grep, ripgrep)
- Sandboxed shell commands to inspect the repo
- Web lookups for public documentation
- Connected MCP tools for internal systems
1
Analyze
CodeRabbit interprets your instructions against the PR context
2
Verify
The agent gathers evidence using available tools to substantiate findings
3
Decide
Emits Passed, Failed, or Inconclusive with reasoning
Inspecting linked repositories
Custom checks can inspect committed files in linked repositories that CodeRabbit has authorized for the current repository and your plan. This is read-only file inspection; custom checks do not run the linked repositoryâs tests or build. Checks that run automatically during a review reuse the linked repositories and refs selected for that review. When you userun pre-merge checks or evaluate custom pre-merge check, CodeRabbit resolves linked-repository access and refs again. If an explicit branch or pull request reference in the PR description cannot be resolved, that linked repository is unavailable to the check instead of silently falling back to another branch. A check that requires this evidence returns Inconclusive and explains what is missing.
Gate on CodeRabbit review comments
A custom check can read the review comments CodeRabbit has already posted on the PR. Use this to block a merge only on serious findings that are still open, for example Critical and Major comments without a confirmed fix, instead of on every comment. For each review thread that CodeRabbit started, the check receives the first comment, including its severity badge (Critical, Major, Minor, Trivial, or Info), the file and line, a note if that location is outdated, and two statuses:
Automatic runs after a review also receive the new findings from that review, with their severity. These findings are not posted yet, so they have no
discussion or code status, and the check treats them as outstanding.
If your instructions only ask about severities, counts, or these statuses, CodeRabbit can decide the check from this data without analyzing the code again. If they ask whether a defect exists in the code, the check still looks for evidence in the code.
Only threads that CodeRabbit started are included. Comments written by people, and replies in a thread, are not included. On Bitbucket and Azure DevOps, only inline comments on a file are included. If CodeRabbit cannot load the comments, the check is told that they are unavailable.
When a check receives review comments
@coderabbitai run pre-merge checks: every custom check receives the posted comments.- Automatic runs during a review: CodeRabbit reads each checkâs name and instructions to decide whether the check depends on the reviewâs findings. Checks that depend on them run after the review finishes and receive the comments. The other checks run earlier, without them. No setting controls this; to make sure a check runs after the review, mention CodeRabbitâs review comments or findings in its instructions. If it is unclear whether a check depends on the review, it runs after the review.
evaluate custom pre-merge check: test runs do not receive posted comments.
Resolving a thread changes
discussion, not code. A check result changes only when the checks run again, after a new commit or @coderabbitai run pre-merge checks. A failed check stays failed until a later run explicitly finds the earlier failure addressed or incorrect, or until you change the checkâs instructions.Define a check in Markdown
On GitHub Cloud with CodeRabbit Cloud, use configuration directories to store a check in.coderabbit/pre-merge-checks/. Put its settings in YAML front matter and its instructions in the Markdown body. You can keep your existing V2 YAML or TypeScript configuration.
.coderabbit/pre-merge-checks/migration-reversal.md
db/migrations/**. Because report is omitted, it defaults to platform and publishes its result as a GitHub Check Run. If CodeRabbit confirms that the GitHub App installation lacks Checks write permission, it runs the check and shows the result in the Walkthrough with a permission notice. Add report: coderabbit to always use Walkthrough reporting and CodeRabbitâs native merge controls instead.
Check front matter
The body must contain instructions whenenabled is true and cannot exceed 10,000 characters. See front matter for the shared id, name, paths, exclude, and enabled fields, and nested directories for scope and override rules. The checkâs display name uses name if present, or id otherwise.
These additional fields apply only to checks:
These are Markdown front matter fields. Do not add
report to an inline YAML custom check. See GitHub Check Runs for result states and merge requirements.
Move a check from YAML or the web UI
V3 has nopre_merge_checks YAML section. Author its custom checks in .coderabbit/pre-merge-checks/, keeping .coderabbit/instructions/ for review guidance. Built-in checks are not converted automatically; follow the V3 migration guide to prepare and verify a replacement policy.
- Copy the checkâs instructions into a Markdown file under
.coderabbit/pre-merge-checks/. - Add front matter with a stable
id, the existingname, and the samemode. Setreport: coderabbitif you want to keep Walkthrough reporting. - Remove the old inline check or set its
modetooffin the configuration source that supplies it.
Limitations
Custom checks cannot:- Run your test suite â dependencies are not installed in the sandbox
- Access
node_modules,dist, or build artifacts â build steps are not executed - Execute arbitrary repository code â security restriction
- Post inline comments on specific lines â results appear in the Walkthrough or, for directory checks with
report: platform, a GitHub Check Run - Check PR approval status or reviewer assignments â not available to the agent
- Modify the CodeRabbit review â use Path Instructions instead
Writing Effective Instructions
Think of instructions as guidance for a smart teammate who needs explicit criteria, not subjective judgment.Be specific and actionable
Avoid vague instructions like âCheck for security issuesâ
Define clear pass/fail criteria
Say exactly what causes failure
One concern per check
Donât bundle security, testing, and documentation into one instruction
Include examples for complex rules
Show what passes and what fails
Examples
Custom checks can enforce a wide range of guardrails tailored to your teamâs needs. Here are a few examples to get you started.Severity Gate
Severity Gate
error mode with Automatic Approvals to withhold CodeRabbit approval for Critical and Major findings without a confirmed code fix. Other approval requirements and your Git providerâs merge requirements still apply. See Gate on CodeRabbit review comments.Sensitive Data in Logs
Sensitive Data in Logs
Hardcoded Credentials
Hardcoded Credentials
Database Migrations
Database Migrations
Breaking Changes
Breaking Changes
Language Migration Policy
Language Migration Policy
Whatâs next
Configuration directory
Organize checks and instructions across your repository.
Pre-Merge Check results
Choose where check results appear and how to require them before merge.