Skip to content

feat(review-pr): request reviewer from stakeholders for spec PRs#417

Draft
captainsafia wants to merge 1 commit intomainfrom
oz-agent/spec-pr-reviewer-request
Draft

feat(review-pr): request reviewer from stakeholders for spec PRs#417
captainsafia wants to merge 1 commit intomainfrom
oz-agent/spec-pr-reviewer-request

Conversation

@captainsafia
Copy link
Copy Markdown
Collaborator

Summary

Spec-only PRs (all files under specs/) previously skipped reviewer selection entirely. This PR adds stakeholder-based reviewer requests to the spec PR review flow, so the right maintainer is automatically tagged when a spec is approved.

Changes

core/workflows/review_pr.py

  • New _format_spec_reviewer_section(): Builds a prompt section for spec PRs telling the agent to extract code paths mentioned in the spec content (e.g. "Relevant code" or "Proposed changes" sections in tech specs) and match them against .github/STAKEHOLDERS to recommend a single reviewer.
  • gather_review_context(): Added an elif spec_only: branch that loads .github/STAKEHOLDERS from the repo and builds the spec_reviewer_section. A new spec_reviewer_section field is added to ReviewContext.
  • build_review_prompt_for_dispatch(): Appends spec_reviewer_section to the cloud-mode prompt, after the existing non-member section.
  • apply_review_result(): Expanded the reviewer-request condition from is_non_member to is_non_member or spec_only. On APPROVE, the resolved reviewer is requested via pr.create_review_request(). On REJECT, no reviewer is requested (spec PRs use COMMENT, not REQUEST_CHANGES).

tests/test_review_pr_reviewer_sampling.py

  • Added SpecReviewerSectionTest covering prompt content.
  • Added four new cases to ApplyReviewResultVerdictTest:
    • Approve spec PR → reviewer requested with COMMENT event
    • Reject spec PR → no reviewer requested
    • Approve spec PR with no feedback → reviewer still requested (no review body)
    • Approve spec PR with empty recommended_reviewers → deterministic STAKEHOLDERS fallback

Behavior

PR type Verdict Reviewer requested? Review event
Non-member impl APPROVE ✅ (STAKEHOLDERS match on diff paths) COMMENT
Non-member impl REJECT REQUEST_CHANGES
Member impl Any COMMENT
Spec (any author) APPROVE ✅ (STAKEHOLDERS match on spec code paths) COMMENT
Spec (any author) REJECT COMMENT

Conversation: https://staging.warp.dev/conversation/c732efab-ad5f-4b1a-ad6c-4f9a0283ee30
Run: https://oz.staging.warp.dev/runs/019de183-0edf-7549-adf5-b89008d15c3e

This PR was generated with Oz.

For spec-only PRs (all changed files under specs/), load .github/STAKEHOLDERS
and include a prompt section instructing the agent to extract code paths
mentioned in the spec content (e.g. 'Relevant code' sections in tech specs)
and match them against the stakeholder roster to recommend a single reviewer.

On APPROVE verdict, apply_review_result() calls pr.create_review_request()
with the resolved reviewer, mirroring the existing non-member flow. On REJECT,
no reviewer is requested (spec PRs always use COMMENT, not REQUEST_CHANGES).

The deterministic STAKEHOLDERS fallback is used when the agent returns an
empty or invalid recommended_reviewers list.

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant