Repository navigation
Stop late draft runs cancelling real PR CI - #1708
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
An agent pushes a commit and runs `gh pr ready` seconds later. GitHub can deliver that push's `synchronize` event (payload still draft: true) after `ready_for_review`. Both runs shared one concurrency group with cancel-in-progress, so the late draft run cancelled the real run, skipped every job on the draft gate, and reported ci-ok green on a head nothing had tested. Seen on #1706 and #1707 today; both needed a manual re-run to get a real verdict. Give draft PR runs their own group so they can never cancel a ready-state run. Draft pushes still supersede each other, as do ready pushes. Add a scheduling test that pins the split. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtzNTGaPfJK39cMX68F1qw
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 69910d1. Configure here.
|
Labeled Ready for review by the burn-down agent.
Generated by Claude Code |
Final review briefWhat it does. When an agent pushes and then immediately runs Risk: low. One expression in Look here
Verified
Changes I made: none. Open questions (not blocking):
Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Problem
A PR's
ci-okcan go green on a head where no CI job ran, and the real run gets cancelled. It happened twice in the last ~3 hours:84d95a4(committed 03:14:17Z, ready 03:14:22Z)ci-oksuccess507fbf7(committed 05:08:20Z, ready 05:08:25Z)ci-oksuccess in 14sMerges are still safe (the merge queue runs full CI), but a false green feeds the final-review routine, which can enqueue an untested PR and get it evicted from the queue, and every occurrence costs a manual re-run.
Root cause
Agents push and run
gh pr readya few seconds later. GitHub can deliver that push'ssynchronizeevent, whose payload still saysdraft: true, afterready_for_review. Both runs sharedci-<PR number>withcancel-in-progress: true, so the late draft run cancelled the real run, then skipped every job on thegithub.event.pull_request.draft != truegates, andci-okreported success.Fix
Draft PR runs get their own concurrency group (
ci-<PR>-draft). A draft-payload run can't cancel a ready-state run any more. Draft pushes still supersede each other, and so do ready pushes. Push, merge_group and schedule groups don't change (github.event.pull_requestis null there). Required check names and theci-okgate don't change.A regression test in
scripts/tests/test_ci_scheduling.pypins the split.Proof
ci.ymland passes with the fix. The fullpython3 -B -m unittest discover -s scripts/testspasses (373 tests, 6 skipped).actionlint(37 pre-existing findings, YAML-alias related) andzizmor --offline(59 findings) give the same results before and after.Tests removed or moved
None.
Generated by Claude Code
Note
Low Risk
Workflow-only concurrency grouping change with a pinned unit test; no job logic, required check names, or
ci-okgates change.Overview
Fixes a race where a late
synchronizeevent (payload stilldraft: true) could land afterready_for_review, share the same PR concurrency group, cancel the real CI run, skip all draft-gated jobs, and leaveci-okgreen without testing the head.CI workflow (
ci.yml): appends${{ github.event.pull_request.draft && '-draft' || '' }}to the workflowconcurrency.group, so draft and ready runs no longer cancel each other; push, merge-group, and nightly groups are unchanged. Comments document the failure mode.Regression test (
test_ci_scheduling.py):test_late_draft_run_cannot_cancel_the_ready_runasserts the concurrency group expression includes the draft suffix.Reviewed by Cursor Bugbot for commit 69910d1. Configure here.
Generated by Claude Code