Skip to content

fix(source-control): marking a PR ready right after a push can leave ci-status failing on the draft run #6127

Description

@kyle-sexton

Problem

On #6120 I pushed a merge of main and ran gh pr ready within seconds. The ci run for the new head started while the PR was still a draft, and ci-status failed with draft: lanes not run. Mark the pull request ready to lint and test this SHA. No ready_for_review run appeared for that head, so the PR sat red. A rerun does not help: it replays the original draft payload. What fixed it was switching the PR back to draft and marking it ready again (gh pr ready --undo && gh pr ready).

Proposal

In /source-control:pull-request ready (and anything else that flips a PR to ready), after the flip, confirm a non-draft ci run exists for the head SHA. If none appears within a short bound, toggle draft and ready once and say so. Also worth checking: whether the caller's ci.yml concurrency group lets the draft-time synchronize run cancel or absorb the ready_for_review run.

Evidence

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 3, 2026
  2. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    ContributorAuthor

    This was generated by AI during triage.

    Routing: human-gated, needs decision. The run history answers the issue's concurrency question, and it points at a cause the proposed post-flip check would only work around. Choosing where to fix it is the open decision; the work class depends on that choice.

    What the runs show (inference from run and timeline data on #6120):

    • 20:09:47 commit 82713ea pushed; 20:09:49 ready_for_review event.
    • 20:09:52 ci run 37150546945 was created on the old head 97f0eb6; every job started and was then cancelled.
    • 20:09:54 ci run 37150548659 (the push's synchronize run on 82713ea) was created with a payload that still said draft. It joined the same per-PR concurrency group with cancel-in-progress, cancelled the ready run, skipped its lanes, and failed ci-status as a draft.
    • So a ready run did appear; it was built on the stale head and was cancelled by the later draft-payload run. The ready-for-review procedure assumes the opposite order (the ready run replaces the push's draft run).

    Basis: verified, gh run list --workflow ci.yml and the jobs API for runs 37150546945 / 37150548659, the #6120 timeline API; .github/workflows/ci.yml:94-101 (per-PR group, cancel-in-progress on pull_request); plugins/source-control/skills/pull-request/reference/ready-for-review.md:80-99 (pushes, then flips immediately; completion criterion only checks isDraft).

    Options:

    1. RECOMMENDED: in /source-control:pull-request ready, after pushing, wait until a ci run exists for the pushed head before flipping. This removes the race for skill-driven flips. C3, one plugin.
    2. The issue's proposal: after the flip, confirm a non-draft ci run exists for the head and toggle draft/ready once if not. A backstop that also catches other causes; can pair with option 1. C3.
    3. Change ci.yml so a run whose payload says draft cannot cancel a later ready run, or so a full run's draft gate reads live state. Fixes manual flips too, but changes the required ci-status gate. C4.

    Agent Brief

    Type: Bug
    Summary: Marking a PR ready seconds after a push can leave ci-status red on a draft-payload run; fix per the option chosen above.

    Current behavior:
    The ready step pushes and flips immediately. The ready_for_review run can start on the stale head and be cancelled by the push's synchronize run, whose payload still says draft, leaving the head with only a failed draft ci-status.

    Desired behavior:
    After a ready flip, the PR head has a non-draft ci run, and the skill reports it. Mechanism per the chosen option.

    Acceptance criteria:

    • The maintainer records the chosen option(s) here.
    • After /source-control:pull-request ready on a just-pushed head, a non-draft ci run exists for that head and its result is reported.

    Out of scope:

    • Other workflows' draft handling.
  3. added
    priority: mediumReal value, no hard deadline; normal backlog flow.
    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.
    status: needs-decisionAwaiting a human or maintainer judgment call.
    and removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 4, 2026
  4. kyle-sexton commented on Oct 11, 2026

    @kyle-sexton
    ContributorAuthor

    Recurred five times on 2026-10-11: #6948, #6977, #7036, #6991, #7164. Each time a push followed by gh pr ready seconds later left only a draft-payload ci run, all lanes skipped and ci-status red. Workarounds used: a draft/ready toggle or an empty commit.

    Maintainer decision: option 1. /source-control:pull-request ready waits for the push's ci run to register before flipping the PR to ready.

  5. kyle-sexton commented on Oct 11, 2026

    @kyle-sexton
    ContributorAuthor

    Owner decision (2026-10-11): /source-control:pull-request ready waits until a ci run exists for the pushed head before the flip; after the flip, if no non-draft run appears, toggle draft/ready once. Option 3 (changing the required ci-status check) is rejected.

    Recorded by the coordinating agent session with the owner's approval. Removing needs-human; implementation is queued and will link its branch here.

  6. removed
    status: needs-decisionAwaiting a human or maintainer judgment call.
    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.
    on Oct 11, 2026
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

    priority: mediumReal value, no hard deadline; normal backlog flow.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions