Skip to content

feat(core): make AO-local reviewer backend configurable#2099

Open
drdreo wants to merge 1 commit into
AgentWrapper:mainfrom
drdreo:feat/issue-1
Open

feat(core): make AO-local reviewer backend configurable#2099
drdreo wants to merge 1 commit into
AgentWrapper:mainfrom
drdreo:feat/issue-1

Conversation

@drdreo
Copy link
Copy Markdown

@drdreo drdreo commented Jun 4, 2026

Summary

The AO-local reviewer was hardcoded to shell out to codex, so hosts without Codex/OpenAI credentials (e.g. Claude Code-only setups) hit a 401 Unauthorized on every ao review run and had to paste a --command wrapper into every call. This makes the reviewer backend configurable, defaulting to the agent the user already runs.

Resolution precedence

The reviewer backend resolves in the documented order:

  1. --command <shell> flag (unchanged escape hatch)
  2. per-project projects.<id>.review (command or agent)
  3. global review block (command or agent)
  4. the worker agent (defaults.agent) when it has a known reviewer adapter
  5. codex (final fallback — preserves existing behavior)

A claude-code worker now reviews with Claude Code by default; codex remains the fallback only when the worker agent has no adapter (e.g. aider/opencode) or already is codex.

Changes

  • packages/core/src/types.ts — new ReviewConfig (agent | command, mutually exclusive); review? added to OrchestratorConfig (global) and ProjectConfig (per-project).
  • packages/core/src/config.tsReviewConfigSchema (strict, mutual-exclusion refinement) wired into both schemas.
  • packages/core/src/code-review-manager.tsrunClaudeCodeReview adapter (claude -p <prompt> --permission-mode bypassPermissions --output-format text), a {claude-code, codex} adapter registry, and resolveCodeReviewRunner(...). Resolution happens up front in executeCodeReviewRun so a misconfigured review.agent fails fast (clear error naming valid values) before any run state changes. runReviewer is kept as an explicit override; the --command flag now flows through reviewCommand.
  • packages/cli/src/commands/review.tsrun/execute pass reviewCommand instead of constructing the runner; ao review --help documents the config keys.
  • Docs/schemaschema/config.schema.json, README.md, agent-orchestrator.yaml.example, and the ao config-help reference all document review.agent / review.command.

Tests

New packages/core/src/__tests__/code-review-backend.test.ts (13 tests) covers the full precedence ladder, review.command → shell runner, fail-fast on unsupported review.agent (global & per-project), no regression when the worker agent is already codex, buildClaudeCodeReviewArgs argv, and parseReviewerOutput round-tripping claude-code-style plain + markdown-fenced JSON.

All existing tests pass (core 1353, cli 905); pnpm build, pnpm typecheck, and pnpm lint are green.

The AO-local reviewer was hardcoded to shell out to `codex`, so hosts
without Codex/OpenAI credentials (e.g. Claude Code-only setups) hit a
401 on every `ao review run` and had to paste a `--command` wrapper
into each call.

Introduce a configurable reviewer backend resolved in this precedence:
`--command` flag > project.review > global review > worker agent
(defaults.agent, when it has a reviewer adapter) > codex. This lets the
reviewer default to the agent the user already runs.

- Add `review.agent` / `review.command` config (global + per-project),
  mutually exclusive, with a Claude Code reviewer adapter alongside Codex.
- Resolve the backend up front in executeCodeReviewRun so a misconfigured
  `review.agent` fails fast with a clear error before any run state changes.
- Keep `--command` as the ultimate escape hatch and `runReviewer` as an
  explicit override (preserving existing behavior and tests).
- Document the keys in README, the example config, `ao review --help`, and
  the config-help reference; update the JSON schema.

Closes #1

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant