Skip to content

Make quantized layer-package builds resumable - #995

Merged
i386 merged 2 commits into
mainfrom
jd/quant-layer-package-production
Jul 15, 2026
Merged

Make quantized layer-package builds resumable#995
i386 merged 2 commits into
mainfrom
jd/quant-layer-package-production

Conversation

@i386

@i386 i386 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Title

Make quantized layer-package builds resumable

Original problem

Building a quantized Skippy layer package required materializing an intermediate package and then quantizing it in a second pass. That duplicated model-sized storage, made interrupted jobs expensive to restart, and made it unsafe to transform artifacts in the existing post-write hook because package hashes and sizes had already been recorded.

Diagnostics

The GLM package-production workflow exposed three generic failure modes: model-sized duplicate output, no artifact-level resume point, and metadata capture occurring before an after-artifact transformation.

A full cargo test -p skippy-quantize also exposes two pre-existing main-branch catalog failures because the pinned llama quantizer now advertises Q2_0 while the Rust quant catalog does not. The focused tests for this change pass.

Fix

Add a dedicated pre-metadata artifact transform hook to skippy-model-package, so package metadata always describes the final transformed artifact.

Add resumable package production to skippy-quantize with persistent per-artifact results, atomic finalization, hard-linking with copy fallback, and source-stage removal after successful conversion. Scratch state is retained until package preflight succeeds.

All new behavior is opt-in; existing package and quantization commands retain their current defaults.

Validation

  • cargo check -p skippy-model-package -p skippy-quantize
  • cargo test -p skippy-model-package (25 passed)
  • cargo test -p skippy-quantize layer_package_hook (4 passed)
  • cargo clippy -p skippy-model-package -p skippy-quantize --all-targets --no-deps -- -D warnings
  • cargo fmt --all --check
  • git diff --check
  • No UI changes; screenshots do not apply.

Summary by CodeRabbit

  • New Features

    • Added --transform-artifact-command to transform artifacts before metadata is recorded.
    • Added --resume-package to continue interrupted package builds using existing artifacts.
    • Resumed builds process existing artifacts while generating only missing outputs.
    • Improved quantization result installation for safer package updates.
  • Documentation

    • Clarified artifact hook behavior, resume workflows, and package-building requirements.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Package writing now supports pre-metadata transformation and resumable artifacts. Quantization adds resumable package creation, deterministic hook outputs, atomic result installation, and wiring through the new transformation command.

Changes

Artifact pipeline

Layer / File(s) Summary
Package artifact flow
crates/skippy-model-package/src/main.rs, crates/skippy-model-package/README.md
Adds the transformation hook and resume option, runs transformation before metadata capture, preserves after-hook ordering, and tests resume decisions.
Quantization hook output
crates/skippy-quantize/src/main.rs
Generates per-artifact manifests and results, passes new quantization flags, selects completed results, and installs them atomically.
Resume command integration
crates/skippy-quantize/src/main.rs, crates/skippy-quantize/README.md
Adds --resume-package, wires transformation and resume flags into package writing, and documents resume behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant QuantizeLayerPackage
  participant SkippyModelPackage
  participant TransformHook
  participant Quantizer
  participant PackageDirectory
  QuantizeLayerPackage->>SkippyModelPackage: write-package with transform and resume options
  SkippyModelPackage->>PackageDirectory: reuse existing artifact when enabled
  SkippyModelPackage->>TransformHook: transform artifact
  TransformHook->>Quantizer: run quantization with manifest
  Quantizer-->>TransformHook: completed GGUF result
  TransformHook->>PackageDirectory: atomically install result
  SkippyModelPackage->>PackageDirectory: read transformed artifact metadata
Loading

Possibly related PRs

Suggested reviewers: ndizazzo

🚥 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 matches the main change: making quantized layer-package builds resumable.
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 jd/quant-layer-package-production

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.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request is currently a draft. Reviews will not take place until the PR is marked as ready for review.

@i386
i386 marked this pull request as ready for review July 14, 2026 20:53
@github-actions
github-actions Bot requested a review from michaelneale July 14, 2026 20:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/skippy-quantize/src/main.rs (1)

773-774: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fix relative path symlink resolution.

The symlink creation for the hook script on line 776 (ln -s "$artifact" "$single_source/model.gguf") will produce a broken symlink if args.package_dir (and therefore $artifact) is a relative path. This happens because a symlink target is resolved relative to the symlink's own parent directory rather than the working directory.

Since $single_source (${artifact}.quant-src) is always a sibling directory of $artifact, you can fix this robustly for both relative and absolute paths by pointing the symlink to ../$(basename "$artifact").

♻️ Proposed refactor (including the unchanged `ln -s` line)
     script.push_str("single_source=\"${artifact}.quant-src\"\n");
     script.push_str("rm -rf \"$single_source\"\n");
-    script.push_str("mkdir -p \"$single_source\"\n");
-    script.push_str("ln -s \"$artifact\" \"$single_source/model.gguf\"\n");
+    script.push_str("mkdir -p \"$single_source\"\n");
+    script.push_str("ln -s \"../$(basename \"$artifact\")\" \"$single_source/model.gguf\"\n");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/skippy-quantize/src/main.rs` around lines 773 - 774, Update the hook
script construction around the symlink creation to use a target relative to the
symlink directory: point `model.gguf` to the sibling artifact via `../$(basename
"$artifact")` instead of `$artifact`. Preserve the existing `single_source`
setup and `ln -s` destination.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/skippy-quantize/src/main.rs`:
- Around line 773-774: Update the hook script construction around the symlink
creation to use a target relative to the symlink directory: point `model.gguf`
to the sibling artifact via `../$(basename "$artifact")` instead of `$artifact`.
Preserve the existing `single_source` setup and `ln -s` destination.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a3fd4677-b10d-4faa-a9e7-e83daf21aeb2

📥 Commits

Reviewing files that changed from the base of the PR and between 4f25060 and e50491e.

📒 Files selected for processing (4)
  • crates/skippy-model-package/README.md
  • crates/skippy-model-package/src/main.rs
  • crates/skippy-quantize/README.md
  • crates/skippy-quantize/src/main.rs

@i386
i386 merged commit 6182437 into main Jul 15, 2026
18 checks passed
@i386
i386 deleted the jd/quant-layer-package-production branch July 15, 2026 02:54
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