Repository navigation
Description
This was generated by AI during triage.
Context
On 2026-11-06, v0.21.0 (1cb88a3, tagged on release-0.21.0 from 8ee0544) finished publishing and merged its bump PR (#1812) into main as a7d76bb. While v0.21.0 was publishing, PR #1804 had merged into main at ad061e2 (where Cargo.toml was still 0.20.6).
When scripts/release.sh 0.22.0 was started right after #1812 merged, a7d76bb's push CI run on main was still in progress, while ad061e2's push CI run had already succeeded:
check_can_releasefoundprevious=v0.21.0(git describe --tags --abbrev=0 --match 'v[0-9]*' origin/main) and callednewest_green_main v0.21.0.- Because
v0.21.0is tagged on the bump commit (1cb88a3, parent8ee0544),git rev-list --first-parent origin/main ^v0.21.0walked past the merge commita7d76bbtoad061e2, which is not an ancestor ofv0.21.0(1cb88a3) — nor doesad061e2havev0.21.0as an ancestor. release.shcutrelease-0.22.0(4bf0f9a) fromad061e2, bumpingCargo.tomlandCargo.lockfrom0.20.6 -> 0.22.0instead of0.21.0 -> 0.22.0, and generated its release summary back tov0.20.6(git describefromad061e2could not seev0.21.0).- Because Release 0.22.0 #1813 (
0.20.6 -> 0.22.0) conflicted withmain(0.20.6 -> 0.21.0), GitHub never startedpull_requestCI workflow runs on4bf0f9a, and both the initial invocation and subsequent resumes hung forever inwait_for_pr_checks.
The same conflict also arises if an earlier release's bump PR merges into main (or a new release tag lands on main) after a release's candidate commit, pushed bump branch, or open untagged bump PR was already created from an older main commit that does not descend from the latest release tag on origin/main.
Agent Brief
Category: bug
Summary: Require a release's base commit on main to have origin/main's latest release tag as an ancestor, and re-cut an untagged candidate/branch/open bump PR when origin/main has since gained a release tag that is not in the bump's ancestry.
Current behavior:
newest_green_main <exclusive ancestor>walksgit rev-list --first-parent origin/main ^<ancestor>. When<ancestor>is a release tagvX.Y.Zplaced on arelease-X.Y.Zbump commit and merged intomainafter concurrent PR merges onmain, commits onmainbetween the tag's parent and the bump PR's merge commit are not ancestors ofvX.Y.Zand are returned bygit rev-list, even thoughvX.Y.Zis not an ancestor of those commits and theirCargo.tomlstill has the pre-vX.Y.Zversion.- If a pinned candidate ref (
refs/thirdshift/release-candidates/<version>), an untagged pushedrelease-<version>branch, or an untaggedOPENbump PR was cut from a base commit that does not haveorigin/main's latestv[0-9]*release tag as an ancestor (for example, because the previous release's bump PR merged intomainafterwards, or because it was cut beforea7d76bb's CI finished), resumingrelease.sh <version>keeps the stale bump commit (0.20.6 -> 0.22.0) and waits forever forpull_requestCI on a conflicting PR.
Desired behavior:
- Release base ancestry requirement. When a
v[0-9]*release tag exists onorigin/main(previous=$(git describe --tags --abbrev=0 --match 'v[0-9]*' origin/main)), any candidatemaincommit selected as a release base must havepreviousas an ancestor (git merge-base --is-ancestor "$previous" "$base"), in addition to being strictly newer than<exclusive ancestor>with a successful latest pushCIrun. Commits onmainbefore the merge ofpreviousintomaindo not qualify; if the merge commit ofprevious(and any newer commits onmain) have not yet completed a green pushCIrun,check_can_releasewaits until a commit descending fromprevioussucceeds. - Pinned candidate ref. If
refs/thirdshift/release-candidates/<version>points to a commit that is no longer a valid release base fororigin/main's current latest release tag (i.e.origin/mainhas av[0-9]*tag that is not an ancestor of the pinned commit, orversionis no longer higher thanCargo.tomlonorigin/main),commit_bumpdoes not reuse that stale pin: it re-runscheck_can_releaseand updates the candidate ref to the new release base. - Untagged pushed branch or open bump PR predating the latest release tag on
origin/main. On resume whentaggedis empty andpr_stateis empty (pushed branch with no PR) orOPEN(open untagged bump PR), aftervalidate_bump_prconfirms the existing branch/PR is a valid bump from its own merge base: iforigin/mainnow has av[0-9]*release tag (previous, excluding$tag) that is not an ancestor of the bump commit's parent ($head^1), the existing bump predates that release merge onmainand will conflict withmain. In that case:- Re-verify that
$versionis still higher thanCargo.tomlonorigin/main(refusing if not). - Select a new release base on
origin/mainthat descends fromprevious(waiting for green pushCIonmainif needed, just ascheck_can_releasedoes), runwait_for_experimentfor the new base, regenerate the summary and version diff (honoring--reviewbefore pushing), force-push the re-cut bump commit torefs/heads/$branchonorigin, and either open the PR (when none existed) or update the open PR's body withedit_prbeforewait_for_pr_checks. - Print a stamped progress line naming the re-cut from the new base commit on
main.
- Re-verify that
- Tagged or merged releases remain untouched. If
$taggedis non-empty or$pr_stateisMERGED, existing behavior is unchanged (recover_failed_releasecontinues to own recovery for failed unpublished tags, and published releases are never moved).
Key interfaces:
scripts/release.sh:check_can_release,newest_green_main,commit_bump, and the untagged resume path inmain, plus the header comment inscripts/release.sh.docs/guide.mdandsite/docs/index.html(regenerated vianpm run docs --prefix site): update the Releasing section to describe howrelease.shselects a base commit descending from the last release tag and re-cuts an untagged branch/PR if a release tag lands onmainahead of its base.tests/release.rs/tests/release/: black-box release script tests.
Acceptance criteria:
- When
v0.1.0was tagged on arelease-0.1.0bump commit and merged intomainafter another PR merged intomain(so the earlier PR's merge commit is not an ancestor ofv0.1.0and also does not descend fromv0.1.0), and therelease-0.1.0merge commit onmainstill has pending pushCIwhile the earlier PR's merge commit has green pushCI,release.sh 0.2.0does not select the pre-v0.1.0-merge commit; it waits for a commit onmainthat hasv0.1.0as an ancestor to pass pushCI, cutsrelease-0.2.0from that commit (0.1.0 -> 0.2.0), and summarizes only PRs merged sincev0.1.0. - If an untagged
release-0.2.0branch (with or without an open bump PR) or a savedrefs/thirdshift/release-candidates/0.2.0ref was cut from amaincommit beforev0.1.0's bump PR merged intomain, runningrelease.sh 0.2.0afterv0.1.0is onorigin/mainre-cutsrelease-0.2.0from the newest greenmaincommit descending fromv0.1.0, force-pushesrelease-0.2.0, updates the open PR body (or opens the PR), waits for checks on the new head, tagsv0.2.0, and merges. - With
--review, declining (n) during that untagged re-cut exits1without force-pushingrelease-<version>or editing the open PR body. -
docs/guide.mdandsite/docs/index.html(npm run docs:check --prefix site) are updated to match. - Existing release tests in
tests/release.rscontinue to pass.
Out of scope:
- Using
thirdshift fixonrelease-<version>branches (a Fix run mergesorigin/maininto the PR branch, whereasrelease.shrequires the bump head to be a single version-only commit on top of itsmainbase commit). - Moving or re-cutting a tag once the GitHub Release is published.
- Changing how
v<version>tags are placed on the bump commit or when bump PRs are merged.
Activity