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:
sam committed 2026-09-10 01:09:31 +10:00
1 parent 2025e5f1ac
commit ad1e6ea0d3
18 files changed
+1015 -6

No files matched your search

+22
View File
@@ -192,6 +192,28 @@ func (c *GitHubClient) PRState(ctx context.Context, owner, repo string, number i
return pr.GetState(), nil
}
// GetPullRequest returns the forge-neutral metadata for an existing PR.
func (c *GitHubClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (PullRequest, error) {
pr, _, err := c.gh.PullRequests.Get(ctx, owner, repo, number)
if err != nil {
return PullRequest{}, fmt.Errorf("get pull request %s/%s#%d: %w", owner, repo, number, err)
}
state := pr.GetState()
if pr.GetMerged() {
state = "merged"
}
return PullRequest{
Number: pr.GetNumber(),
Title: pr.GetTitle(),
Body: pr.GetBody(),
HeadRef: pr.GetHead().GetRef(),
BaseRef: pr.GetBase().GetRef(),
HeadSHA: pr.GetHead().GetSHA(),
BaseSHA: pr.GetBase().GetSHA(),
State: state,
}, nil
}
// CloseIssue closes an issue with a final comment (feasibility "won't do").
func (c *GitHubClient) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error {
if comment != "" {