Review output
cr review --agent writes one JSON object per line to stdout. Read the stream line by line and handle events by their type.
Finding events use these fields:
Other event types in the stream include
review_context, status, heartbeat, complete, and error.
heartbeat events are periodic keep-alive signals — reset timeout timers on receipt and otherwise ignore them. For finding events, use codegenInstructions for agent fix logic and fall back to comment when it is absent.
For a remote review, review_context includes remote, currentBranch, and baseBranch and omits workingDirectory.
Reviews with too many files
When the selected review scope is skipped because it contains too many files, the review fails with anerror event. The event can include these optional, additive fields:
These fields do not change the existing error contract, so integrations do not need to handle them. Candidates are alternatives, not an automatic partition of the full change set. The CLI does not select a candidate or retry the review. The user or agent must choose one suggestion and rerun the narrower command manually.
In plain mode, the same failure can print a Narrower scopes found in this diff block with concrete commands, estimated file counts, and fit indicators. The CLI does not increase the limit, split the review, or retry automatically; choose one command and rerun it manually.
Reviews with no changes
When the selected review scope has no file changes,cr review --agent still emits the review_context event, then emits a status event with status: "review_skipped" and a complete event with status: "review_skipped", findings: 0, and message: "No changes detected". Plain mode prints a no-changes message and exits without starting a review.
Failed or incomplete reviews
Starting with CLI 0.7.7, failed or incomplete reviews exit with code1. Treat the process exit code and completion outcome as part of the result; receiving findings does not prove that the whole review completed.
An agent complete event can still have status: "review_completed" when the review failed or missed files. Inspect its outcome, message, and unreviewedFileCount when present: outcome: "failed" or a positive unreviewedFileCount means the run was incomplete. outcome: "completed_with_warnings" with no files left to review does not by itself indicate failure.
For local reviews, findings received before a failure remain available, and the last successful incremental checkpoint is preserved. Retry after resolving the reported error. A no-change result with status: "review_skipped" remains a successful skip.
Exit codes
A review that is skipped because the selected scope has no changes is a successful run and does not exit with code
1.
Agent-friendly authentication
cr auth login --agent applies to the browser-based OAuth login flow and is not used with --self-hosted or --api-key login.
For GitHub Actions and other non-interactive environments, use cr auth login --api-key "<key>" and follow the Headless CLI integration guide.
Structured output from other commands
Several other commands accept--agent for structured output without prompts or writes. They are described in the CLI command reference:
cr config --agentinspects repository configuration. See agent-guided setup.cr skills --agentpreviews skill installation for approval. See CodeRabbit Skills.cr usage --agentreturns one usage event.cr pullrequest --agentreturns newline-delimited JSON for pull request output.cr code handoff --agentreturns newline-delimited JSON for agent workflows.
What’s next
Headless CLI integration
Authenticate non-interactively in GitHub Actions and other automation
CLI Command Reference
Look up every command, option, and example generated from the CLI help output
CodeRabbit Skills
Install skills that run CodeRabbit reviews from your coding agent