Skip to main content

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.
Windows users: Codex has experimental Windows support. For the best experience on Windows, use WSL (Windows Subsystem for Linux). See our WSL on Windows guide for setup instructions.
The integration creates a tight feedback loop: CodeRabbit analyzes your code changes and surfaces specific issues, then Codex applies the fixes based on CodeRabbit’s context-rich feedback.

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 --agent mode gives Codex structured findings with file locations, 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:
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
Restart your shell to ensure the CLI is available:
source ~/.zshrc
3

Authenticate CodeRabbit within Codex

Ask Codex to run the authentication command:
Please run: coderabbit auth login --agent
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)
For CodeRabbit authentication, grant network permissions when Codex requests them.
Codex will open a browser window. Sign in to CodeRabbit and the authentication completes in the browser. The --agent flag is fully supported in authentication workflows, so Codex can handle the entire process.
4

Verify setup

Test that Codex can run CodeRabbit commands and confirm authentication. This command requires elevated permissions for network access:
Run: coderabbit auth status --agent
Grant network permissions when Codex requests them. If authentication was successful, this will return structured status information and confirm Codex can execute CodeRabbit commands.

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:
Please implement phase 7.3 of the planning doc and then run coderabbit --agent,
let it run as long as it needs and fix any issues.
The key components of this prompt:
  • Implement the feature: Codex codes the requested functionality
  • Run CodeRabbit: Uses --agent for structured findings Codex can act on directly
  • 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 --agent 3. Wait for CodeRabbit to complete its analysis
3

CodeRabbit analysis and fix implementation

When CodeRabbit completes, Codex: 1. Reads the --agent output (structured JSON for agent workflows) 2. Addresses each issue CodeRabbit surfaced 3. Shows you the planned fixes before implementing them
4

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

# Working on phase 7.3 of the fitness tracker
git checkout -b feature/withings-integration
# Implement initial smart scale integration code...
2

Run integrated review

Tell Codex to run CodeRabbit and fix issues:
Implement phase 7.3 - adding Withings smart scale integration.
Then run coderabbit --agent. Once it completes, let it take as long as
it needs to fix any issues it might find.
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.
Use --agent for Codex-driven workflows. Use --plain when you want to read findings directly in the terminal yourself. See output modes for agent integration for details.

Optimization tips

Output modes for agent integration

When running CodeRabbit for agent use, choose the output mode that best fits your workflow:
# Structured JSON output
coderabbit --agent

# Detailed plain-text output
coderabbit --plain

# Browsable terminal UI
coderabbit --interactive
ModeBest for
--agentCodex and other agent integrations that consume structured JSON
--plainHuman-readable terminal output during manual workflows
--interactiveManual review in an interactive terminal UI
All three modes include specific file locations, problem descriptions, and suggested fix approaches.

Configure CodeRabbit for Codex

CodeRabbit automatically reads your agents.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:
  1. Check authentication: Ensure you’re logged in with coderabbit auth login
  2. Verify git status: CodeRabbit analyzes tracked changes - check git status
  3. Review file types: CodeRabbit focuses on code files, not docs or configuration
  4. Try different modes: Use coderabbit --plain to see detailed output

Codex not applying fixes

If Codex isn’t implementing CodeRabbit’s suggestions:
  1. Check authentication: Run coderabbit auth status --agent - authentication may need renewal
  2. Use agent mode: Ensure you’re using coderabbit --agent for Codex-driven workflows
  3. Provide explicit context: Tell Codex to “fix the issues found by CodeRabbit” explicitly
  4. Check if review finished: The review may still be running - prompt Codex: “Is CodeRabbit finished running?”
  5. 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:
  1. 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
  2. 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
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.