Skip to content

feat(review): per-PR review targeting and a Run review action on PR cards - #6136

Open
axisrow wants to merge 1 commit into
OrchestratorInc:mainfrom
axisrow:upstream/per-pr-run-review
Open

axisrow wants to merge 1 commit into
OrchestratorInc:mainfrom
axisrow:upstream/per-pr-run-review

Conversation

@axisrow

@axisrow axisrow commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Per-PR review targeting for multi-PR sessions: each PR card on a session learns which review run produced it, and a Run review action on the card launches a review scoped to that PR — instead of routing every review through the generic review tab and re-targeting by hand.

  • Review runs record their target PR; the card surfaces the matching run and its state.
  • Run review on a card starts a new run pinned to that PR (backend: review targeting + HTTP endpoints; CLI: review flag wiring).
  • Session inspector renders per-PR review state on the card.

Fixes #6132

Gates

  • go generate ./... regenerated openapi.yaml on the current base; api:ts → schema.ts has no drift; specgen tests pass.
  • go test -race green for internal/review, internal/service/review, internal/cli, internal/httpd/controllers, internal/httpd/apispec/specgen.
  • typecheck + typecheck:e2e clean; vitest: SessionInspector, session-reviews, i18n coverage — 137 passed.
  • gofmt clean. (golangci-lint not installed locally — left to CI.)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🏆 Review leaderboard

Sep 25, 2026–Oct 2, 2026 · UTC

Rank Reviewer PRs reviewed Review rounds PR comments
🥇 @illegalcall @illegalcall 30 53 9
🥈 @ronishrohan @ronishrohan 24 33 7
🥉 @nikhilachale @nikhilachale 22 39 8
4 @Prasad-D-Ware @Prasad-D-Ware 14 32 3
5 @codebanditssss @codebanditssss 11 15 1
6 @Vaibhaav-Tiwari @Vaibhaav-Tiwari 7 7 5
7 @Annieeeee11 @Annieeeee11 6 16 5
8 @neversettle17-101 @neversettle17-101 6 7 4
9 @harshitsinghbhandari @harshitsinghbhandari 5 7 0
10 @mohakchakraborty2004 @mohakchakraborty2004 5 5 3

Ranked by distinct external PRs reviewed, then review rounds, then PR comments. Self-activity and bot activity are excluded.

Show 9 more reviewers
Rank Reviewer PRs reviewed Review rounds PR comments
11 @Rishet11 @Rishet11 2 2 9
12 @Pulkit7070 @Pulkit7070 2 2 1
13 @somewherelostt @somewherelostt 1 3 2
14 @Pritom14 @Pritom14 1 1 2
15 @AgentWrapper @AgentWrapper 1 1 0
16 @aprv10 @aprv10 1 1 0
17 @Ayash-Bera @Ayash-Bera 1 1 0
18 @IRONICBo @IRONICBo 1 1 0
19 @LaibaFirdouse @LaibaFirdouse 1 1 0

@axisrow
axisrow force-pushed the upstream/per-pr-run-review branch from f665ca0 to d921708 Compare October 2, 2026 06:46
@i-trytoohard i-trytoohard added comp/daemon Go daemon, process lifecycle, and backend control plane. enhancement New feature or request labels Oct 2, 2026
@i-trytoohard i-trytoohard added this to the Agents & orchestration milestone Oct 2, 2026
@axisrow

axisrow commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Friendly bump — happy to adjust anything here if reviewers have feedback.

