Skip to content

fix: race condition allows auto-verify/auto-merge on AI-resolved cherry-pick PRs #1044

@myakove

Description

@myakove

Problem

When a cherry-pick PR is created with AI-resolved conflicts, the ai-resolved-conflicts label is added AFTER PR creation via add_to_labels. This creates a race condition:

  1. gh pr create creates the PR on GitHub
  2. GitHub immediately fires pull_request.opened webhook
  3. Webhook handler checks for ai-resolved-conflicts label — label doesn't exist yet
  4. Auto-verify and auto-merge proceed because the label is missing
  5. Only after does the cherry-pick handler add the label via PyGithub

Additionally, set_pull_request_automerge() has NO check for ai-resolved-conflicts label at all.

Expected Behavior

Cherry-pick PRs with AI-resolved conflicts should NOT be auto-verified or auto-merged, since they require manual review.

Observed Behavior

PR #350 in RedHatQE/mtv-api-tests was auto-verified and auto-merged despite having AI-resolved conflicts.

Deliverables

  • Add --label flags to gh pr create command for cherry-pick PRs so labels are present from creation
  • Add ai-resolved-conflicts check in set_pull_request_automerge()
  • Add tests for the race condition fix

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