Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(banner): der Knopf verspricht nicht mehr, was der Speicher seit 2.5.9 nicht tut

purpleb1a538c325c8
diff --git a/src/components/layout/StaleModelsBanner.tsx b/src/components/layout/StaleModelsBanner.tsx
index e092cc24..b3989cbc 100644
--- a/src/components/layout/StaleModelsBanner.tsx
+++ b/src/components/layout/StaleModelsBanner.tsx
@@ -8,8 +8,11 @@ import { HINWEIS_TEXT, HINWEIS_ZEILE } from '../../lib/hinweis'
/**
* Top-of-app notice shown when the startup health scan finds installed
- * Ollama models whose manifests are rejected by 0.20.7. Auto-hides when
- * all models are refreshed or the user dismisses for this session.
+ * Ollama models whose manifests are rejected by 0.20.7. Auto-hides when all
+ * models are refreshed, or when the user dismisses it, and a dismissal LASTS:
+ * it is written to disk with the rest of the store and only the next scan that
+ * finds a DIFFERENT set of stale models brings the banner back
+ * (stores/modelHealthStore, `setStaleModels`).
*
* Cause: Ollama auto-upgraded 0.20.6 to 0.20.7 today and started strict-
* rejecting manifests pulled before the registry-side capabilities refresh.
@@ -102,8 +105,14 @@ export function StaleModelsBanner() {
<button
onClick={dismiss}
className="self-center shrink-0 rounded p-[1px] opacity-70 hover:opacity-100 transition-opacity"
- aria-label="Dismiss until next launch"
- title="Dismiss until next launch"
+ /* Hiess bis 3.0.0 "Dismiss until next launch" und war seit 2.5.9
+ falsch: a3b05a44 hat die Ablage dauerhaft gemacht, weil der Knopf
+ vorher nichts bewirkte (die Anlaufpruefung raeumte die Marke bei
+ jedem Start wieder weg), und niemand hat die Beschriftung
+ mitgenommen. Wer sie las, erwartete den Hinweis am naechsten Tag
+ wieder und bekam ihn nie. */
+ aria-label="Dismiss. It comes back only when a different model goes stale."
+ title="Dismiss. It comes back only when a different model goes stale."
>
<X size={11} />
</button>
diff --git a/src/stores/__tests__/modelHealthStore.test.ts b/src/stores/__tests__/modelHealthStore.test.ts
index 8be91ad1..984d0618 100644
--- a/src/stores/__tests__/modelHealthStore.test.ts
+++ b/src/stores/__tests__/modelHealthStore.test.ts
@@ -33,7 +33,7 @@ describe('useModelHealthStore', () => {
expect(useModelHealthStore.getState().staleModels).toEqual(['phi4:14b'])
})
- it('dismiss hides the banner for this session without clearing stale models', () => {
+ it('dismiss hides the banner without clearing stale models', () => {
useModelHealthStore.setState({ staleModels: ['phi4:14b'] })
useModelHealthStore.getState().dismiss()
const s = useModelHealthStore.getState()
diff --git a/src/stores/__tests__/the-dismissal-outlives-the-launch.test.ts b/src/stores/__tests__/the-dismissal-outlives-the-launch.test.ts
new file mode 100644
index 00000000..5a20b41b
--- /dev/null
+++ b/src/stores/__tests__/the-dismissal-outlives-the-launch.test.ts
@@ -0,0 +1,110 @@
+/**
+ * @vitest-environment jsdom
+ *
+ * "Dismiss until next launch" was a promise the code stopped keeping in 2.5.9.
+ *
+ * The banner and its store were written together in ad29b2c0 (2026-04-19) and
+ * the label was true then: the dismissal lived in memory only. Four months
+ * later a3b05a44 made it persist, for a good reason recorded in that commit
+ * body: the startup scan cleared the flag on every launch, so closing the
+ * banner over an untouched stale model meant nothing at all. That commit
+ * touched only the store. Nobody brought the button along, and for the whole
+ * of 2.5.9 to 3.0.0 the app promised a notice would come back tomorrow and
+ * then never showed it again.
+ *
+ * The store is the one that was right, so the label follows the store. What
+ * the code really does is written out below, because "persisted" alone would
+ * be as thin a description as "until next launch" was: it survives a restart,
+ * AND a scan that finds the same stale set again leaves it dismissed, AND a
+ * scan that finds a different one brings the banner back.
+ *
+ * Run: npx vitest run src/stores/__tests__/the-dismissal-outlives-the-launch.test.ts
+ */
+import { describe, it, expect, beforeEach, vi } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
+
+const KEY = 'locally-uncensored-model-health'
+
+/** What zustand wrote under that key, or null when it wrote nothing. */
+function persisted(): { state?: { dismissed?: boolean; staleModels?: string[] } } | null {
+ const raw = localStorage.getItem(KEY)
+ return raw ? JSON.parse(raw) : null
+}
+
+/** A fresh app start: forget every module, then import the store again, which
+ * is when zustand rehydrates it from the storage left behind. */
+async function relaunch() {
+ vi.resetModules()
+ const mod = await import('../modelHealthStore')
+ return mod.useModelHealthStore
+}
+
+beforeEach(async () => {
+ localStorage.clear()
+ vi.resetModules()
+})
+
+describe('what the dismissal really does', () => {
+ it('is written to disk, not just to memory', async () => {
+ const store = await relaunch()
+ store.getState().setStaleModels(['phi4:14b'])
+ store.getState().dismiss()
+ expect(persisted()?.state?.dismissed).toBe(true)
+ })
+
+ it('is still dismissed after a restart', async () => {
+ const first = await relaunch()
+ first.getState().setStaleModels(['phi4:14b'])
+ first.getState().dismiss()
+
+ const second = await relaunch()
+ expect(second.getState().dismissed).toBe(true)
+ expect(second.getState().staleModels).toEqual(['phi4:14b'])
+ })
+
+ it('survives the startup scan that finds the SAME stale model again', async () => {
+ // The branch nothing covered, and the whole point of a3b05a44: the scan
+ // runs once per launch, so an unconditional clear here is what made the
+ // button decorative in the first place.
+ const store = await relaunch()
+ store.getState().setStaleModels(['phi4:14b'])
+ store.getState().dismiss()
+ store.getState().setStaleModels(['phi4:14b'])
+ expect(store.getState().dismissed).toBe(true)
+ })
+
+ it('COUNTER-CHECK: a different stale model brings the banner back', async () => {
+ const store = await relaunch()
+ store.getState().setStaleModels(['phi4:14b'])
+ store.getState().dismiss()
+ store.getState().setStaleModels(['phi4:14b', 'hermes3:8b'])
+ expect(store.getState().dismissed).toBe(false)
+ })
+
+ it('never persists a scan that was running when the app died', async () => {
+ const store = await relaunch()
+ store.setState({ scanning: true })
+ store.getState().dismiss()
+ expect(persisted()?.state).not.toHaveProperty('scanning')
+ expect((await relaunch()).getState().scanning).toBe(false)
+ })
+})
+
+describe('the button says that', () => {
+ const banner = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../components/layout/StaleModelsBanner.tsx'),
+ 'utf8',
+ )
+
+ it('no longer promises the notice comes back next launch', () => {
+ // Only inside a string the user reads. The comment above the button names
+ // the old wording on purpose, so the match has to be the attribute.
+ expect(banner).not.toMatch(/(aria-label|title)="Dismiss until next launch"/)
+ })
+
+ it('names the one thing that really brings it back', () => {
+ expect(banner).toMatch(/title="Dismiss\. It comes back only when a different model goes stale\."/)
+ })
+})
diff --git a/src/stores/modelHealthStore.ts b/src/stores/modelHealthStore.ts
index 507dbb4c..78fa5063 100644
--- a/src/stores/modelHealthStore.ts
+++ b/src/stores/modelHealthStore.ts
@@ -11,8 +11,9 @@ import { safeJSONStorage } from '../lib/storage-quota'
* - Header Lichtschalter — knows without a load attempt that the model is stale
* - DiscoverModels — shows "Needs Refresh" badge instead of green "Installed"
*
- * `dismissed` is session-only so the banner reappears next launch if stale
- * models remain. `lastScanTime` is persisted so we can skip re-scan for a
+ * `dismissed` is PERSISTED, as of 2.5.9 (a3b05a44): see the note on
+ * `partialize` below for why, and `setStaleModels` for the one thing that
+ * clears it again. `lastScanTime` is persisted so we can skip re-scan for a
* cool-down window on app restart.
*/