Get continuous code review with Codex
Codex executes CodeRabbit directly as part of its development process. Ask Codex to implement a feature, run a code review, and fix any issues. CodeRabbit catches race conditions, memory leaks, and logic errors, then Codex applies the fixes with full context about the problems.Video demo
Watch how CodeRabbit CLI integrates with Codex for code reviews:This guide covers integrating CodeRabbit CLI with Codex. For standalone CLI usage, see CLI overview.
Why integrate these tools
Expert issue detection
CodeRabbit spots race conditions, memory leaks, and logic errors that generic linters miss. Get the same pattern recognition that powers our PR reviews.
AI-powered fixes
Codex implements fixes with full context from CodeRabbit’s analysis. Complex architectural changes handled intelligently.
Context preservation
CodeRabbit’s
--prompt-only
mode gives Codex succinct context about issues, including location, severity, and suggested approaches.Continuous workflow
Stay in development flow - run reviews, apply fixes, and iterate without switching between tools or losing mental context.
Prerequisites
Set up both tools with proper authentication for the integration:1
Install Codex
Install Codex following the platform-specific instructions. Ensure you can launch Codex from your terminal.
2
Install CodeRabbit CLI
Install the CodeRabbit CLI globally on your system:Restart your shell to ensure the CLI is available:
3
Authenticate CodeRabbit
Authentication must be done outside of Codex CLIOpen the URL in your browser, log in to CodeRabbit, and copy the authentication token.Paste the token back in to the terminal shell.
4
Verify setup
Test that Codex can run CodeRabbit commands and confirm authentication. This command requires elevated permissions for network access:Grant network permissions when Codex requests them. If authentication was successful, this will show your login status and confirm Codex can execute CodeRabbit commands.
About Codex approval modes: Codex operates in different approval modes that control what it can access:
- Auto (default): Can read files, make edits, and run commands in the working directory automatically. Requires approval for network access or working outside the directory.
- Read Only: Chat and planning mode - use
/approvals
to switch - Full Access: Complete access without approval (use with caution)
Integration workflow
The integration workflow follows a simple pattern: CodeRabbit analyzes your code, then Codex implements the recommended fixes.Basic workflow
1
Request implementation + review
Ask Codex to implement a feature and run CodeRabbit analysis with issue fixes:The key components of this prompt:
- Implement the feature: Codex codes the requested functionality
- Run CodeRabbit: Uses
--prompt-only
flag for AI-optimized output - Let it complete: Allows CodeRabbit to finish its analysis
- Fix issues: Codex addresses all problems CodeRabbit identifies
2
Codex implements and runs CodeRabbit
Codex will: 1. Implement the requested feature 2. Run
coderabbit --prompt-only
3. Wait for CodeRabbit to complete its analysis3
CodeRabbit analysis and fix implementation
When CodeRabbit completes, Codex: 1. Reads the
--prompt-only
output (plain text optimized for AI agents) 2. Addresses each issue CodeRabbit surfaced 3. Shows you the planned fixes before implementing them4
Automated issue resolution
Codex systematically implements fixes for each CodeRabbit finding. The cycle continues until all critical issues are resolved.
Sometimes Codex may start working on a particular section and then stop. If this happens, prompt it to continue addressing all remaining issues to ensure complete resolution.
Example: AI fitness tracker integration
This example demonstrates the workflow using an AI fitness tracker app, implementing a Withings smart scale integration:1
Start the feature
2
Run integrated review
Tell Codex to run CodeRabbit and fix issues:
3
CodeRabbit analysis
CodeRabbit analyzes the new integration code and identifies issues: - API error handling gaps - Potential memory leaks in data processing - Race conditions in webhook handling - Missing input validation
4
Codex fixes
Codex automatically applies fixes based on CodeRabbit’s analysis: - Adds proper error handling for API failures - Implements cleanup for data streams - Adds synchronization for webhook processing - Includes validation for incoming data
5
Verification
The workflow continues until all critical issues are resolved.
The
--prompt-only
mode provides Codex with token-efficient succinct context about each issue, including file locations, problem descriptions, and suggested fixes.Optimization tips
Use prompt-only mode for efficiency
When running CodeRabbit manually before Codex, use--prompt-only
for optimal AI agent integration:
- Provides succinct issue context
- Uses token-efficient formatting
- Includes specific file locations and line numbers
- Suggests fix approaches without overwhelming detail
Configure CodeRabbit for Codex
CodeRabbit automatically reads youragents.md
file, so you can add context there on how code reviews should run, your coding standards, and architectural preferences.
This is a Pro paid plan feature.
Troubleshooting
CodeRabbit not finding issues
If CodeRabbit isn’t detecting expected issues:- Check authentication: Ensure you’re logged in with
coderabbit auth login
- Verify git status: CodeRabbit analyzes tracked changes - check
git status
- Review file types: CodeRabbit focuses on code files, not docs or configuration
- Try different modes: Use
coderabbit --plain
to see detailed output
Codex not applying fixes
If Codex isn’t implementing CodeRabbit’s suggestions:- Check authentication: Run
coderabbit auth status
- authentication may need renewal - Use prompt-only mode: Ensure you’re using
coderabbit --prompt-only
for better AI integration - Provide explicit context: Tell Codex to “fix the issues found by CodeRabbit” explicitly
- Check if review finished: The review may still be running - prompt Codex: “Is CodeRabbit finished running?”
- Address timeout issues: If CodeRabbit seems to stop early, prompt Codex to “let CodeRabbit take as long as it takes”
Managing review duration
CodeRabbit reviews may take 8 to 30+ minutes depending on the scope of changes:- Review smaller changesets: Adjust what you’re reviewing to reduce analysis time:
- Use
--type uncommitted
to review only uncommitted changes - Work on smaller feature branches compared to main
- Break large features into smaller, reviewable chunks
- Use
- Configure the diff scope: Control what changes are analyzed:
- Review uncommitted changes only: Use
--type uncommitted
to analyze just working directory changes - Configure base branch: Use
--base develop
or--base main
to set the comparison point - Use feature branches: Work on focused feature branches instead of large staging branches
- Review uncommitted changes only: Use
The integration creates a more thorough review process than either tool alone. Expect the workflow to be more comprehensive than faster alternatives, catching issues that would otherwise reach production.