feat(gateway): operator-triggered PR review with selectable reviewer model
Add a channel-neutral review_pr command that runs the adversarial reviewer against an existing pull request and returns structured findings. The Web UI chat and Telegram invoke the same command; the reviewer model is models.reviewer (falling back to models.builder), configurable independently of planner/builder. - forge: PullRequest + PullRequestReader.GetPullRequest (github, gitea) - worktree: Manager.CheckoutPR materialises a PR head for Diff/Snapshot - agentworker: NewOperatorReviewer + ReviewerModel (single model-resolution rule) - gateway: review_pr tool, ChatPRReviewer, wired into TurnRunner for every channel - archied: prReviewer adapter with identity-scoped repo allow-list and per-PR single-flight, so duplicate/concurrent reviews are deterministic Closes archie-core-h019.8.
This commit is contained in:
1 parent
2025e5f1ac
commit
ad1e6ea0d3
18 files changed
+1015
-6
No files matched your search
@@ -129,6 +129,50 @@ func TestPRState(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPullRequest(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
json map[string]any
|
||||
want PullRequest
|
||||
}{
|
||||
{
|
||||
name: "open",
|
||||
json: map[string]any{
|
||||
"number": 7, "title": "Add widget", "body": "Why this matters",
|
||||
"state": "open", "merged": false,
|
||||
"head": map[string]any{"ref": "feature/widget", "sha": "headsha"},
|
||||
"base": map[string]any{"ref": "main", "sha": "basesha"},
|
||||
},
|
||||
want: PullRequest{Number: 7, Title: "Add widget", Body: "Why this matters", HeadRef: "feature/widget", BaseRef: "main", HeadSHA: "headsha", BaseSHA: "basesha", State: "open"},
|
||||
},
|
||||
{
|
||||
name: "merged",
|
||||
json: map[string]any{
|
||||
"number": 7, "title": "Add widget", "body": "",
|
||||
"state": "closed", "merged": true,
|
||||
"head": map[string]any{"ref": "feature/widget", "sha": "headsha"},
|
||||
"base": map[string]any{"ref": "main", "sha": "basesha"},
|
||||
},
|
||||
want: PullRequest{Number: 7, Title: "Add widget", HeadRef: "feature/widget", BaseRef: "main", HeadSHA: "headsha", BaseSHA: "basesha", State: "merged"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c, mux := newTestClient(t)
|
||||
mux.HandleFunc("GET /repos/o/r/pulls/7", func(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(t, w, tt.json)
|
||||
})
|
||||
got, err := c.GetPullRequest(t.Context(), "o", "r", 7)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Fatalf("GetPullRequest = %+v, want %+v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloseIssueWithComment(t *testing.T) {
|
||||
c, mux := newTestClient(t)
|
||||
var commented, edited bool
|
||||
|
||||
Reference in new issue
Block a user