Skip to content

Release job: create the autobuild tag at the commit that was built - #461

Open
robobun wants to merge 1 commit into
mainfrom
farm/daff32b0/release-tag-at-built-commit
Open

Release job: create the autobuild tag at the commit that was built#461
robobun wants to merge 1 commit into
mainfrom
farm/daff32b0/release-tag-at-built-commit

Conversation

@robobun

@robobun robobun commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Problem

  • The tag behind an autobuild release does not reliably point at the commit the tarballs were built from.
  • Preview releases: the tag never does. refs/tags/autobuild-preview-pr-459-9203122d points at e462c38 (main's HEAD when that release job ran); the 42 tarballs on it were built from PR head 9203122. Every preview tag checked behaves this way (387 sampled, back to the first ones from October 2025), so this predates Build -lto variants for freebsd and android; publish the release with gh instead of per-label action steps #412: action-gh-release was not given a target either.
  • Main releases: the tag is off whenever something lands on main during the ~35 minute build. refs/tags/autobuild-781d6abb94b9eaee825e95ef700a83d8cf576f55 points at a2f8782 (WTF: Linux memoryFootprint always parsed as 0, so the critical-memory GC mode never engaged #449, merged 85 seconds after 781d6ab). 33 of the 186 most recent autobuild-<sha> tags point at a commit other than <sha>.
  • Cause: .github/workflows/build-reusable.yml, job release, step "Release" runs gh release create "$TAG" --title "$TAG" --generate-notes [--prerelease] with no --target, so GitHub creates the tag at the default branch's current HEAD. The build jobs all check out inputs.build_ref and bake it into the tarballs as BUN_WEBKIT_VERSION; only the tag object is wrong.
  • Who notices: oven-sh/bun's bun sync-webkit-source resolves WEBKIT_VERSION through the tag, so with a preview pin (or one of the 33 main pins above) vendor/WebKit is checked out at a different tree than the prebuilt JSC bun links against, silently: wrong lines when stepping through JSC, and build:local building a different engine than the prebuilt.

Fix

  • Pass --target "$BUILD_REF" (inputs.build_ref) to gh release create, so the tag is created at the commit that was built. Nothing else about the release changes: same title, generated notes, prerelease flag, and the upload loop.
  • Correct because build_ref is by construction the commit the tarballs contain: build.yml passes github.sha and build-preview.yml passes the PR head sha, and both derive release_tag from that same sha. Both are full 40-hex shas, which is one of the two forms --target accepts (the other is a branch name); the build_ref input description now says so. A PR head commit is in this repository's object store (refs/pull/<n>/head), so the tag can be created at it.
  • The gh release view guard is unchanged, so a re-run of a job whose release already exists still neither recreates nor moves the tag.
  • Existing tags are out of scope here: 76 of the 620 autobuild-<sha> tags and 627 of the 628 preview tags point elsewhere (full count in the comment below, which proposes moving them as a follow-up). sync-webkit-source: check out the commit named by the release, not the tag object bun#39459 makes sync-webkit-source take the commit from the release name (for a preview, from the full sha recorded in the downloaded tarball) and never from the tag, so it does not depend on the existing tags being moved.
  • Verified the step locally by running its script against a stub gh with the inputs of the two examples above: it issues gh release create autobuild-preview-pr-459-9203122d --title ... --target 9203122d... --generate-notes --prerelease and gh release create autobuild-781d6abb... --title ... --target 781d6abb... --generate-notes. The preview build of this PR ran the changed step for real: refs/tags/autobuild-preview-pr-461-9be14059 points at 9be1405, this PR's head, with all 42 assets on the release (gh api repos/oven-sh/WebKit/git/ref/tags/autobuild-preview-pr-461-9be14059); main's HEAD at the time was e462c38, which is where every earlier preview tag of the day points.

Background

  • build-reusable.yml is the shared workflow behind both release kinds. build.yml calls it for every push to main with build_ref = release_tag's sha; build-preview.yml calls it for PRs with the PR head sha and a tag named autobuild-preview-pr-<n>-<first 8 hex of that sha>. The release job downloads the build jobs' artifacts, creates the release, and uploads them; it does not check anything out.
  • A GitHub release is attached to a tag. Creating a release for a tag that does not exist yet makes GitHub create the tag, at target_commitish if given and at the default branch's HEAD otherwise; gh release create --target is how that field is set.

`gh release create` with no `--target` creates the tag at the default
branch's HEAD at the time the release job runs, not at inputs.build_ref,
which is what every build job checked out and what the tarballs contain.
For preview releases the tag therefore never points at the PR head it is
named after (autobuild-preview-pr-<n>-<sha8>), and for main releases it
points at whatever landed on main during the ~35 minute build (33 of the
last 186 autobuild-<sha> tags point at a commit other than <sha>).

Pass `--target "$BUILD_REF"`. build.yml and build-preview.yml both pass a
full commit sha as build_ref, which is one of the two forms --target takes;
the input description now says so. Existing tags are left as they are.
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Limit details: You’ve used all 5 included reviews currently available under your plan.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f0a92a75-3f2a-4f68-bf83-8886f4844b64

📥 Commits

Reviewing files that changed from the base of the PR and between e462c38 and 9be1405.

📒 Files selected for processing (1)
  • .github/workflows/build-reusable.yml

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — adds --target "$BUILD_REF" to gh release create so the autobuild tag points at the built commit.

What was reviewed:

  • Verified both callers (build.ymlgithub.sha, build-preview.ymlpr.head.sha) pass full 40-hex SHAs, which --target accepts.
  • BUILD_REF is passed via env: and quoted in the bash array; sourced from GitHub-controlled SHAs, so no injection surface.
  • The gh release view guard is unchanged, so re-runs of an existing release still do not move the tag.
Extended reasoning...

Overview

This PR touches a single file, .github/workflows/build-reusable.yml, and makes three changes to the release job's "Release" step: (1) updates the build_ref input description to note it must be a full SHA or branch name, (2) exposes inputs.build_ref as the BUILD_REF env var, and (3) inserts --target "$BUILD_REF" into the gh release create flags array with an explanatory comment. Nothing else about release creation or asset upload changes.

Security risks

None identified. inputs.build_ref is supplied only by the two calling workflows: build.yml passes ${{ github.sha }} and build-preview.yml passes pr.head.sha fetched via github.rest.pulls.get / the pull_request event payload — both are GitHub-generated 40-character hex strings, not attacker-controllable free text. The value is plumbed through a step env: block and referenced as "$BUILD_REF" inside a bash array element, so there is no shell-injection or expression-injection vector introduced. The step already had contents: write permission and already created releases; this change only pins target_commitish on the release-create API call.

Level of scrutiny

Low-to-moderate. This is CI release plumbing rather than runtime engine code, and the diff is a one-flag addition with a doc-string tweak. Failure modes are loud (the gh release create call would error and fail the job), not silent. I confirmed the two call sites pass values compatible with --target (full SHAs), and that a PR head commit is reachable in the repo via refs/pull/<n>/head so GitHub can create a tag at it. The existing gh release view idempotency guard is untouched, so re-runs remain safe.

Other factors

The repo's CODEOWNERS lists /.github under an upstream-WebKit maintainer; that file is inherited verbatim from Apple's WebKit and names contributors outside oven-sh, while build-reusable.yml is a Bun-fork-specific workflow that does not exist upstream and is routinely modified here — so I did not treat that entry as blocking. The PR description is unusually thorough (root cause, sampled evidence, local stub verification), and the preview build of this PR itself exercises the changed step end-to-end. No prior human or bot review comments to address.

@github-actions

Copy link
Copy Markdown

Preview Builds

Commit Release Date
9be14059 autobuild-preview-pr-461-9be14059 2026-08-17 19:58:38 UTC

robobun added a commit to oven-sh/bun that referenced this pull request Aug 18, 2026
…low clones, and use the tag as a second source for previews

`git fetch origin` only brings in what the clone's refspec covers, so in a
--single-branch or --depth clone a pin that is not the tip of main was never
found; the old script only got away with it because `--tags` happened to drag
the history in. Fetch the pinned sha by id instead, and pass --depth when the
clone is already shallow: fetching a ref whose history does not connect to the
few commits such a clone has otherwise downloads all of WebKit's history
(observed: 10 GB and counting for one refs/pull/<n>/head in the depth-1
vendor/WebKit clone).

Previews fetch refs/pull/<n>/head and the release's tag, each best effort, and
then look for the 8 hex among the commits present. The PR ref covers every
release made so far (their tags point at main); the tag covers a push the PR
has since force-pushed away, once tags point at the commit they are named
after (oven-sh/WebKit#461). A release whose tag is gone still resolves through
the PR ref.
@robobun

robobun commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up this PR does not do, for whoever owns the releases: moving the existing tags to the commit their name says.

Counting every tag in the repo right now: 76 of the 620 autobuild-<sha> tags and 627 of the 628 autobuild-preview-pr-<n>-<sha8> tags point at a commit other than the one in their name (the one that is right is this PR's own preview). They were created by the releases API, so they are plain refs; moving one is a forced update of refs/tags/<name>, and the releases stay attached to the names.

  • autobuild-<sha>: the target is in the name, so those 76 are mechanical.
  • previews: the name only has 8 hex, so the full sha has to come from the PR (its commit list, or the force-push events in its timeline for pushes that were replaced), or from the tarball itself, which records it as BUN_WEBKIT_VERSION. The replaced pushes are the time-sensitive part: their commits are reachable from nothing and exist only until GitHub collects them (for example f4b6b77, the push autobuild-preview-pr-453-f4b6b77e was built from, is still there today); a tag pointing at such a push keeps it.

This is optional as far as oven-sh/bun#39459 is concerned, which now reads the full sha from the downloaded tarball and fetches it by id; it is about the tags describing their releases correctly and keeping replaced pushes alive. Merging this PR first stops the set from growing. I can put the backfill together as a one-off script or a workflow_dispatch job if that is wanted; it moves several hundred refs, so I have not run anything.

robobun added a commit to oven-sh/bun that referenced this pull request Aug 18, 2026
…e tag object

oven-sh/WebKit names every release after the commit it built (autobuild-<sha>,
autobuild-preview-pr-<n>-<sha8>), but the tag object behind a release was
created at main's HEAD of the moment the release job ran (oven-sh/WebKit#461
fixes that for new releases). Resolving WEBKIT_VERSION through the tag
therefore checks vendor/WebKit out at a different tree than the prebuilt that
bun links against: always for a preview pin, and for the autobuild-<sha> tags
whose build overlapped a merge.

Take the sha from the name instead. Preview pins fetch refs/pull/<n>/head when
the clone does not have the commit; sha pins fetch origin's branches as before
(tags are no longer needed). A pin in neither form, or a preview commit that is
not at the PR ref either, fails instead of checking out whatever the tag says.

The resolution is exported so test/internal/source-lints/sync-webkit-source.test.ts
can run it against small repos whose tags deliberately point at the wrong commit.
robobun added a commit to oven-sh/bun that referenced this pull request Aug 18, 2026
…low clones, and use the tag as a second source for previews

`git fetch origin` only brings in what the clone's refspec covers, so in a
--single-branch or --depth clone a pin that is not the tip of main was never
found; the old script only got away with it because `--tags` happened to drag
the history in. Fetch the pinned sha by id instead, and pass --depth when the
clone is already shallow: fetching a ref whose history does not connect to the
few commits such a clone has otherwise downloads all of WebKit's history
(observed: 10 GB and counting for one refs/pull/<n>/head in the depth-1
vendor/WebKit clone).

Previews fetch refs/pull/<n>/head and the release's tag, each best effort, and
then look for the 8 hex among the commits present. The PR ref covers every
release made so far (their tags point at main); the tag covers a push the PR
has since force-pushed away, once tags point at the commit they are named
after (oven-sh/WebKit#461). A release whose tag is gone still resolves through
the PR ref.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant