feat: allow respond-to-pr-comment flow on fork PRs for org members#428
Closed
captainsafia wants to merge 1 commit intomainfrom
Closed
feat: allow respond-to-pr-comment flow on fork PRs for org members#428captainsafia wants to merge 1 commit intomainfrom
captainsafia wants to merge 1 commit intomainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow the
respond-to-pr-commentworkflow to trigger on PRs from forks when the requester is a member of the repository's org (COLLABORATOR, MEMBER, or OWNERauthor_association).Previously, the workflow was unconditionally skipped for fork PRs because
can_push_to_head_branchwasFalse. Now, the webhook handler extracts the requester'sauthor_associationfrom the comment/review object in the payload and allows the dispatch to proceed for trusted org members.Changes
core/workflows/__init__.py_resolve_requester_author_association()helper to extractauthor_associationfrom the webhook payload_ORG_MEMBER_ASSOCIATIONSconstant (mirrorsoz.helpers.ORG_MEMBER_ASSOCIATIONS)RespondWorkflow.build_dispatch(): only returnsNonefor fork PRs when the requester is NOT an org membercore/workflows/respond_to_pr_comment.pyrequester_is_org_memberfield to thePrCommentContextTypedDictgather_pr_comment_context()to accept and pass through the flagapply_pr_comment_result()to skip the early return for org members, allowing the agent to analyze and push changesTests
test_allows_dispatch_for_fork_pr_when_requester_is_org_member)requester_is_org_membercontext handling (test_context_carries_requester_is_org_member,test_context_defaults_requester_is_org_member_to_false)test_skips_dispatch_when_head_branch_is_not_safe_to_pushcontinues to verify non-org-member fork PRs are skippedConversation: 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.