CodeRabbit Codex Integration
Overview
Enable Codex to execute CodeRabbit CLI in-loop: implement changes, run a CodeRabbit review, then apply fixes based on CodeRabbit’s context-rich findings.
Workflow Decision Tree
- •If
coderabbitis not installed, install it first. - •If
coderabbitis installed but not authenticated, authenticate inside the current Codex session. - •Otherwise, run the review → fix loop (prefer
--prompt-only).
1) Install CodeRabbit CLI (one-time)
Install globally:
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
Restart your shell (example):
source ~/.zshrc
2) Authenticate CodeRabbit inside Codex
Authentication must be performed inside the same Codex instance that will run coderabbit, and typically requires network approval/escalation.
Run:
coderabbit auth login
Then follow the interactive flow:
- •Copy the OAuth URL printed by CodeRabbit and send it to the user.
- •The user opens the URL, completes OAuth, and replies with the final callback string as plain text (a single line; often resembles
coderabbit-cli://auth-callback?code=...or an encoded string). - •Paste that exact callback string into the waiting
coderabbit auth loginprompt and press Enter.
Non-interactive alternative (sometimes works in Codex):
token='<paste callback string here>' printf '%s\n' "$token" | coderabbit auth login
If Codex doesn’t surface an auth URL, request it explicitly and ask for the URL output. If Codex re-runs coderabbit auth login, reuse the existing callback string if it still works.
Verify authentication:
coderabbit auth status
3) Review → Fix loop (recommended)
Prefer AI-friendly output:
- •Run directly:
coderabbit --prompt-only - •Or run and save output:
scripts/run_coderabbit_prompt_only.sh
Let the review finish; it may take 8–30+ minutes depending on the change size. After the review completes:
- •Read the
--prompt-onlyoutput and convert it into a checklist of findings. - •In
--prompt-only, findings are emitted as=============-separated blocks. If you only seeReview completed ✔(and no=============blocks above it), CodeRabbit didn’t report any issues and you can safely stop the review loop. - •Implement fixes with minimal, focused changes.
- •Continue until all important findings are addressed; if work stops early, explicitly continue with remaining findings.
- •Re-run CodeRabbit and repeat until critical issues are resolved.
Scope controls
- •Review uncommitted changes only:
--type uncommitted - •Configure base branch:
--base mainor--base develop
Prompt templates (copy/paste)
Please implement <FEATURE> and then run coderabbit --prompt-only, let it run as long as it needs and fix any issues.
Implement <FEATURE>. Then run coderabbit. Once it completes, let it take as long as it needs to fix any issues it might find.
4) Troubleshooting
CodeRabbit not finding issues
- •Check authentication (
coderabbit auth login). - •Verify
git status(reviews focus on tracked changes). - •Confirm you’re reviewing code files (not only docs/config).
- •Try detailed output:
coderabbit --plain.
Only Review completed ✔
- •In
--prompt-only, findings are emitted as=============-separated blocks. If none appear, treat it as a clean run (no findings). - •If you suspect terminal/UI truncation, rerun via
scripts/run_coderabbit_prompt_only.shand inspect the savedcoderabbit_prompt_only.txtoutput (setCODERABBIT_OUTPUTto avoid overwriting).
Benign unlink failures
- •If
coderabbitprintsunlink ... failedwhile running, ignore it and continue; it doesn’t block authentication or reviews as long ascoderabbitcompletes successfully.
Codex not applying fixes
- •Check authentication:
coderabbit auth status(renew if needed). - •Ensure you use
coderabbit --prompt-onlyfor better AI integration. - •Provide explicit instructions (“fix the issues found by CodeRabbit”).
- •Confirm CodeRabbit finished running (it may still be analyzing).
- •If it seems to stop early, instruct “let CodeRabbit take as long as it takes”.
Notes
- •CodeRabbit can read an
agents.mdfile for additional review context (coding standards, architecture preferences). This is a Pro paid plan feature. - •For additional details, read
references/coderabbit-docs-codex-integration.md.