Repository navigation
fix(smoke-gate): anchor release-PR check-wait to a SHA - #1741
Merged
Merged
Conversation
Replays the 1.17.0 race (finalize's sync-issues push re-triggering release PR CI after the wait already observed a green, pre-push check set) against the wait step's real bash: required checks green for a superseded SHA must never satisfy the wait, a head move straddling the checks query must be discarded rather than judged, and the confirmed SHA must be exposed for the promote lane's last-mile guard to consume. Refs: #1737
The smoke listener's wait-release-pr-ci job could observe a complete, green required-check set for the release PR's pre-push head SHA and let trigger-promote-release dispatch promote-release.yml while finalize's sync-issues push was still re-triggering that PR's CI -- a timing race, live on the 1.17.0 train, not a content defect. The wait now holds on two conditions per iteration: the release branch (read from the PR itself) carries no queued/in_progress workflow run, and the required-check read is anchored by a headRefOid snapshot taken immediately before and after the query, discarding the observation on any mismatch instead of judging it. The confirmed SHA is exposed as a job output and consumed by a new last-mile guard in trigger-promote-release that re-checks the PR head immediately before dispatch, failing loudly on a mismatch rather than surfacing promote-release.yml's own (unchanged, still correct) "checks still in progress" refusal. Refs: #1737
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.
Description
The cross-repo smoke gate's
wait-release-pr-cijob could observe acomplete, green required-check set for the release PR's pre-push head SHA
and let
trigger-promote-releasedispatchpromote-release.ymlwhilerelease.yml'sfinalizejob'ssync-issuespush was still re-triggeringthat PR's
pull_requestCI.promote-release.yml'sValidate promote prerequisitesstep then refused with "PR # has checks still inprogress" -- a timing race, not a content defect. Live on the 1.17.0 train
(run
36389373270; a plain re-dispatch, run36392110808, passed cleanlyover identical content). Incident record: #1735.
Type of Change
fix-- Bug fixtest-- Adding or updating testsdocs-- Documentation onlyChanges Made
wait-release-pr-ci's poll step now holds on two conditions eachiteration:
queued/in_progresson the release branch (resolved viagh pr view --json headRefName, never reconstructed from the version). This is the halfthat actually holds the wait across the whole
finalize->sync-issues-> push chain, since theSync Issues and PRsrun itselfis
in_progresson the branch for as long as it takes to push.headRefOidis readimmediately before and immediately after
gh pr checks --required; amismatch discards the observation (no pass, no fail/cancel verdict)
instead of judging it. This catches a push landing in the narrow
window of the checks query itself, which a per-iteration recheck 30s
apart would not: on the 1.17.0 incident
sync-issuesran for ~63s(
06:57:29->06:58:32), longer than one poll interval.wait-release-pr-cijob output (head_sha).trigger-promote-releasegained a cheap last-mile guard step thatre-reads the PR head immediately before dispatching
promote-release.ymland fails with an explicit, actionable message on a mismatch, rather than
surfacing the confusing downstream "checks still in progress" refusal.
promote-release.yml's own guard is unchanged and still correct -- itrefuses before the irreversible undraft, and this PR does not loosen it.
docs/CROSS_REPO_RELEASE_GATE.md: documents the new wait contract andadds a troubleshooting entry for the race.
Preserved unchanged: the
CLOSED-> error andMERGED-> warn-and-exit-0early outs, the
--requiredfilter, the "no required checks reported yet"tolerance, the
gh pr checkstransient-failure retry, thefail/cancel-only-when-
PENDING_COUNT-is-0 rule, theTIMEOUT/INTERVALstructure, and the timeout error message.
Changelog Entry
IMPORTANT -- not live until mirrored to smoke-test
mainrepository_dispatchalways runs the default-branch version of thelistener workflow (
docs/CROSS_REPO_RELEASE_GATE.md, Contract dependencies#2). This devkit asset change is not live on the smoke gate until it
reaches
devkit-smoke-testmainthrough that repo's own release cycle (oran explicit hotfix mirror, per precedent devkit-smoke-test#345/#353). This
is owed follow-up work, out of scope for this PR, and should land before
the next final train that could otherwise reproduce the race.
Audit: does devkit's own promote path need the same fix?
The issue's Notes asked whether devkit's own promote path deserves the same
audit, since
release.yml'sfinalizejob also triggerssync-issues.ymland that push can re-trigger the release PR's CI.
Conclusion: no automated-dispatch hazard found; not changed here.
release.ymlfinalizejob triggerssync-issues.ymlandwaits synchronously for it to complete inside the same job (see
"Trigger sync-issues workflow and wait" / "Record post-sync branch tip"),
before
build-and-testand the rest of the pipeline even start. There isno separate "wait for green checks, then auto-dispatch promote" job chain
like the smoke listener's
wait-release-pr-ci->trigger-promote-release.promote-release.ymlis dispatched manually by a human(
just promote-release X.Y.Z), only after: (a) smoke-test has publishedits final GitHub Release, and (b) the human approves the release PR --
"the cycle's single human approval" (
docs/RELEASE_CYCLE.md). Its ownvalidatejob re-checks CI green and approval synchronously at the momentof manual dispatch.
landing is a possible but self-correcting mistake (the existing
CI_PENDINGguard refuses loudly, and a human just waits and re-runs) --not the systemic, unattended race [BUG] Smoke gate dispatches promote while the finalize sync-issues push is re-running PR CI #1737 describes for the smoke listener.
No follow-up issue filed for devkit's own promote path; happy to file one if
review disagrees with this read.
Testing
gh, described below)Manual Testing Details
New harness
tests/test_smoke_release_pr_check_wait.pyexecutes the pollstep's and the guard step's real bash against a stubbed
gh(reusing thepattern from
tests/test_smoke_dispatch_wait.py). RED phase confirmedagainst the unmodified workflow (12/13 new tests failed); GREEN after the
fix (13/13, plus the pre-existing suite untouched):
prek run --all-filesis green (actionlint, shellcheck, sync-manifestincluded).
Checklist
docs/templates/,then run
just docs) -- N/A,docs/CROSS_REPO_RELEASE_GATE.mdis nota templated doc
CHANGELOG.mdin the[Unreleased]section (andpasted the entry above)
change stands alone; the smoke-test
mainmirroring is owedfollow-up work (see above), not a dependency of this PR
Additional Notes
TDD commits, in order:
test: add SHA-anchored release-PR check-wait coverage-- failing testsfirst
fix: anchor release-PR check-wait to a SHA in the smoke gate--minimal implementation
docs: document the SHA-anchored release-PR check-wait contract--docs + changelog
Refs: #1737