Skip to content

Tag the compat endpoint's Ollama rows with their real source - #9988

Merged
mahiatlinux merged 3 commits into
unslothai:mainfrom
lonexreb:fix/legacy-ollama-source
Aug 31, 2026
Merged

mahiatlinux merged 3 commits into
unslothai:mainfrom
lonexreb:fix/legacy-ollama-source

Conversation

@lonexreb

Copy link
Copy Markdown
Contributor

What

Bug 1 of #9986, the three stacked breaks in the legacy GET /api/models/local path (follow-through on #9237, which fixed the hub-inventory side):

  1. The legacy _scan_ollama_dir in routes/models.py stamped its rows source = "custom", so the frontend's explicit "ollama" branches (chat picker grouping, "Ollama" labels, train-picker exclusions) never fired on this endpoint.
  2. The legacy LocalModelInfo literal in models/models.py did not admit "ollama" at all — unlike its hub-schema sibling — so correcting the stamp alone turned the route into a 500 via pydantic ValidationError.
  3. The custom-folder merge blanket re-stamped every row from a registered folder to "custom", so registering ~/.ollama/models (which Studio's own recommended-folders onboarding suggests) destroyed the attribution a second way. The hub path's _promote_to_custom_source() already guards hf_cache/ollama rows; the merge now applies the same rule.

Plus the matching "ollama" member on the training API's TS union (the chat union already has it from #9237).

Reproduced → fixed

New tests/test_legacy_ollama_source.py (4 tests): the schema admits the source, the scanner stamps it, and the merge keeps hf_cache/ollama attributions — all 4 fail on unmodified main (literal_error / "custom" stamps) and pass here.

Not in this PR

Bug 2 — the rich-manifest withholding that hides essentially every normal ollama pull (they all carry a template layer) — is a deliberate gate pinned by test_rich_manifest_is_withheld_from_inventory, with a stated behavior-difference rationale (llama.cpp drops the Modelfile's system/template). I've laid out the options on the issue and will follow up once maintainers pick a direction rather than silently flipping that contract here.

Tests

New file 4/4; neighboring route suites (test_cached_gguf_routes, test_scan_folder_health, test_local_model_format, test_recommended_folders_has_model): 338 pass. Frontend tsc clean. Ruff + kwarg formatter applied.

The chat and training pickers group and label local rows by source, and
the frontend branches on "ollama" explicitly — but the legacy scanner in
routes/models.py stamped its rows "custom", the legacy LocalModelInfo
literal did not even admit "ollama" (so correcting the stamp alone
500'd GET /api/models/local), and the custom-folder merge re-stamped
every row from a registered folder, so registering ~/.ollama/models
(Studio's own recommended folder) lost the attribution a second way.

Admit "ollama" in the legacy literal, stamp the scanner's rows with it,
and give the merge the same already-attributed guard
_promote_to_custom_source() applies on the hub path.

Part of unslothai#9986 (bug 1); the rich-manifest withholding (bug 2) is a
deliberate gate and stays untouched pending a maintainer call.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T07:30:08.314677Z 44908cb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffc0b20d7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Codex review caught that the recipe selector's sourceLabel() had no case
for the newly admitted "ollama" value, so corrected rows still read as
the generic "Local". Label it "Ollama", matching the hub inventory's
localSourceLabel, and pin both the case and the cross-stack parity.
@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 44908cbcde

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mahiatlinux
mahiatlinux self-requested a review August 31, 2026 07:50

@mahiatlinux mahiatlinux 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.

LGTM!

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.

3 participants