Skip to content

Prebuilds: merge a set of upstream PRs into the GitHub Actions builds via pr-set.json - #21

Merged
danielhanchen merged 15 commits into
masterfrom
pr-mix-builds
Jun 11, 2026
Merged

danielhanchen merged 15 commits into
masterfrom
pr-mix-builds

Conversation

@oobabooga

Copy link
Copy Markdown
Member

This PR adds support for building the nightly prebuilds with upstream PRs merged in, so we can ship things like new model archs before ggml-org merges them. The set of PRs lives in scripts/unsloth/pr-set.json and is edited with a normal commit. This replaces the tag=pr/<number> dispatch mode.

How it works

  • List PR urls in the file. A plain url tracks the PR head; a commit url (.../pull/N/commits/<sha>) pins it. Closed PRs are skipped, so entries rot away harmlessly once a PR lands upstream.
  • resolve merges the open PRs onto the base tag once and pushes the result to this repo as tag b####-mix-<hash>. All children build that one tag: identical trees, correct LLAMA_BUILD_NUMBER, and the release's source tarballs are the real merged tree.
  • The hash comes from the PR head SHAs, so a force-pushed PR triggers a new build and an unchanged set reuses the existing tag. The exact commits are recorded in the manifest (merged_prs) and release notes.
  • A merge conflict fails in resolve within ~2 minutes, naming the PR.
  • An empty list is a vanilla nightly, byte-identical metadata included.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94da261140

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/unsloth-prebuilt.yml Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a75f5b97f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/unsloth-prebuilt.yml Resolved
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e17079be7a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/unsloth-prebuilt.yml Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8ffa0f338

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/unsloth-prebuilt.yml Resolved
@danielhanchen

Copy link
Copy Markdown
Member

Reviewed this end to end (static + behavioral). Summary below.

Codex review items

Walking each one against the commit it was filed on and the follow-ups since:

  • Pass SOURCE_REPO into bundle metadata and include PR order in the mix tag hash (filed on 94da261): addressed in 049cc5f. The CUDA / Windows-CUDA package step now sets SOURCE_REPO: ${{ inputs.repo }} and SOURCE_REF_KIND, and SETHASH hashes the listed order (map("\(.number):\(.sha)")), so an order-only edit yields a new tag.
  • Mix metadata points at a non-existent upstream tag (filed on 7a75f5b): addressed in 14cf34e. Mix sets REPO=$GITHUB_REPOSITORY, ships the merged tree as a workflow artifact, and assemble_metadata emits source_ref_kind="mix" with merged_prs.
  • Enforce PR pin membership in the publish path (filed on b8ffa03): addressed in f81b2b0. resolve now runs the /pulls/<num>/commits membership check itself; the lint workflow is a tripwire on top.
  • Fetch PR heads via the pull ref instead (filed on e17079b): not needed. I tested git fetch <upstream> <sha> against three current fork-based open PR heads (different forks) and all three fetched cleanly. GitHub serves any commit reachable from refs/pull/*, and pinning the exact reviewed commit is more correct than tracking the moving refs/pull/<n>/head. The force-push-pruned case is already handled (membership check rejects it, and the fetch prints a clear error).

So nothing in the Codex set is outstanding.

One cross-repo note (no change needed here)

The installer's source-build fallback fetches the tree from codeload.github.com/<source_repo>/tar.gz/<source_commit>. For a mix release that commit is the merged head, which this workflow intentionally never pushes (it ships only as the llama.cpp-source-commit-<sha>.tar.gz release asset), so codeload returns 404 and the fallback would fail for a host with no matching prebuilt. Vanilla builds are unaffected (real upstream commit, resolves via the fork), so this stays dormant until pr-set.json is non-empty.

I am fixing this on the installer side (prefer the release source asset over the reconstructed codeload URL); no change is required in this PR. Builds, metadata shape, and the empty-set vanilla path all look correct.

@danielhanchen

Copy link
Copy Markdown
Member

Minor: once this lands, unsloth-pr-set-lint.yml should carry the same AGPLv3 SPDX header the other workflows now have (added to master in #22):

# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.

Happy to add it here or fold it into a follow-up, whichever you prefer.

@danielhanchen

Copy link
Copy Markdown
Member

Added the AGPLv3 SPDX header to unsloth-pr-set-lint.yml directly here (cfc4cfd). The other five workflows already carry it on master via #22, so this PR only needed the new file. All workflows are now covered.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfc4cfd596

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

&& grep -q "set(BUILD_COMMIT \"${SHORT}\")" cmake/build-info.cmake \
|| { echo "cmake/build-info.cmake no longer has the expected fallback lines; cannot bake the build number into the source artifact" >&2; exit 1; }

tar -czf "${RUNNER_TEMP}/llama.cpp-source-${TAG}.tar.gz" --exclude-vcs --transform "s,^\.,llama.cpp-${TAG}," .

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record the baked build-info patch in the source commit

In mix builds this archives the worktree after the sed edits to cmake/build-info.cmake, but COMMIT was captured before those tracked-file changes. As a result the published llama.cpp-source-commit-${SHA}.tar.gz, manifest source_commit, and bundle metadata identify a git tree that does not contain the exact source that was compiled, so anyone trying to reproduce or audit the build from the recorded commit gets different build-info defaults. Commit the baked fallback change (or compute a tree identifier after applying it) before naming the exact source asset and metadata.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit e46fa9f into master Jun 11, 2026
1 check passed
@danielhanchen
danielhanchen deleted the pr-mix-builds branch June 11, 2026 12:23
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.

2 participants