Skip to content

fix: cherry-pick PR creation fails when PR author cannot be assigned #1050

Closed

Description

@myakove

Summary

When cherry-picking a PR to target branches, the gh pr create command includes --assignee {pr_author}. If the PR author is not a collaborator with appropriate permissions on the repository, GitHub rejects the assignee and the entire PR creation fails.

Problem / Motivation

This happened on RedHatQE/mtv-api-tests#371 where user rgolangh (who submitted via a fork) could not be assigned on RedHatQE/mtv-api-tests.

Error from logs:

Cherry pick PR creation failed: --- could not assign user: 'rgolangh' not found

Root Cause

In webhook_server/libs/handlers/runner_handler.py line 855:

assignee_flag = f" --assignee {shlex.quote(pr_author)}" if assign_to_pr_owner else ""

The --assignee flag is unconditionally set to the PR author without verifying they can be assigned.

Requirements

  1. When assign_to_pr_owner is enabled, first attempt to use the PR author as assignee
  2. If gh pr create fails due to assignee not found, retry without the --assignee flag (or with a fallback assignee from the OWNERS file / repository approvers)
  3. The cherry-pick PR creation should not fail just because the author can't be assigned
  4. Add test coverage for the fallback scenario

Deliverables

  • Update cherry-pick PR creation to handle assignee failures gracefully
  • Fall back to a maintainer/approver from the OWNERS file if the PR author cannot be assigned
  • Add/update tests for the new behavior

Notes

The fix should be in webhook_server/libs/handlers/runner_handler.py in the cherry-pick PR creation logic. The fallback should be silent (log a warning, not post a PR comment about the fallback).

Activity

  1. added a commit that references this issue on Mar 24, 2026
    cba44b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions