feat(core): make AO-local reviewer backend configurable#2099
Open
drdreo wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 a401 Unauthorizedon everyao review runand had to paste a--commandwrapper 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:
--command <shell>flag (unchanged escape hatch)projects.<id>.review(commandoragent)reviewblock (commandoragent)defaults.agent) when it has a known reviewer adaptercodex(final fallback — preserves existing behavior)A
claude-codeworker now reviews with Claude Code by default;codexremains the fallback only when the worker agent has no adapter (e.g.aider/opencode) or already is codex.Changes
packages/core/src/types.ts— newReviewConfig(agent|command, mutually exclusive);review?added toOrchestratorConfig(global) andProjectConfig(per-project).packages/core/src/config.ts—ReviewConfigSchema(strict, mutual-exclusion refinement) wired into both schemas.packages/core/src/code-review-manager.ts—runClaudeCodeReviewadapter (claude -p <prompt> --permission-mode bypassPermissions --output-format text), a{claude-code, codex}adapter registry, andresolveCodeReviewRunner(...). Resolution happens up front inexecuteCodeReviewRunso a misconfiguredreview.agentfails fast (clear error naming valid values) before any run state changes.runRevieweris kept as an explicit override; the--commandflag now flows throughreviewCommand.packages/cli/src/commands/review.ts—run/executepassreviewCommandinstead of constructing the runner;ao review --helpdocuments the config keys.schema/config.schema.json,README.md,agent-orchestrator.yaml.example, and theao config-helpreference all documentreview.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 unsupportedreview.agent(global & per-project), no regression when the worker agent is alreadycodex,buildClaudeCodeReviewArgsargv, andparseReviewerOutputround-tripping claude-code-style plain + markdown-fenced JSON.All existing tests pass (core 1353, cli 905);
pnpm build,pnpm typecheck, andpnpm lintare green.