fix(llm): pin Hugging Face metadata revisions - #79
Open
pjb157 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens Hugging Face–backed model-card metadata resolution by pinning “hf://” sources to an immutable commit SHA derived from the worker’s resolved hf-hub cache snapshot, preventing frontend/worker registration mismatches when a mutable revision (e.g. main) advances.
Changes:
- Worker-side: record
repo@<commit-sha>in the model card when the local model path is an hf-hub snapshot, while keeping the served/display name stable. - Frontend-side: when resolving model-card metadata for
hf://repo@<commit>/*, fetch/validate metadata directly from that commit snapshot (cached or downloaded), avoiding mutable cache refs. - Add regression tests for stale
mainrefs, revision preservation in URIs, and served-name compatibility.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/llm/src/model_card.rs | Resolve hf:// metadata via pinned repo@commit snapshots when available; add regression tests. |
| lib/llm/src/local_model.rs | Pin worker-emitted source_path to the snapshot commit SHA without altering served name; add unit tests. |
| lib/llm/src/hub/huggingface.rs | Add helpers to resolve only pinned metadata files from a commit revision (cache-first, offline-aware) and tests. |
| lib/llm/src/hub.rs | Add from_pinned_hf_metadata entrypoint and wire it into hub exports. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: pjb157 <84070455+pjb157@users.noreply.github.com>
pjb157
force-pushed
the
peter/pin-hf-model-card-revisions
branch
from
August 12, 2026 11:47
596faa6 to
b106a73
Compare
pjb157
had a problem deploying
to
external_collaborator
August 12, 2026 11:47 — with
GitHub Actions
Failure
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.
Overview
Prevent model-card registration failures when a worker and frontend resolve different commits of the same mutable Hugging Face revision.
Root cause
A
ModelDeploymentCardpublishes checksums computed from the metadata files in the snapshot loaded by the worker, but its Hugging Face metadata locations identify only the repository or another mutable revision such asmain.The worker and frontend resolve that location independently and may have different cache states or resolve it at different times. If the mutable revision advances, the frontend can fetch bytes from a different commit. Checksum verification then correctly rejects the metadata, but the otherwise healthy worker cannot register.
This is a time-of-check/time-of-use problem: immutable checksums were paired with a mutable artifact address.
Details
source_revisionmodel-card field.source_pathas the canonical repository identifier and preserve the served model name.source_path@source_revision, bypassing mutable cache refs.Why this belongs in Dynamo
Deployment-level mitigations can reduce the chance of a mismatch, but they do not make the model card self-consistent:
DYN_SELF_HOST_METADATAis a useful transport when a reachable worker system-status server is available, but it deliberately degrades to shared-storage/Hub resolution when that server is absent and may be disabled. Correctness of the fallback should not depend on deployment topology.The model card already carries the metadata checksums and source location. Adding the immutable revision that identifies those bytes is the smallest protocol-level fix and applies to every deployment without imposing a particular transport.
Compatibility
The revision is intentionally separate from
source_path:source_revisionis absent, so resolution follows the existing legacy path.source_pathcontinues to use the legacy path.source_revisionalone does not changemdcsum, allowing mixed-version rolling upgrades when the checksummed metadata is otherwise identical.Once both sides understand
source_revision, metadata is resolved from the exact worker commit.Where should the reviewer start?
Start with
lib/llm/src/local_model.rs, where the worker derivessource_revisionfrom the resolved cache snapshot. Then reviewlib/llm/src/model_card.rs, where the frontend applies that revision while resolving the card metadata.The exact cache and network behavior is implemented in
lib/llm/src/hub/huggingface.rs.Validation
cargo fmt --all -- --checkcargo clippy -p dynamo-llm --no-default-features --lib --tests -- -D warningscargo test -p dynamo-llm --no-default-features --lib -- --test-threads=1(1,744 passed; 3 ignored)uvx pre-commit run --files lib/llm/src/hub.rs lib/llm/src/hub/huggingface.rs lib/llm/src/local_model.rs lib/llm/src/model_card.rsgit diff --checkai-dynamo/main(9f616aed66f1de3601ee8184bba53a61728467fa) with the new targeted tests and clippy passing there.Regression coverage includes:
mainpointing at a different cached snapshot;mdcsumcompatibility;Related Issues
This PR is not linked to an issue: