Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jonwiggins/optio/llms.txt

Use this file to discover all available pages before exploring further.

The code review agent is a separate AI agent that Optio launches as a subtask once the coding agent has opened a pull request. It reads the PR diff, the original task description, and any test output, then posts structured review feedback — catching issues before a human reviewer ever looks at the code. The review agent runs in the same repository pod as the coding agent, scoped to the PR branch. While the coding task waits, the review subtask blocks the parent from advancing until the review is complete.

Review flow

1

Coding agent opens a PR

The coding agent finishes its work and opens a pull request. The task transitions to pr_opened.
2

Review trigger fires

Depending on the repository’s review trigger setting, the review agent launches either immediately on PR open (on_pr) or after all CI checks pass (on_ci_pass).
3

Review subtask is created

A review subtask is created under the parent coding task, visible in the task detail view. It is marked as blocks parent — the coding task waits for it to complete.
4

Review agent runs

The review agent reads the rendered review prompt (which includes the PR number, task context, repo name, and test command) and examines the PR. It posts review comments on the pull request.
5

Outcome determines next step

  • If the reviewer approves the PR (or requests no changes), the review subtask completes and the parent task continues toward auto-merge.
  • If the reviewer requests changes, the task transitions to needs_attention. If auto-resume on review is enabled, the coding agent is re-queued with the review comments as its prompt and pushes a fix.

Trigger modes

Two trigger modes control when the review agent starts:
ModeWhen it runsBest for
on_ci_passAfter all CI checks passRecommended. No point reviewing code that already has failing tests.
on_prImmediately when the PR is openedUseful if CI is slow and you want early review feedback in parallel.
Configure the trigger mode in Repositories → [repo] → Settings → Review trigger.

Review model

The review agent can use a different model than the coding agent, configured separately in Repositories → [repo] → Settings → Review model. This lets you use a lighter, less expensive model for reviews while reserving a more capable model for coding.
Code review requires careful reading but not the same level of creative synthesis as writing code. Using a smaller, faster model for reviews is a cost-effective configuration that works well for most repositories.

Review prompt template

The review agent receives a prompt built from a configurable template. The following variables are available:
VariableValue
{{PR_NUMBER}}The pull request number (e.g., 42)
{{TASK_FILE}}Path to the review context file inside the worktree
{{REPO_NAME}}The repository name (e.g., your-org/your-repo)
{{TASK_TITLE}}The title of the original coding task
{{TEST_COMMAND}}The test command configured for the repository
To customize the review prompt, open Repositories → [repo] → Settings → Review prompt template and write your own prompt using these variables. Leave the field blank to use the built-in default. Example customization:
You are reviewing PR #{{PR_NUMBER}} in {{REPO_NAME}}.

The task was: {{TASK_TITLE}}

Check the following:
1. Does the implementation match the task requirements?
2. Are there any missing error handling cases?
3. Does `{{TEST_COMMAND}}` pass with the new code?

Read the full context from {{TASK_FILE}} before reviewing.

Triggering a review manually

If a task is in pr_opened state and no review has run yet (or you want to run another review after changes), you can trigger one manually:
  1. Open the task detail page.
  2. Click the Review button in the task actions panel.
  3. A new review subtask is created and queued immediately.
Manually triggered reviews follow the same flow as automatic ones — the review agent runs, posts comments, and either approves or requests changes.

Enabling code review

Code review is disabled by default. Enable it per repository:
  1. Navigate to Repositories and open the repository.
  2. Go to the Settings tab.
  3. Toggle Enable code review on.
  4. Choose a Review trigger (on_ci_pass is recommended).
  5. Optionally select a Review model and customize the Review prompt template.
  6. Save settings.
Enabling code review for a repository affects all future tasks. Existing tasks that are already in pr_opened state will not retroactively receive a review unless you trigger one manually.

Build docs developers (and LLMs) love