agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

[Bug]: --reviewer is documented as repeatable but only the first value is ever used

Open ryanlawyer opened this issue 2 months ago • 4 comments

Summary

ao project set-config --reviewer advertises itself as repeatable:

--reviewer stringArray   Reviewer harness that reviews worker PRs (repeatable; e.g. claude-code)

Additional values are accepted, validated and stored, but never consumed. Every reader takes index 0 only, so configuring two reviewers silently behaves identically to configuring one.

Evidence

backend/internal/domain/projectconfig.go:102-105:

func (c ProjectConfig) ResolveReviewerHarness(worker AgentHarness) ReviewerHarness {
	if len(c.Reviewers) > 0 {
		return c.Reviewers[0].Harness
	}
	...

backend/internal/review/review.go:1351:

	return cfg.Reviewers[0].Harness, cfg.Reviewers[0].AgentConfig, nil

The only place that iterates the slice is the validation loop at projectconfig.go:203 (for i, rv := range c.Reviewers), which checks the extra entries and then discards them. Nothing else ranges over Reviewers.

Expected

Either:

  • multiple reviewers actually run (the behavior the help text implies), or
  • the flag is documented as single-valued, and supplying more than one is rejected at config time rather than silently ignored.

Actual

Silent no-op for every entry after the first. A user who configures two reviewers reasonably believes they have two and has one.

Why this matters beyond the docs bug

The natural reason to want multiple reviewers is diversity — e.g. having a change reviewed by a model from a different vendor than the one that authored it, to avoid correlated blind spots. That use case reads directly off the help text and does not work. Worse, it fails quietly: there is no warning, and the config round-trips showing both entries.

Related: when no reviewer is configured at all, ResolveReviewerHarness falls back to the worker's own harness (the switch worker block above). So the default is same-vendor self-review, and the one documented knob that looks like it would fix that doesn't. Worth at least calling out in the docs.

Version

Observed against main at commit 87cb4b6.

ryanlawyer avatar Sep 15 '26 21:09 ryanlawyer

I traced the current reviewer flow and confirmed the mismatch goes beyond the CLI definition.

--reviewer is configured as repeatable and validation accepts multiple values, but the actual review path consistently consumes only Reviewers[0] (including ResolveReviewerHarness() and the reviewer selection in review.go).

Before implementing a fix, I think we should clarify the intended semantics:

  1. Support multiple reviewers define whether they should run sequentially/concurrently and how their results are handled.
  2. Make --reviewer single-valued reject multiple values at CLI validation time and align the config/help text accordingly.

I’d lean toward deciding this behavior first rather than simply replacing the [0] access with iteration, since that could introduce ambiguous review lifecycle/aggregation behavior.

Once the expected semantics are confirmed, the implementation and tests should be straightforward.

kekubhai avatar Sep 16 '26 12:09 kekubhai

Thanks for tracing and confirming this.

My preference is option 1: support multiple reviewers. The cross-provider review case is the main reason I noticed the repeatable flag, and reducing it to a single value would remove that capability rather than merely correct the mismatch.

Suggested semantics:

  • Every configured reviewer evaluates the same PR head independently.
  • Execution may be sequential initially; concurrency can remain an implementation or scheduling choice and should not change the result.
  • A new commit invalidates the aggregate result and requires each configured reviewer to evaluate the new head.
  • Any changes_requested result keeps the review unresolved.
  • The PR is considered fully reviewed only after every configured reviewer has completed successfully for that head.
  • Reviewer failure or timeout is surfaced as incomplete/failed, never treated as approval.
  • Individual verdicts remain attributed and visible rather than being collapsed into one anonymous result.

That would give the configuration meaningful, predictable behavior without requiring concurrent execution in the first implementation.

ryanlawyer avatar Sep 16 '26 13:09 ryanlawyer

Thanks for clarifying the intended semantics. That makes the implementation path clear.

I’ll proceed with multi-reviewer support while keeping the first implementation sequential and preserving the existing single-reviewer behavior.

I’ll trace the full review lifecycle first, then update the reviewer execution/aggregation so that each configured reviewer evaluates the same PR head independently, individual verdicts remain attributed, and the aggregate state is only complete once every reviewer has successfully reviewed the current head.

I’ll also add regression coverage for changes requested, reviewer failures/timeouts, multiple reviewers, and invalidation when a new commit is pushed.

I’ll avoid simply looping over the existing Reviewers[0] access and will keep the change aligned with the existing review state model.

kekubhai avatar Sep 17 '26 11:09 kekubhai

Hi @kekubhai, are you still working on this, or is there an existing branch/PR I should coordinate with? If it's available, I'd like to take it on.

I'd like to implement full multi-reviewer support, following the semantics discussed above:

  • Each configured reviewer independently evaluates the same PR head SHA.
  • Execution is sequential initially, preserving existing single-reviewer behavior.
  • A new commit invalidates the aggregate result; every configured reviewer must review the new head.
  • Any changes_requested verdict blocks aggregate approval.
  • Reviewer failures or timeouts remain explicitly incomplete/failed and never count as approval.
  • Individual reviewer identities, verdicts, and reviewed SHAs remain visible.
  • Aggregate approval requires successful approval from every configured reviewer for the current head.

My use case is coordinating developer and QA agents across different providers, with review results tied to an exact commit. Full multi-reviewer support would directly address that need.

Before implementing, I'll reproduce the issue against current main, review the lifecycle changes in #5705, and identify the execution, persistence, and aggregation changes needed. I'll add regression coverage for multiple reviewers, single-reviewer compatibility, rejection, failure/timeout, and head changes during review.

Can I work on this? Could the core team confirm whether this scope and the proposed semantics are acceptable?

pablogore avatar Oct 29 '26 19:10 pablogore