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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(update): eine gescheiterte Pruefung behauptet nicht mehr die neueste Version
purple39511396dc8e
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex e39b2162..39a2abae 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -2257,7 +2257,7 @@ export function SettingsPage() {// ── Update Section ──────────────────────────────────────────────export function UpdateSection() {- const { currentVersion, latestVersion, updateAvailable, releaseNotes, dismissed, isChecking, autoDownload, downloadStatus, downloadProgress, downloadedBytes, totalBytes, errorMessage, progressNote, checkForUpdate, downloadUpdate, installAndRestart, clearDismiss, setAutoDownload, openReleasePage } = useUpdateStore()+ const { currentVersion, latestVersion, updateAvailable, releaseNotes, dismissed, isChecking, lastCheckFailed, autoDownload, downloadStatus, downloadProgress, downloadedBytes, totalBytes, errorMessage, progressNote, checkForUpdate, downloadUpdate, installAndRestart, clearDismiss, setAutoDownload, openReleasePage } = useUpdateStore()// Defensive: only treat the persisted `latestVersion` as actually newer if a// semver compare confirms it. Otherwise the binary was updated out-of-band// and the persisted value is stale (e.g. localStorage still says 2.3.8 while@@ -2376,6 +2376,13 @@ export function UpdateSection() {)}</div></div>+ ) : lastCheckFailed ? (+ /* R2-12: hier stand der gruene Haken auch dann, wenn die Pruefung gar+ nicht durchgekommen war. Eine ruhige Zeile sagt, was wirklich+ passiert ist, ohne aus einem Netzfehler einen Alarm zu machen. */+ <div className="flex items-center gap-2 text-[0.6rem] text-gray-600" data-testid="update-check-failed">+ Could not check for updates. Check your connection and try again.+ </div>) : (<div className="flex items-center gap-2 text-[0.6rem] text-gray-600"><Check size={12} className="text-emerald-500" />diff --git a/src/stores/__tests__/updateStore.test.ts b/src/stores/__tests__/updateStore.test.tsindex 89f08cbc..376864ed 100644--- a/src/stores/__tests__/updateStore.test.ts+++ b/src/stores/__tests__/updateStore.test.ts@@ -180,12 +180,49 @@ describe('updateStore', () => {expect(useUpdateStore.getState().updateAvailable).toBe(false)})- it('handles fetch error gracefully (offline)', async () => {+ /**+ * R2-12 und R2-13: der Fehlerfall schrieb dasselbe wie der Erfolgsfall.+ * Die Einstellungsseite las daraus den gruenen Haken, und `lastChecked`+ * sperrte danach sechs Stunden lang jede automatische Wiederholung. Wer+ * beim Start offline war, bekam also einen Haken, den niemand geprueft+ * hatte, und ein halber Tag verging bis zum naechsten Versuch.+ */+ it('a failed check says so and does not block the next attempt', async () => {vi.spyOn(globalThis, 'fetch').mockRejectedValueOnce(new Error('Network error'))await useUpdateStore.getState().checkForUpdate()expect(useUpdateStore.getState().isChecking).toBe(false)+ expect(useUpdateStore.getState().lastCheckFailed).toBe(true)+ expect(useUpdateStore.getState().lastChecked).toBeNull()++ // Und der naechste automatische Aufruf fetcht wirklich wieder.+ const zweiter = vi.spyOn(globalThis, 'fetch').mockRejectedValueOnce(new Error('Network error'))+ await useUpdateStore.getState().checkForUpdate()+ expect(zweiter).toHaveBeenCalled()+ })++ it('a refused check counts as failed too, not as up to date', async () => {+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce({ ok: false, status: 403 } as Response)++ await useUpdateStore.getState().checkForUpdate()+ expect(useUpdateStore.getState().lastCheckFailed).toBe(true)+ expect(useUpdateStore.getState().lastChecked).toBeNull()+ expect(useUpdateStore.getState().updateAvailable).toBe(false)+ })++ it('NEGATIVKONTROLLE: a successful check keeps the tick and holds the interval', async () => {+ const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue({+ ok: true,+ json: async () => ({ tag_name: 'v0.0.1', body: '' }),+ } as Response)++ await useUpdateStore.getState().checkForUpdate()+ expect(useUpdateStore.getState().lastCheckFailed).toBe(false)expect(useUpdateStore.getState().lastChecked).not.toBeNull()++ fetchSpy.mockClear()+ await useUpdateStore.getState().checkForUpdate()+ expect(fetchSpy, 'a second check within six hours went out anyway').not.toHaveBeenCalled()})it('does not run concurrently (isChecking guard)', async () => {diff --git a/src/stores/updateStore.ts b/src/stores/updateStore.tsindex b1b4b923..0fab803d 100644--- a/src/stores/updateStore.ts+++ b/src/stores/updateStore.ts@@ -133,6 +133,16 @@ interface UpdateState {releaseNotes: string | nullisChecking: booleanlastChecked: number | null+ /**+ * R2-12: eine gescheiterte Pruefung schrieb dasselbe wie eine erfolgreiche.+ * Die Einstellungsseite las daraus den gruenen Haken "You are on the latest+ * version.", und R2-13: `lastChecked` sperrte danach sechs Stunden lang jede+ * automatische Wiederholung. Wer beim Start offline war, bekam also einen+ * Haken, den niemand geprueft hatte, und der halbe Tag verging, bevor die App+ * es noch einmal versuchte. Eine gescheiterte Pruefung setzt deshalb dieses+ * Feld und laesst `lastChecked` in Ruhe.+ */+ lastCheckFailed: booleandismissed: string | null/** Fetch the update in the background as soon as it is found, so the badge* offers a one-click Restart instead of a download the user has to sit@@ -232,6 +242,7 @@ export const useUpdateStore = create<UpdateState>()(releaseNotes: null,isChecking: false,lastChecked: null,+ lastCheckFailed: false,dismissed: null,autoDownload: true,@@ -280,6 +291,7 @@ export const useUpdateStore = create<UpdateState>()(releaseNotes: update.body ? truncateNotes(update.body) : null,isChecking: false,lastChecked: Date.now(),+ lastCheckFailed: false,...(isNewTarget? {downloadStatus: 'idle' as DownloadStatus,@@ -313,6 +325,7 @@ export const useUpdateStore = create<UpdateState>()(set({isChecking: false,lastChecked: Date.now(),+ lastCheckFailed: false,updateAvailable: false,latestVersion: null,releaseNotes: null,@@ -325,7 +338,7 @@ export const useUpdateStore = create<UpdateState>()({ headers: { 'Accept': 'application/vnd.github.v3+json' } })if (!res.ok) {- set({ isChecking: false, lastChecked: Date.now() })+ set({ isChecking: false, lastCheckFailed: true })return}const data = await res.json()@@ -338,10 +351,11 @@ export const useUpdateStore = create<UpdateState>()(releaseNotes: data.body ? truncateNotes(data.body) : null,isChecking: false,lastChecked: Date.now(),+ lastCheckFailed: false,})}} catch {- set({ isChecking: false, lastChecked: Date.now() })+ set({ isChecking: false, lastCheckFailed: true })}},