Skip to content

Commit 613f97a

Browse files
fix: make queued reviews autonomous
1 parent a132ce0 commit 613f97a

5 files changed

Lines changed: 12 additions & 2 deletions

File tree

backend/internal/httpd/apispec/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,9 +1790,12 @@ components:
17901790
type: string
17911791
targetSha:
17921792
type: string
1793+
title:
1794+
type: string
17931795
required:
17941796
- prUrl
17951797
- prNumber
1798+
- title
17961799
- targetSha
17971800
- status
17981801
type: object

backend/internal/review/planner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
type PRReviewState struct {
2727
PRURL string `json:"prUrl"`
2828
PRNumber int `json:"prNumber"`
29+
Title string `json:"title"`
2930
TargetSHA string `json:"targetSha"`
3031
Status StateStatus `json:"status" enum:"needs_review,running,up_to_date,changes_requested,ineligible"`
3132
LatestRun *domain.ReviewRun `json:"latestRun,omitempty"`
@@ -41,6 +42,7 @@ func Plan(prs []domain.PullRequest, runs []domain.ReviewRun) []PRReviewState {
4142
review := PRReviewState{
4243
PRURL: pr.URL,
4344
PRNumber: pr.Number,
45+
Title: pr.Title,
4446
TargetSHA: pr.HeadSHA,
4547
Status: ReviewStateNeedsReview,
4648
}

backend/internal/review/prompt.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Post your review as a comment on the pull request, stating clearly whether it ne
2525
prompt = fmt.Sprintf(`Review the requested pull request(s) for worker session %s.
2626
%s
2727
28+
Complete every review task in the queue autonomously. Do not ask the user whether to continue to the next PR, and do not stop after the first PR unless the provider or checkout is genuinely unusable for every queued task.
29+
2830
Do these steps in order:
2931
1. For each PR below, post a separate review on that pull request and capture its id in one call. Post with `+"`gh api`"+` rather than `+"`gh pr review`"+`: it is the only way to attach inline comments, and its response carries the created review's id, so AO can tell the worker exactly which review to address. Send the review as a JSON body so the inline comments form a proper array of objects:
3032
@@ -56,7 +58,7 @@ func reviewQueueText(spec LaunchSpec) string {
5658
return fmt.Sprintf("\nReview task queue:\n* 1. %s (head commit %s, run %s)\n", spec.PRURL, spec.TargetSHA, spec.RunID)
5759
}
5860
var b strings.Builder
59-
fmt.Fprintf(&b, "\nAO created %d review tasks for this worker session. Review each PR, then submit all results together.\n\nReview task queue:\n", len(spec.ReviewQueue))
61+
fmt.Fprintf(&b, "\nAO created %d review tasks for this worker session. Review every queued PR, then submit all results together.\n\nReview task queue:\n", len(spec.ReviewQueue))
6062
for i, task := range spec.ReviewQueue {
6163
fmt.Fprintf(&b, "* %d. %s (head commit %s, run %s)\n", i+1, task.PRURL, task.TargetSHA, task.RunID)
6264
}

backend/internal/review/prompt_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ func TestReviewTextsIncludesMultiPRQueue(t *testing.T) {
2121
prompt, _ := reviewTexts(spec)
2222
for _, want := range []string{
2323
"AO created 2 review tasks",
24-
"Review each PR, then submit all results together",
24+
"Review every queued PR, then submit all results together",
25+
"Complete every review task in the queue autonomously",
26+
"Do not ask the user whether to continue to the next PR",
2527
"* 1. https://github.com/o/r/pull/1 (head commit sha1, run run-1)",
2628
"* 2. https://github.com/o/r/pull/2 (head commit sha2, run run-2)",
2729
"ao review submit --session mer-1 --reviews -",

frontend/src/api/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ export interface components {
624624
/** @enum {string} */
625625
status: "needs_review" | "running" | "up_to_date" | "changes_requested" | "ineligible";
626626
targetSha: string;
627+
title: string;
627628
};
628629
Project: {
629630
agent?: string;

0 commit comments

Comments
 (0)