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): preserve installed state for default/:latest Ollama builds

[._.]/ Adam Eivyc6083a8eca83
diff --git a/server/services/huggingFaceCatalog.js b/server/services/huggingFaceCatalog.js
index c8772285cf..e0cc0cfaa5 100644
--- a/server/services/huggingFaceCatalog.js
+++ b/server/services/huggingFaceCatalog.js
@@ -924,6 +924,13 @@ function quantFromInstallId(backend, id) {
async function applyOllamaRegistryVariants(entry, { usableBytes, installedIds }) {
const candidates = await fetchOllamaRegistryVariants(entry.id, { paramsHint: entry.params })
if (candidates.length === 0) return false
+ // The bare curated id (`llama3.2`, pulled as `:latest`) install is recorded on the
+ // entry's pre-enrichment `installed` flag — getCatalog matched it latest-normalized.
+ // The per-quant variants below use exact `<name>:<tag>` ids that never include that
+ // alias, so capture the default install now and OR it back after applyVariant
+ // overwrites `installed`; otherwise an already-installed model shows "Install" and a
+ // click pulls a duplicate specific-quant tag.
+ const installedAsDefault = entry.installed === true
const variants = candidates
.map((c) => {
const sizeBytes = Number.isFinite(c.sizeBytes) ? c.sizeBytes : null
@@ -946,6 +953,9 @@ async function applyOllamaRegistryVariants(entry, { usableBytes, installedIds })
// Keep the curated entry's stable id (rewriteInstallId: false) — the playground
// matches installed models on it; the UI installs the recommended variant.
applyChosenVariant(entry, variants, { usableBytes, rewriteInstallId: false })
+ // Preserve the card-level "installed" state from the pre-existing default/:latest
+ // build — the user has a build of this model even if no specific quant variant matches.
+ if (installedAsDefault) entry.installed = true
entry.format = 'gguf'
return true
}
diff --git a/server/services/huggingFaceCatalog.test.js b/server/services/huggingFaceCatalog.test.js
index 25601e2029..57ea68ed3b 100644
--- a/server/services/huggingFaceCatalog.test.js
+++ b/server/services/huggingFaceCatalog.test.js
@@ -720,6 +720,25 @@ describe('huggingFaceCatalog', () => {
expect(catalog[0].variants.find((v) => v.installId === 'gpt-pick:20b-q8_0').installed).toBe(false)
})
+ it('preserves the card-level installed state for a default/:latest bare Ollama install', async () => {
+ __resetOllamaRegistryCache()
+ fetch.mockImplementation(ollamaRegistry(
+ ['3b-instruct-q4_K_M', '3b-instruct-q8_0'],
+ { '3b-instruct-q4_K_M': 2_000_000_000, '3b-instruct-q8_0': 3_500_000_000 }
+ ))
+ // getCatalog flagged this installed (the user pulled `defllama`, stored as :latest).
+ // None of the exact `<name>:<tag>` variants matches that alias.
+ const catalog = [{ id: 'defllama', key: 'defllama', name: 'Def Llama 3B', category: 'chat', params: '3B', size: '2.0 GB', installed: true }]
+ await enrichCatalogWithVariants(catalog, {
+ backend: 'ollama', systemMemoryBytes: 128 * 1024 ** 3, installedIds: ['defllama:latest']
+ })
+
+ // The card still reads as installed (a build is present) even though no specific
+ // quant variant matches — so it won't show "Install" and pull a duplicate tag.
+ expect(catalog[0].installed).toBe(true)
+ expect(catalog[0].variants.every((v) => v.installed === false)).toBe(true)
+ })
+
it('leaves a bare Ollama name untouched when the model is not on the registry', async () => {
__resetOllamaRegistryCache()
// tags/list 404s (unknown model) → no tags → no variants.