Repository navigation
fix(ci): read draft state when the Check run starts - #45
Merged
Merged
Conversation
Quest-Claim: 7ded99f99e912751
A body edit just before marking a PR ready can create its run after the ready_for_review run, cancel it, and still carry draft: true in its payload, leaving the newest required Check failed. Gate validation on the PR's current draft state instead of the event payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 10, 2026 17:44
Collaborator
Author
|
Verification on this PR's head
Limit: GitHub delivered the events in their usual order this time, so this run did not reproduce the reversed order seen on kixelated/token-max#41 ( (Written by Claude Opus 5.5 with medium) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes
quest/m0/ci-ready-race.md: afterquest readyflips a PR, the requiredCheckon its head reports the real source and platform results, so auto-merge can land it without a draft round-trip.Summary
SourceandTests (*)now skip based on the PR's draft state when the run starts, read through the API by a newDraft statejob, instead of thedraftfield in the event payload. Everything else stays the same. Theeditedtrigger and the single cancel-in-progress group per ref are unchanged, and a draft run still failsCheck, so skipped jobs can never satisfy protection.Why not the plan's recommended option
The quest recommended keying the concurrency group by draft state. The run data from kixelated/token-max#41 (head
b7a890a) rules that out:ready_for_reviewrun (42773891405) and theeditedrun (42773891510) were created together. Theeditedrun was created second, so it cancelled the ready run, but its payload still saiddraft: true. It skipped its jobs and failedCheck.Checkat 07:16:56. Auto-merge was armed at 07:22:21 and still did not land. The PR stayed blocked until it was converted to draft and back at 07:23:55.So GitHub judged the PR by the newer run's failing
Check, not by the later passing check run from the older run. With a draft-keyed group, both runs would finish, and the newer draft-payload run would still failCheck, which is the same blocked state as after the re-run. Reading the state at run start fixes the race itself. Each run reads after it is created, so the newest run always sees the state after the last flip and validates a PR that is ready.Other options considered:
edited: it was added in kixelated/token-max#4 so that a retargeted PR is checked against its new base, so it stays.quest readyto mark the PR ready before editing the body (moq-dev/quest): this would avoid the race forquest readyonly. A human edit made while marking ready would still hit it. I made no change upstream. The suggestion is below.Cost: one extra small ubuntu job (a single
gh apicall) on every run. It uses the default token, which can read this public repository's PRs. It requests nopull-requestspermission, becauserelease.ymlcalls this workflow withcontents: readonly and a nested job cannot ask for more. If the read fails or returns anything other thanfalse, validation is skipped andCheckfails (fail closed).Validation
nix shell nixpkgs#actionlint --command actionlintoncheck.ymlandrelease.yml: clean.nix develop --command quest gate just check: passes.quest readyflip runs the new workflow, sincepull_requestruns use the PR's workflow file. The flip edits this body while still a draft, then marks it ready, asquest readydoes. The result is recorded in a comment below.Choices made without asking
Suggested follow-ups
quest readymark the PR ready before it edits the body, so a ready flip triggers one fewer run. Recommendation: drop it. With this fix it only saves one redundant run, and it would need approval to change outsidekixelated.Public API and wire impact
None. CI only.
Caused by
editedtrigger, which shares the cancel-in-progress group withready_for_reviewwhile the jobs read the draft flag from the payload. The payload check itself dates to the initial scaffold commit.Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.01a1c68e-871e-7651-988b-0263de48db9c, round 1The change reads current draft state, preserves the required validation gate, and remains compatible with the release workflow; no actionable regressions were found.