Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): match installed MLX repo against LM Studio's @quant id

[._.]/ Adam Eivy6709009fd7c2
diff --git a/server/services/huggingFaceCatalog.js b/server/services/huggingFaceCatalog.js
index 57da57dc89..74415e82ac 100644
--- a/server/services/huggingFaceCatalog.js
+++ b/server/services/huggingFaceCatalog.js
@@ -406,10 +406,13 @@ function lmStudioParts(id) {
// Is a specific backend install id present among the installed ids? Ollama tracks
// each `hf.co/<repo>:<quant>` as its own model, so the match is quant-precise.
-// LM Studio is matched per-quant too — but only when the installed entry carries
-// a quant (it does when LM Studio reported a `quantization`); an entry without
-// one falls back to repo-level, the best granularity that entry exposes. This is
-// why selecting an un-downloaded quant correctly shows Install instead of hiding it.
+// LM Studio matches on the repo base plus a quant match — but repo-level fallback
+// applies when EITHER side lacks a quant: an installed entry without one (LM Studio
+// reported no `quantization`) OR a target without one. The target-side fallback is
+// what an MLX repo needs — its install id is the bare repo (the quant is baked into
+// the repo name, e.g. `mlx-community/Foo-4bit`), so it must still match an installed
+// `mlx-community/Foo-4bit@4bit`. GGUF variants always carry a quant, so this never
+// loosens per-quant GGUF matching; it only adds the missing repo-level case.
function installIdInstalled(backend, installId, repository, installedIds) {
if (backend === 'ollama') {
const target = normalizeOllamaInstalled(installId)
@@ -418,7 +421,7 @@ function installIdInstalled(backend, installId, repository, installedIds) {
const v = lmStudioParts(installId)
return installedIds.some((id) => {
const e = lmStudioParts(id)
- return e.base === v.base && (e.quant === '' || e.quant === v.quant)
+ return e.base === v.base && (e.quant === '' || v.quant === '' || e.quant === v.quant)
})
}
diff --git a/server/services/huggingFaceCatalog.test.js b/server/services/huggingFaceCatalog.test.js
index 4adb51daf1..2ea7c88e30 100644
--- a/server/services/huggingFaceCatalog.test.js
+++ b/server/services/huggingFaceCatalog.test.js
@@ -512,8 +512,11 @@ describe('huggingFaceCatalog', () => {
[(u) => u.includes('blobs=true'), mlxBlobs(repo, { 'model.safetensors': 18_000_000_000 })],
]))
+ // The route appends LM Studio's reported quantization, so an installed MLX
+ // model arrives as `<repo>@<quant>` — the bare-repo MLX target must still
+ // match it (repo-level fallback when the target carries no quant).
const results = await searchHuggingFaceModels({
- backend: 'lmstudio', query: 'qwythos', systemMemoryBytes: 128 * 1024 ** 3, appleSilicon: true, installedIds: [repo]
+ backend: 'lmstudio', query: 'qwythos', systemMemoryBytes: 128 * 1024 ** 3, appleSilicon: true, installedIds: [`${repo}@bf16`]
})
const mlx = results.find((r) => r.repository === repo)