Skip to content

fix: match revision-pinned HF models in doctor's model cache scan - #964

Open
costajohnt wants to merge 1 commit into
tobi:mainfrom
costajohnt:fix/963-doctor-revision-pinned-hf-cache
Open

costajohnt wants to merge 1 commit into
tobi:mainfrom
costajohnt:fix/963-doctor-revision-pinned-hf-cache

Conversation

@costajohnt

Copy link
Copy Markdown

Fixes #963

findCachedModelInspection took model.split("/").pop() as the filename to look for in the model cache. For a revision-pinned URI (hf:org/model/file.gguf#<sha>) that string still carries the #<sha> fragment, while node-llama-cpp writes the blob as hf_org_model_<sha>_file.gguf with the revision before the filename. The substring check never matched, so qmd doctor reported the model missing even though it resolves offline from that same cache.

This splits the last path segment on # into filename and revision. A blob has to contain the filename, and when the URI carries a revision it also has to contain that revision, so a pinned URI is not satisfied by an unpinned blob or by a blob cached under a different revision. Unpinned URIs keep matching by filename alone. The check stays readdir-based and offline, as in #829.

Tests (in test/cli.test.ts, same shape as the .etag sidecar test): pinned URI matches its revisioned blob (fails on main, passes with the fix); pinned URI is still reported missing when only a different revision is cached; unpinned URI still matches a blob that carries a revision segment. Ran bun test ... test/cli.test.ts -t doctor (15 pass), npx vitest run test/cli.test.ts -t doctor (15 passed), oxlint and tsc --noEmit clean.

CHANGELOG entry added under Unreleased / Fixed.

findCachedModelInspection split off the filename but kept the trailing
#revision fragment when matching against cached blob names, so a
revision-pinned Hugging Face model (hf:org/model/file.gguf#<sha>) never
matched its cached blob and qmd doctor always reported it missing even
though it resolves offline. Split the filename and revision apart and
require the blob to contain both when the model URI carries a revision,
while leaving unpinned URIs matched by filename alone (unchanged
backward-compatible behavior).

Fixes tobi#963
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.

doctor cache check misses revision-pinned HF models that resolve offline

1 participant