@axisrow
axisrow force-pushed the upstream/per-pr-run-review branch from 1da2d19 to 220bb0e Compare October 4, 2026 05:13
…ards (#57)

A worker session can accumulate multiple open PRs, but review triggering
was session-wide: the Reviews tab's single trigger reviewed every eligible
PR, and it was unclear which PR a pass would target. The action now lives
on the object it acts on.

- POST /sessions/{id}/reviews/trigger accepts an optional prUrl; when set,
  the engine plans only that PR (unknown URL -> 422), omitted keeps the
  session-wide sweep. Threading: controller -> service -> engine.
- ao review trigger gains --pr <url>.
- The inspector's PR cards get a "Run review" button next to Merge that
  triggers a review for that card's PR; pending spinner and error follow
  the merge button's pattern. Merged PRs don't offer it.
- i18n: pr.review.runFor in all 8 locales.

Refs OrchestratorInc#6132

Co-authored-by: axisrow <axisrow@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
(cherry picked from commit 93d9901)
@axisrow
axisrow force-pushed the upstream/per-pr-run-review branch from 220bb0e to b222190 Compare October 4, 2026 05:46
AgentWrapper pushed a commit that referenced this pull request Oct 6, 2026
A requested review now fetches the worker's open PRs fresh from the provider
before deciding what is due, reusing the session claim path, so the pass
reviews the commit really on the PR instead of whatever the SCM observer last
saw. Refresh is bounded (10s) and best effort for tracked PRs: on failure the
trigger falls back to stored facts and REVIEW_HEAD_NOT_OBSERVED. Auto-review
does not refresh.

ao review trigger --pr <url> (request prUrl, matching #6136) reviews only that
PR. If AO does not track it yet it is attached first, never taken over from
another active session (409 REVIEW_PR_OWNED_BY_OTHER_SESSION). With no tracked
PR, the error now points at --pr. Workers are told to pass --pr right after
opening a PR, and to re-trigger when ao review ls shows failed or cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AgentWrapper added a commit that referenced this pull request Oct 6, 2026
…6262)

* feat(review): let agents request AO native review of their own PRs

Workers and orchestrators now start AO's native reviewer directly instead of
spawning a generic worker to review:

- ao review trigger/ls/cancel default to the calling AO session; trigger takes
  --agent/--model/--effort per pass, refuses inside reviewer panes, records
  the pass as source "agent", and turns on the session's review auto-inject
  unless --no-inject.
- A head that is already being reviewed or already has a review is rejected
  with 409 REVIEW_ALREADY_RUNNING / REVIEW_HEAD_ALREADY_REVIEWED; --rerun
  reviews it again (migration 0175 narrows the unique key to running passes)
  or adds a reviewer with another agent alongside a running one.
- Reviewers with different agents run concurrently: trigger no longer tears
  down a working reviewer, stale-pane cleanup and cancel cover every reviewer,
  and the list API exposes activeReviewers.
- Approved verdicts are delivered to the worker when auto-inject is on, with
  wording that an AO approval is not a GitHub approval and never authorizes
  merging.
- New project setting workersRequestReview chooses whether workers request a
  review when ready or ask first; the orchestrator prompt no longer routes
  code review to spawned workers.
- With no reviewer configured, the reviewer defaults to the project's default
  worker agent and its model/effort, never its permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(review): keep parallel reviewers alive across worker restore

Restoring a worker restored its selected reviewer by tearing down every
other reviewer and cancelling its passes as "reviewer agent was switched".
With concurrent reviewers that cancelled a reviewer still running alongside
the selected one. Restore now releases only idle reviewer panes, and fails
another reviewer's running passes only when its pane did not survive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(review): show agent-started reviews live and keep Chat reviewers on restore

Found testing #6262 with real agents in a dev build:

- The inspector never refreshed when a review started or finished outside
  the window (an agent's ao review trigger, auto-review, a reviewer's
  submit): local review_run CDC only refreshed workspaces. Refresh that
  session's reviews on review_run_created/updated.
- When an agent picked a non-default reviewer (--agent codex) the selected
  reviewer stayed current although idle, so the working reviewer had no tab.
  List now reports the working reviewer as current when the selected one is
  idle.
- Worker restore cancelled a running Chat reviewer as having no pane; Chat
  reviewers have none by design and are recovered by RecoverChatReviewers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(review): deliver AO reviews to workers only through PR comments

One channel per review source. The worker now hears AO's reviewer the same
way it hears any reviewer: the SCM observer forwards the reviewer's inline
GitHub comments. AO no longer sends a separate verdict message, which
delivered every review twice and turned optional inline suggestions into
required work.

- Remove post-submit verdict delivery (lifecycle ApplyReviewBatch and the
  review service's delivery step); results are recorded and stay complete.
- The reviewer prompt requires an inline comment for every finding that needs
  a change, including design-level ones, and keeps optional suggestions in
  the summary, because the worker receives only inline comments.
- Worker instructions, CLI output, skill and docs say findings arrive as PR
  review comments and the verdict is in ao review ls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(review): explain a pushed head AO has not observed yet

Right after a push, ao review trigger could refuse with 'already reviewed,
push new commits' because the SCM observer (30s cadence) had not seen the new
commit, so the worker was told to push what it had just pushed. When the head
AO knows is already reviewed, compare it with the workspace's remote-tracking
ref for the PR branch; if the worker has pushed past it, return 409
REVIEW_HEAD_NOT_OBSERVED with both commits and a retry hint. No automatic
retry: the worker retries once AO has seen the push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(review): refresh PRs from the provider and accept --pr on trigger

A requested review now fetches the worker's open PRs fresh from the provider
before deciding what is due, reusing the session claim path, so the pass
reviews the commit really on the PR instead of whatever the SCM observer last
saw. Refresh is bounded (10s) and best effort for tracked PRs: on failure the
trigger falls back to stored facts and REVIEW_HEAD_NOT_OBSERVED. Auto-review
does not refresh.

ao review trigger --pr <url> (request prUrl, matching #6136) reviews only that
PR. If AO does not track it yet it is attached first, never taken over from
another active session (409 REVIEW_PR_OWNED_BY_OTHER_SESSION). With no tracked
PR, the error now points at --pr. Workers are told to pass --pr right after
opening a PR, and to re-trigger when ao review ls shows failed or cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(review): say a not-yet-visible push clears in seconds

A trigger now refreshes the PR from the provider itself, so the only
remaining window is the provider's own lag right after a push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(review): address AO review of worker-requested review

- Drop the local-git pushed-head probe. The trigger already re-reads the
  PR from the provider, and the probe misfired when the provider was ahead
  of the workspace's tracking ref. The already-reviewed message now says to
  retry after a just-made push.
- Keep the selected-reviewer fields meaning the selected reviewer. Clients
  open a working non-selected reviewer from activeReviewers instead.
- Remove trigger entry points with no production callers and the unused
  delivered-run writer; the delivered status stays for existing rows.
- Cancel legacy harness-less runs once, not once per run.
- Fix a stale ApplyReviewBatch mention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Prateek K <prateek@Prateeks-Mac-mini.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/daemon Go daemon, process lifecycle, and backend control plane. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): per-PR 'Run review' action on PR cards — review controls shouldn't be a separate tab (multi-PR sessions)

2 participants