Repository navigation
fix(lm): discover GGUFs in a repository's variant folders - #341
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
`mlx download model -g "*UD-Q4_K_XL*"` keeps repo paths, so Qwen3.8 Flash Next and DeepSeek V4.1 Flash land at <modelsDir>/<repo>/UD-Q4_K_XL/*.gguf. Discovery read only <modelsDir>/<repo>/*.gguf, so mlx serve, mlx agent and the dashboard agent list did not find them. When a repository folder has no top-level target GGUF and no primary safetensors, discovery now scans its variant folders, one level only, sorted, with dot-folders skipped. A repository with a variant target is not itself registered, even with a root config.json. Everything else keeps the old path: top-level targets win, safetensors folders are never searched, companion-only roots stay skipped, and sidecars are checked beside the GGUF. Co-Authored-By: Claude Opus 5.5 <[email protected]>
.staging/ holds the dashboard's unpublished download jobs and publish backups; scanning it as a repository listed them as models, and the staged copy could take the installed model's ID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fc57160 to
fca6503
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Part of stack #349, on top of #341. CI runs after the PR below it merges and GitHub retargets this one to `main`. ## Why Renovate's lock file maintenance (#328) never succeeds #328 updated only `Cargo.lock`; its `renovate/artifacts` check fails on `yarn.lock`. Renovate rebuilds `yarn.lock` from empty, and a fresh resolve fails: ``` @yarnpkg/[email protected] (npm, 2026-09-24) dependencies.got = "patch:got@npm%3A11.8.2#~/.yarn/patches/got-npm-11.8.2-c1eb105458.patch" → YN0001: ENOENT .yarn/patches/got-npm-11.8.2-c1eb105458.patch ``` The patch file exists only in the Yarn repository. Our current lock still holds `@yarnpkg/[email protected]`, so normal installs work; only a fresh resolve fails. `@yarnpkg/core` is used only by the private `@mlx-node/internal-tools`. **Fix:** root resolution `"@yarnpkg/core/got": "npm:^11.8.6"`. It replaces only that one dependency, with the plain npm `got` that our lock already ships, and keeps `@yarnpkg/core` at its newest release. ## Refresh | Change | Detail | |---|---| | `yarn.lock` | rebuilt from empty (Renovate's method); a full install leaves it unchanged; `--immutable` passes | | Caret ranges | 41 lower bounds in 14 `package.json` files raised to npm latest; no major version changes exist | | `examples/package.json` | `@napi-rs/image` exact pin `1.14.0` → `1.16.0`; `ai`, `zod`, `@openrouter/ai-sdk-provider` ranges raised | | Held | `@napi-rs/cli` `~3.8.6` (was `^3.8.6`); see below | | Kept | `drizzle-orm` `1.0.0-rc.5-ab785fc` pin (npm `latest` 0.45.4 is older); other exact pins are already latest | The `@napi-rs/image` pin mattered: with `1.14.0` in `examples/` and `^1.16.0` elsewhere, Yarn nested a copy in `examples/node_modules`. `findNodeModules()` in `examples/grpo/lsp.ts` stops at the nearest `node_modules`, so it could not find `@octokit` and `examples/__tests__/lsp.test.ts` failed (75 tests). ## Checks (local) - `yarn build:ts`, `yarn typecheck`, `vp lint --type-aware --type-check`, dashboard `build:ui`: pass. - Full `vp test --run`, compared with the base branch (#341) on the same machine: same result on both (119 files pass; 125 files / 17 tests fail on both, all `|addon|` tests that need a current native addon build, which this machine does not have). No test fails only on this branch. - Peer-dependency warnings after install are the same 3 as before. ## Why `@napi-rs/cli` is held at `~3.8.6` `@napi-rs/cli` 3.10.0+ adds a `__napiBindingTarget` export to the generated loader and `index.d.cts` (checked in the published 3.8.0 … 3.10.12 tarballs: first in 3.10.0). Neither committed declaration copy has it, so `packages/core/build.ts` `assertDeclarationCopiesMatch()` would fail every macOS native build. With `^3.8.6`, any fresh resolve (Renovate's lock rebuild included) picks 3.10.x, so the range is narrowed to the version this repo already builds with. The 3.10 upgrade needs regenerated bindings and a full native build; that is a separate change. (Found by Codex adversarial review.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Stacked on #340, which is stacked on #339. Merge in order: #339, #340, then this PR. CI runs only on PRs to
main, so this PR gets CI after GitHub retargets it.Problem
mlx download model -m unsloth/Qwen3.8-Flash-Next-GGUF -g "*UD-Q4_K_XL*"keeps repo paths:discoverLocalChatModelsread only<modelsDir>/*.ggufand<modelsDir>/<repo>/*.gguf. For this layout the repo folder has no config.json, so it was skipped and the model was invisible tomlx serve,mlx agent, and the dashboard coding-agent list. With a root config.json (from--assets-repo), the repo folder itself was registered as a model with no weights. DeepSeek V4.1 Flash uses the same layout.Fix
Only the folder branch of
discoverLocalChatModelschanges (packages/lm/src/model-discovery.ts):<repo>-prefix, as before.requiresAssets, Gemma4/Muse) are still checked beside the GGUF, which matches the loader.onEntryFailureand does not hide its siblings.Real check
Discovery over my real
~/.mlx-node/models(75 models), old vs new: one added line, nothing else changed.Tests
9 new cases in
packages/lm/__test__/model-discovery.test.ts: Flash Next layout, root config.json, mmproj-only root, two variants with a clashing name, depth limit and top-level priority, skipped folders (MTP, dot, assets, safetensors-owned), symlinked and dangling variant links, Gemma sidecars beside the variant, unreadable variant. 7 of them fail on the old code; the other 2 are guards.vp teston model-discovery, gguf-name, agent models, server discover, dashboard models: 161 passed.yarn typecheckandvp lint --type-aware --type-checkare clean.Not in this PR
The dashboard catalog checks (
isModelPresent,isModelInstalledinpackages/dashboard/src/models.ts) read only the model folder's top level. No catalog entry is nested today, so nothing is wrong now. They need the same rule if Flash Next or DeepSeek V4.1 Flash joins the catalog.🤖 Generated with Claude Code