Skip to content

feat: allow respond-to-pr-comment flow on fork PRs for org members#428

Closed
captainsafia wants to merge 1 commit intomainfrom
oz-agent/allow-fork-pr-respond-for-org-members
Closed

feat: allow respond-to-pr-comment flow on fork PRs for org members#428
captainsafia wants to merge 1 commit intomainfrom
oz-agent/allow-fork-pr-respond-for-org-members

Conversation

@captainsafia
Copy link
Copy Markdown
Collaborator

Summary

Allow the respond-to-pr-comment workflow to trigger on PRs from forks when the requester is a member of the repository's org (COLLABORATOR, MEMBER, or OWNER author_association).

Previously, the workflow was unconditionally skipped for fork PRs because can_push_to_head_branch was False. Now, the webhook handler extracts the requester's author_association from the comment/review object in the payload and allows the dispatch to proceed for trusted org members.

Changes

core/workflows/__init__.py

  • Added _resolve_requester_author_association() helper to extract author_association from the webhook payload
  • Added _ORG_MEMBER_ASSOCIATIONS constant (mirrors oz.helpers.ORG_MEMBER_ASSOCIATIONS)
  • Modified RespondWorkflow.build_dispatch(): only returns None for fork PRs when the requester is NOT an org member

core/workflows/respond_to_pr_comment.py

  • Added requester_is_org_member field to the PrCommentContext TypedDict
  • Updated gather_pr_comment_context() to accept and pass through the flag
  • Updated apply_pr_comment_result() to skip the early return for org members, allowing the agent to analyze and push changes

Tests

  • Added test for org member on fork PR being allowed through dispatch (test_allows_dispatch_for_fork_pr_when_requester_is_org_member)
  • Added tests for requester_is_org_member context handling (test_context_carries_requester_is_org_member, test_context_defaults_requester_is_org_member_to_false)
  • Existing test test_skips_dispatch_when_head_branch_is_not_safe_to_push continues to verify non-org-member fork PRs are skipped

Conversation: https://staging.warp.dev/conversation/db278a0a-7b60-45a8-9f68-4f975c7710a8
Run: https://oz.staging.warp.dev/runs/019deece-03df-79ae-903d-1f6d3eb222ec

This PR was generated with Oz.

Previously, the respond-to-pr-comment workflow was unconditionally
skipped for fork PRs because can_push_to_head_branch was False.
This change checks the requester's author_association from the
webhook payload and allows the workflow to dispatch when the
requester is a COLLABORATOR, MEMBER, or OWNER of the repository.

Changes:
- Add _resolve_requester_author_association helper to extract
  author_association from comment/review objects in the payload
- Add _ORG_MEMBER_ASSOCIATIONS constant mirroring oz.helpers
- Modify RespondWorkflow.build_dispatch to allow dispatch when
  requester is an org member, even on fork PRs
- Add requester_is_org_member field to PrCommentContext TypedDict
- Update gather_pr_comment_context to accept and store the flag
- Update apply_pr_comment_result to skip the early return for
  org members so the agent can analyze and push changes
- Add tests for the new behavior

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