Skip to content

Studio: resolve repo/file load ids to the local scan-folder copy, for API-key sessions too - #13343

Open
VTplus wants to merge 12 commits into
unslothai:mainfrom
VTplus:studio-scan-folder-load-api-key
Open

VTplus wants to merge 12 commits into
unslothai:mainfrom
VTplus:studio-scan-folder-load-api-key

Conversation

@VTplus

@VTplus VTplus commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Widens the #13034 scan-folder rewrite in two ways.

The following cases from the same family may still re-download after #13034; this PR closes both (the branch is stacked, so a split into two PRs is easy if preferred):

  • The repo/file form. The quant picker and remembered quant entries send org/repo/File.gguf, and the repo-id check never matches a file path — so it re-downloads even in an owner session. This resolves that form to the local copy under the same guards. Reproduced live: a file-form load re-downloaded while the parked copy sat on disk (09.10./11.10., server logs available).

  • API-key sessions. The rewrite was owner-session-only: a load by repo id through the API re-downloaded although the model is listed in the catalog and the copy is on disk. A listed, locally present model is now simply served from that copy — the gate becomes "locally managed session"; managed accounts keep the remote semantics, matching the conservative precedent of the refused-repo cached-copy gate (_refused_repo_cached_gguf; owner-session-only there). Reproduced live: an API-key load started a download for a listed, on-disk model (11.10.).

Why

The hub-cache path already serves local copies to API-key sessions, and the sibling ollama-manifest rewrite gates on managed/lease only — a listed, locally present model re-downloading was the odd one out. The file form simply fell through the bare-id lookup.

Tests

tests/test_load_scan_folder_resolution.py — 31 cases: repo/file id resolution (the file wins over a pinned variant; stale/companion names stay remote), the managed-account/API-key split at both call sites, and the offline validate flow for an API-key caller.

Known limitations

  • Managed accounts stay excluded from the rewrite, matching the conservative refusal gates elsewhere (the refused-repo cached copy, the ollama manifest); widening it to them is a separate question.
  • Nested repo/subdir/file.gguf ids (4+ segments) and sharded GGUFs keep the remote path.

Related: #12803 (catalog side) is being reworked against Etherll's review, keeping the separate Custom Folders row, consistent with this resolver's cache-first order; #12258 (picker side) is unchanged in goal.

VTplus added 5 commits October 9, 2026 05:53
…tead of downloading it - the quant picker names the file, not the bare repo id

A quant row carries <org>/<repo>/<file>.gguf, which no resolver index key matches, so the unslothai#13034 rewrite skipped it and the planner re-downloaded the repo; under disk pressure it even swapped the wanted quant for a smaller one. Split the file form out, look the repo up by the file's variant key, and take it only when the named file is the one the resolved quant is served from.
…ile-id - sync branch with upstream before re-cutting the patch

3 upstream commit(s) since the branch base; see git log for the range.
…ile-id - sync branch with upstream before re-cutting the patch

179 upstream commit(s) since the branch base; see git log for the range.
…rewrite - _gguf_variant_key falls back to the stem
…pi-key - sync branch with upstream before re-cutting the patch

125 upstream commit(s) since the branch base; see git log for the range.
…pi-key - sync branch with upstream before re-cutting the patch

165 upstream commit(s) since the branch base; see git log for the range.
…pi-key - sync branch with upstream

692 upstream commit(s) since the branch base; see git log for the range.
…pi-key - sync branch with upstream

731 upstream commit(s) since the branch base; see git log for the range.
@VTplus

VTplus commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR branch

The fix extends local scan-folder resolution to API-key sessions and repo/file.gguf identifiers. Without it, these load requests can trigger a download even when the requested GGUF is already available in a registered scan folder.

Together, #12258, #12803, and #13343 improve support for complete model copies stored in registered Custom Folders (chat picker visibility, API catalog listing, and local loading).

…pi-key - sync branch with upstream

623 upstream commit(s) since the branch base; see git log for the range.
…pi-key - sync branch with upstream

1050 upstream commit(s) since the branch base; see git log for the range.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants