Skip to content

release.sh: require the release base to descend from the last release tag and recut untagged bumps that predate it #1820

Closed

Description

@JacobStephens2

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:

  1. check_can_release found previous=v0.21.0 (git describe --tags --abbrev=0 --match 'v[0-9]*' origin/main) and called newest_green_main v0.21.0.
  2. Because v0.21.0 is tagged on the bump commit (1cb88a3, parent 8ee0544), git rev-list --first-parent origin/main ^v0.21.0 walked past the merge commit a7d76bb to ad061e2, which is not an ancestor of v0.21.0 (1cb88a3) — nor does ad061e2 have v0.21.0 as an ancestor.
  3. release.sh cut release-0.22.0 (4bf0f9a) from ad061e2, bumping Cargo.toml and Cargo.lock from 0.20.6 -> 0.22.0 instead of 0.21.0 -> 0.22.0, and generated its release summary back to v0.20.6 (git describe from ad061e2 could not see v0.21.0).
  4. Because Release 0.22.0 #1813 (0.20.6 -> 0.22.0) conflicted with main (0.20.6 -> 0.21.0), GitHub never started pull_request CI workflow runs on 4bf0f9a, and both the initial invocation and subsequent resumes hung forever in wait_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:

  1. newest_green_main <exclusive ancestor> walks git rev-list --first-parent origin/main ^<ancestor>. When <ancestor> is a release tag vX.Y.Z placed on a release-X.Y.Z bump commit and merged into main after concurrent PR merges on main, commits on main between the tag's parent and the bump PR's merge commit are not ancestors of vX.Y.Z and are returned by git rev-list, even though vX.Y.Z is not an ancestor of those commits and their Cargo.toml still has the pre-vX.Y.Z version.
  2. If a pinned candidate ref (refs/thirdshift/release-candidates/<version>), an untagged pushed release-<version> branch, or an untagged OPEN bump PR was cut from a base commit that does not have origin/main's latest v[0-9]* release tag as an ancestor (for example, because the previous release's bump PR merged into main afterwards, or because it was cut before a7d76bb's CI finished), resuming release.sh <version> keeps the stale bump commit (0.20.6 -> 0.22.0) and waits forever for pull_request CI on a conflicting PR.

Desired behavior:

  • Release base ancestry requirement. When a v[0-9]* release tag exists on origin/main (previous=$(git describe --tags --abbrev=0 --match 'v[0-9]*' origin/main)), any candidate main commit selected as a release base must have previous as an ancestor (git merge-base --is-ancestor "$previous" "$base"), in addition to being strictly newer than <exclusive ancestor> with a successful latest push CI run. Commits on main before the merge of previous into main do not qualify; if the merge commit of previous (and any newer commits on main) have not yet completed a green push CI run, check_can_release waits until a commit descending from previous succeeds.
  • Pinned candidate ref. If refs/thirdshift/release-candidates/<version> points to a commit that is no longer a valid release base for origin/main's current latest release tag (i.e. origin/main has a v[0-9]* tag that is not an ancestor of the pinned commit, or version is no longer higher than Cargo.toml on origin/main), commit_bump does not reuse that stale pin: it re-runs check_can_release and 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 when tagged is empty and pr_state is empty (pushed branch with no PR) or OPEN (open untagged bump PR), after validate_bump_pr confirms the existing branch/PR is a valid bump from its own merge base: if origin/main now has a v[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 on main and will conflict with main. In that case:
    • Re-verify that $version is still higher than Cargo.toml on origin/main (refusing if not).
    • Select a new release base on origin/main that descends from previous (waiting for green push CI on main if needed, just as check_can_release does), run wait_for_experiment for the new base, regenerate the summary and version diff (honoring --review before pushing), force-push the re-cut bump commit to refs/heads/$branch on origin, and either open the PR (when none existed) or update the open PR's body with edit_pr before wait_for_pr_checks.
    • Print a stamped progress line naming the re-cut from the new base commit on main.
  • Tagged or merged releases remain untouched. If $tagged is non-empty or $pr_state is MERGED, existing behavior is unchanged (recover_failed_release continues 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 in main, plus the header comment in scripts/release.sh.
  • docs/guide.md and site/docs/index.html (regenerated via npm run docs --prefix site): update the Releasing section to describe how release.sh selects a base commit descending from the last release tag and re-cuts an untagged branch/PR if a release tag lands on main ahead of its base.
  • tests/release.rs / tests/release/: black-box release script tests.

Acceptance criteria:

  • When v0.1.0 was tagged on a release-0.1.0 bump commit and merged into main after another PR merged into main (so the earlier PR's merge commit is not an ancestor of v0.1.0 and also does not descend from v0.1.0), and the release-0.1.0 merge commit on main still has pending push CI while the earlier PR's merge commit has green push CI, release.sh 0.2.0 does not select the pre-v0.1.0-merge commit; it waits for a commit on main that has v0.1.0 as an ancestor to pass push CI, cuts release-0.2.0 from that commit (0.1.0 -> 0.2.0), and summarizes only PRs merged since v0.1.0.
  • If an untagged release-0.2.0 branch (with or without an open bump PR) or a saved refs/thirdshift/release-candidates/0.2.0 ref was cut from a main commit before v0.1.0's bump PR merged into main, running release.sh 0.2.0 after v0.1.0 is on origin/main re-cuts release-0.2.0 from the newest green main commit descending from v0.1.0, force-pushes release-0.2.0, updates the open PR body (or opens the PR), waits for checks on the new head, tags v0.2.0, and merges.
  • With --review, declining (n) during that untagged re-cut exits 1 without force-pushing release-<version> or editing the open PR body.
  • docs/guide.md and site/docs/index.html (npm run docs:check --prefix site) are updated to match.
  • Existing release tests in tests/release.rs continue to pass.

Out of scope:

  • Using thirdshift fix on release-<version> branches (a Fix run merges origin/main into the PR branch, whereas release.sh requires the bump head to be a single version-only commit on top of its main base 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

  1. added
    bug
    ready-for-agent
    in-progress
    and removed
    ready-for-agent
    on Nov 6, 2026
  2. removed
    in-progress
    on Nov 6, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions