Skip to content

pr_review.py wait Reports Checks Complete Before a Fresh Head's Jobs Register #3451

Closed

Description

@ptr727

Context

scripts/pr_review.py wait on a pull request into a non-default branch reads an attested local pass as coverage=local, then polls the head's checks "while they can still move its merge". Run right after a push, it can report the checks complete before the push's workflow jobs exist.

What Happens

Observed on a downstream repository whose pull request workflow fans out a compile matrix of about thirty jobs behind a change-detection job.

  1. Push a new head, run attest, then run wait.
  2. wait prints checks=5/5 and merge=CLEAN, and exits 0 after waited=2s.
  3. At that moment only the change-detection job, the matrix-build job, a reviewer status, and the skipped bot jobs had registered against the head. The compile and lint jobs were still queued, and gh pr checks listed them as pending a few seconds later.
  4. The run then took several more minutes, and status afterwards read checks=36/36.

A driver trusting the exit would judge the pull request green with most of its required jobs not yet started.

Likely Cause

The poll counts the check runs that exist at the moment it reads, and on a fresh head the jobs a workflow will create have not been attached yet. A matrix job's children are created only after its upstream jobs finish, so the window spans the whole first stage.

Suggested Change

Treat a head whose workflow runs are still queued or in_progress as not settled, rather than reading only the check runs attached so far. Alternatively, keep polling until the check-run count stops growing across a grace interval. --check-grace already names a similar wait for a required status nothing has posted.

Done When

wait run right after a push does not exit 0 while that head's workflow runs are queued or in progress, and a regression test covers the fresh-head case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions