Repository navigation
Conversation
Parallel CI jobs uploading a new version can both see the branch as missing, and the slower one failed with a 409 from create_branch. Treat the conflict as an existing branch, so its stale-file cleanup stays scoped to its own variants instead of deleting the sibling's. Also create the branch from main's listed commit and diff a new branch against that commit, so uploads that land right after creation are never picked up as stale files.
drbh
marked this pull request as draft
November 11, 2026 16:36
A new version branch inherits the build files of `main`, and the upload that created it deleted every `build/` file it was not uploading itself. Those deletes were computed before its upload and applied after it, so they could remove the variants that a concurrent upload committed in the meantime. Remove the inherited build and benchmark files in a separate commit right after creating the branch, pinned to the base commit so that it is refused once another upload committed. Every upload then only replaces the files of its own variants.
This branch has not been deployed
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.
this pr fixes a race when parallel ci jobs upload the first build of a new version https://github.com/huggingface/kernels-community/actions/runs/42791271906/job/129745361789
both jobs see the branch as missing and try to create it, so the slower one fails
a 409 from
create_branchis now treated as an existing branchthat alone is not enough. a new branch starts as a copy of
main, which has the same variant dirs (e.g.build/torch-rocm). previously the job that created the branch deleted everybuild/file it was not uploading, but it computed those deletes before its upload and applied them after. a sibling job that committed in between would lose its variantnew branches are now cleaned up right after creation in a deletes-only commit pinned to the base commit with
parent_commit. after that every upload only touches its own variant dirs. if another job commits first the cleanup is refused and the inherited files are keptthe flow for each job is now
maincommit (base_commit)base_commitbuild/andbenchmarks/files withparent_commit = base_commit. if refused, another job already committed, so warn and keep them--create-pr, find an open upload pr to updatemainand the version branch (or the open pr ref)build/<variant>/note: the hub calls are not tested since the upload tests do not mock the hub client.
new_branch_cleanup_opsand the per-variant cleanup have unit tests