From 327a3992378e5259e51dc988a733641a92945d58 Mon Sep 17 00:00:00 2001 From: drbh Date: Mon, 4 May 2026 08:44:41 -0400 Subject: [PATCH 1/8] fix: remove existing test repo before upload Co-authored-by: Copilot --- .github/workflows/test_e2e.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index f93ecd653..1b12d7582 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -45,6 +45,20 @@ jobs: env: USER: runner + # Remove the existing test repo if it exists so we test repo creation in the upload step + - name: Delete existing test repo + run: | + curl -sf -X DELETE \ + "${{ env.HF_ENDPOINT }}/api/repos/delete" \ + -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ + -d '{"type":"kernel","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ + || true + curl -sf -X DELETE \ + "${{ env.HF_ENDPOINT }}/api/repos/delete" \ + -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ + -d '{"type":"model","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ + || true + - name: Init kernel project run: | cd /tmp From 39e6e1324ec1a6b71c50f76d01d1805889894dd7 Mon Sep 17 00:00:00 2001 From: drbh Date: Mon, 4 May 2026 09:23:16 -0400 Subject: [PATCH 2/8] fix: add missing content type --- .github/workflows/test_e2e.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 1b12d7582..6fed562fe 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -51,11 +51,13 @@ jobs: curl -sf -X DELETE \ "${{ env.HF_ENDPOINT }}/api/repos/delete" \ -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ + -H "Content-Type: application/json" \ -d '{"type":"kernel","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ || true curl -sf -X DELETE \ "${{ env.HF_ENDPOINT }}/api/repos/delete" \ -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ + -H "Content-Type: application/json" \ -d '{"type":"model","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ || true From ed45c37cf5d74fef5cbec9d1ab6d994733e3ec73 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:09:23 -0400 Subject: [PATCH 3/8] fix: prefer removing repos via hub library --- .github/workflows/test_e2e.yaml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 6fed562fe..326746ba7 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -48,18 +48,14 @@ jobs: # Remove the existing test repo if it exists so we test repo creation in the upload step - name: Delete existing test repo run: | - curl -sf -X DELETE \ - "${{ env.HF_ENDPOINT }}/api/repos/delete" \ - -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{"type":"kernel","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ - || true - curl -sf -X DELETE \ - "${{ env.HF_ENDPOINT }}/api/repos/delete" \ - -H "Authorization: Bearer ${{ secrets.HF_STAGING_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{"type":"model","organization":"__DUMMY_KERNELS_USER__","name":"kernels-upload-test"}' \ - || true + pip install huggingface_hub + python -c " + from huggingface_hub import HfApi + api = HfApi(endpoint='${{ env.HF_ENDPOINT }}', token='${{ secrets.HF_STAGING_TOKEN }}') + for repo_type in ['kernel', 'model']: + api.delete_repo('${{ env.E2E_REPO_ID }}', repo_type=repo_type, missing_ok=True) + print(f'Deleted {repo_type} repo (or it did not exist)') + " - name: Init kernel project run: | From bbba328d6a1b168e5e0ce0bf275a60c70bdb9ef3 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:12:02 -0400 Subject: [PATCH 4/8] fix: use lib from nix shell on runner --- .github/workflows/test_e2e.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 326746ba7..636e0c959 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -48,14 +48,22 @@ jobs: # Remove the existing test repo if it exists so we test repo creation in the upload step - name: Delete existing test repo run: | - pip install huggingface_hub - python -c " + cat > /tmp/delete_repos.py << 'PYEOF' from huggingface_hub import HfApi - api = HfApi(endpoint='${{ env.HF_ENDPOINT }}', token='${{ secrets.HF_STAGING_TOKEN }}') - for repo_type in ['kernel', 'model']: - api.delete_repo('${{ env.E2E_REPO_ID }}', repo_type=repo_type, missing_ok=True) - print(f'Deleted {repo_type} repo (or it did not exist)') - " + import os + + api = HfApi( + endpoint=os.environ["HF_ENDPOINT"], + token=os.environ["HF_STAGING_TOKEN"], + ) + repo_id = os.environ["E2E_REPO_ID"] + for repo_type in ["kernel", "model"]: + api.delete_repo(repo_id, repo_type=repo_type, missing_ok=True) + print(f"Deleted {repo_type} repo (or it did not exist)") + PYEOF + nix-shell -p python3Packages.huggingface-hub --run "python /tmp/delete_repos.py" + env: + HF_STAGING_TOKEN: ${{ secrets.HF_STAGING_TOKEN }} - name: Init kernel project run: | From 09d34b78c11e1c4412e6da4c3972ce86de9c4038 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:33:59 -0400 Subject: [PATCH 5/8] fix: disallow more than one instance of E2E running at once to avoid race conditions --- .github/workflows/test_e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 636e0c959..7a6abaa0f 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -20,7 +20,7 @@ env: E2E_BRANCH: e2e-${{ github.event.pull_request.number || github.run_id }}-${{ github.run_attempt }} concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }} cancel-in-progress: true jobs: From ed0c47e479936cf73054efa021c2a3b4d653c520 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:34:09 -0400 Subject: [PATCH 6/8] fix: prefer using ci token --- .github/workflows/test_e2e.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 7a6abaa0f..9457caa91 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -53,8 +53,7 @@ jobs: import os api = HfApi( - endpoint=os.environ["HF_ENDPOINT"], - token=os.environ["HF_STAGING_TOKEN"], + endpoint=os.environ["HF_ENDPOINT"] ) repo_id = os.environ["E2E_REPO_ID"] for repo_type in ["kernel", "model"]: @@ -62,8 +61,6 @@ jobs: print(f"Deleted {repo_type} repo (or it did not exist)") PYEOF nix-shell -p python3Packages.huggingface-hub --run "python /tmp/delete_repos.py" - env: - HF_STAGING_TOKEN: ${{ secrets.HF_STAGING_TOKEN }} - name: Init kernel project run: | From 0ba827a7c3828269cf3f37615d25b6e342579906 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:41:59 -0400 Subject: [PATCH 7/8] fix: update e2e to use trust_remote_code for the dummy user --- .github/workflows/test_e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 9457caa91..75446de0c 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -148,7 +148,7 @@ jobs: import torch from kernels import get_kernel - kernel = get_kernel('${{ env.E2E_REPO_ID }}', revision='${{ env.E2E_BRANCH }}') + kernel = get_kernel('${{ env.E2E_REPO_ID }}', revision='${{ env.E2E_BRANCH }}', trust_remote_code=True) x = torch.randn(1024, 1024, dtype=torch.float32, device='cuda') result = kernel.kernels_upload_test(x) From a915b9edb01ef270ddbe90033f3fbbcb6ce28293 Mon Sep 17 00:00:00 2001 From: drbh Date: Tue, 12 May 2026 14:58:26 -0400 Subject: [PATCH 8/8] fix: prefer using latest kernels-data in test --- .github/workflows/test_e2e.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_e2e.yaml b/.github/workflows/test_e2e.yaml index 75446de0c..416298549 100644 --- a/.github/workflows/test_e2e.yaml +++ b/.github/workflows/test_e2e.yaml @@ -138,6 +138,8 @@ jobs: CUDA_TAG=$(echo "$VARIANT" | grep -oP 'cu\d+') echo "Installing torch matching variant $VARIANT (CUDA tag: $CUDA_TAG)" uv sync --all-extras --dev + # E2E validates this checkout, so use the local kernels-data binding instead of the released wheel from uv.lock. + uv pip install --reinstall ../kernels-data/bindings/python uv pip install --upgrade torch --index-url https://download.pytorch.org/whl/$CUDA_TAG uv run --no-sync python -c "import torch; print(f'torch={torch.__version__}, cuda={torch.version.cuda}, cxx11_abi={torch.compiled_with_cxx11_abi()}')"