Skip to content

Fix daily layer-package split jobs failing on first artifact - #945

Merged
michaelneale merged 1 commit into
mainfrom
fix/layer-package-split-artifact-hook-ordering
Jul 2, 2026
Merged

Fix daily layer-package split jobs failing on first artifact#945
michaelneale merged 1 commit into
mainfrom
fix/layer-package-split-artifact-hook-ordering

Conversation

@michaelneale

@michaelneale michaelneale commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What this fixes

The daily automated layer-package split jobs (Queue Unsloth layer packages, cron 23 17 * * *) have been failing every day for ~10 days. Every run — across different models — died after ~2 minutes on the very first artifact:

Uploaded and removed shared/metadata.gguf (10944320 bytes)
gguf_init_from_file: failed to open GGUF file '.../shared/metadata.gguf' (No such file or directory)
Error: open package artifact .../shared/metadata.gguf
Caused by:
    ModelError: failed to open GGUF model metadata

After this change, split jobs run to completion again: no code or infra change is needed on the runner side, because each HF Job builds skippy-model-package from main at job start, so the next scheduled run picks up the fix automatically.

Root cause

write_package_artifact invoked the --after-artifact-command upload hook before reopening the artifact to record its tensor count, byte size, and sha256. The production upload hook in split-model-job.sh uploads each artifact and then unlinks it locally (by design, to stay under the HF Jobs ephemeral storage limit). So the reopen hit a file that had already been deleted, failing on the first artifact (shared/metadata.gguf).

The neighboring copy_projector_artifact already did this correctly — read metadata first, run the hook last. This change makes write_package_artifact use the same ordering.

Validation

Reproduced and verified with the real write-package binary against a real GGUF (unsloth/Qwen3.5-0.8B-GGUF:Q4_K_M), using a hook that mimics production (record upload, then rm -f the file):

Before After
Exit code 1 (exact production error) 0
Artifacts processed dies on #1 all 27 (metadata + embeddings + output + 24 layers)
Manifest never written correct sha256 / bytes / tensor_count for every artifact, despite all files being deleted by the hook

Added a regression test (artifact_hook_tolerates_a_hook_that_deletes_the_uploaded_file) that runs a deleting hook and asserts success.

  • cargo test -p skippy-model-package — 24 passed
  • cargo test -p model-package — 9 passed
  • cargo clippy -p skippy-model-package --all-targets -- -D warnings — clean
  • cargo fmt --all --check — clean

Summary by CodeRabbit

  • Bug Fixes

    • Packaging now completes successfully even if a post-processing hook moves or deletes the artifact file.
    • Artifact details are collected earlier, so packaging can still report the correct metadata after the file is no longer present.
  • Tests

    • Added a regression test covering hooks that delete the uploaded artifact file while packaging still succeeds.

write_package_artifact ran the upload hook before reading the artifact
back for tensor count, byte size, and sha256. The production upload hook
in split-model-job.sh uploads each artifact and then unlinks it locally
to stay under the HF Jobs ephemeral storage limit, so the reopen failed
on the very first artifact (shared/metadata.gguf) and every daily split
job errored at ~2 minutes.

Read all artifact metadata from disk before invoking the hook, matching
the ordering copy_projector_artifact already used. Add a regression test
that runs a hook which deletes the uploaded file and still succeeds.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8dc313d7-d685-4bfa-925f-828afb0d371a

📥 Commits

Reviewing files that changed from the base of the PR and between b4b33ef and 0bf3923.

📒 Files selected for processing (1)
  • crates/skippy-model-package/src/main.rs

📝 Walkthrough

Walkthrough

The change reorders write_package_artifact so artifact metadata (tensor list, sizes, sha256) is read before invoking ArtifactHook, preventing failures when a hook deletes or moves the artifact file. A regression test validates this behavior.

Changes

Artifact packaging hook fix

Layer / File(s) Summary
Reorder metadata collection before hook invocation
crates/skippy-model-package/src/main.rs
write_package_artifact reads tensor metadata, file size, and sha256 before calling run_artifact_hook, with a comment noting the hook may delete/move the file.
Regression test for hook deleting artifact
crates/skippy-model-package/src/main.rs
Adds artifact_hook_tolerates_a_hook_that_deletes_the_uploaded_file test confirming success when the hook removes the artifact, and updates test imports.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: daily layer-package split jobs failing on the first artifact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/layer-package-split-artifact-hook-ordering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@michaelneale
michaelneale merged commit ea50fbb into main Jul 2, 2026
22 checks passed
@michaelneale
michaelneale deleted the fix/layer-package-split-artifact-hook-ordering branch July 2, 2026 23:15
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