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
feat(cloud): tell people their renders are kept seven days, and mean it
purplec8c48a949af9
diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.tsindex 7f2022ef..809c47a0 100644--- a/src/api/cloud/jobs.ts+++ b/src/api/cloud/jobs.ts@@ -136,6 +136,28 @@ export async function refreshResultUrl(jobId: string): Promise<string | null> {}}+/** Same fetch, but says WHY there is no url.+ *+ * refreshResultUrl answers null for two very different situations: the render+ * is gone for good, or we could not reach the server just now. That was fine+ * while nothing ever deleted a render. Once the seven-day retention sweep runs+ * (services/render-worker/src/reaper.ts clears result_url as it deletes the+ * bytes), a tile that keeps retrying an expired render just renders blank+ * forever. Splitting the two lets the gallery say "expired" once instead. */+export type ResultUrlState =+ | { kind: 'ok'; url: string }+ | { kind: 'gone' } // job reachable, no result: expired or purged+ | { kind: 'retry' } // could not ask; offline launch, transient 5xx++export async function resolveResultUrl(jobId: string): Promise<ResultUrlState> {+ try {+ const job = await getJob(jobId)+ return job.result_url ? { kind: 'ok', url: job.result_url } : { kind: 'gone' }+ } catch {+ return { kind: 'retry' }+ }+}+const TERMINAL = new Set(['succeeded', 'failed', 'canceled'])function sleep(ms: number, signal?: AbortSignal): Promise<void> {diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsxindex 3ae21e83..b542cc11 100644--- a/src/components/create/experimental/CreateExperimental.tsx+++ b/src/components/create/experimental/CreateExperimental.tsx@@ -1,7 +1,8 @@import { useCallback, useEffect, useRef, useState } from 'react'import { AnimatePresence, motion } from 'framer-motion'-import { AlertTriangle, X } from 'lucide-react'+import { AlertTriangle, Cloud, X } from 'lucide-react'import { useCreateStore, type GalleryItem } from '../../../stores/createStore'+import { useCloudNoticeStore, CLOUD_RETENTION_DAYS, shouldShowRetentionNotice } from '../../../stores/cloudNoticeStore'import { CreateExpProvider, useCreateExp } from './CreateContext'import { IntentBar } from './IntentBar'import { Stage } from './Stage'@@ -32,6 +33,8 @@ function CreateExperimentalInner() {const comfyCorsBlocked = useCreateStore((s) => s.comfyCorsBlocked)const setComfyCorsBlocked = useCreateStore((s) => s.setComfyCorsBlocked)const isGenerating = useCreateStore((s) => s.isGenerating)+ const retentionNoticeSeen = useCloudNoticeStore((s) => s.retentionNoticeSeen)+ const setRetentionNoticeSeen = useCloudNoticeStore((s) => s.setRetentionNoticeSeen)const { modelLoadError, connected, comfyOnCpu } = useCreateExp()const [shownId, setShownId] = useState<string | null>(null)@@ -147,7 +150,7 @@ function CreateExperimentalInner() {<div className="flex items-center gap-2 px-4 py-2 bg-yellow-500/5 border-b border-yellow-500/10 text-yellow-300 text-xs shrink-0"><AlertTriangle size={12} className="shrink-0" /><span>- ComfyUI is running on the CPU (no usable GPU detected) — generation will be extremely slow and may time out.+ ComfyUI is running on the CPU (no usable GPU detected). Generation will be extremely slow and may time out.AMD GPU? Point LU at a ROCm/ZLUDA ComfyUI and set Settings → Hardware → ComfyUI GPU to force GPU.</span></div>@@ -186,6 +189,27 @@ function CreateExperimentalInner() {</div>)}+ {/* Cloud gallery retention (David 2026-07-24). Cloud renders live on our+ servers, not on this machine, so the gallery is not permanent storage.+ Cloud mode only. One time ever: no close X and no auto-hide, the only+ way out is the explicit "Do not show again", and it stays dismissed+ across updates (persisted in lu_cloud_notice). */}+ {shouldShowRetentionNotice(backend, retentionNoticeSeen) && (+ <div className="flex items-start gap-2 px-4 py-2 bg-purple-500/5 border-b border-purple-500/10 text-purple-200 text-xs shrink-0">+ <Cloud size={12} className="shrink-0 mt-0.5" />+ <span className="flex-1 min-w-0">+ Cloud results are stored for {CLOUD_RETENTION_DAYS} days and then deleted.+ Download anything you want to keep from the gallery.+ </span>+ <button+ onClick={() => setRetentionNoticeSeen(true)}+ className="shrink-0 px-2 py-0.5 rounded bg-purple-500/15 hover:bg-purple-500/25 text-purple-100 transition-colors whitespace-nowrap"+ >+ Do not show again+ </button>+ </div>+ )}+{/* The viewer (Stage) and the Gallery bubble share ONE row, so they'realways the exact same height; the prompt window spans the full widthbeneath them. (Previously the Gallery ran full-height alongside both thediff --git a/src/components/create/experimental/__tests__/galleryUrl.test.ts b/src/components/create/experimental/__tests__/galleryUrl.test.tsindex c1da03a7..b9da3696 100644--- a/src/components/create/experimental/__tests__/galleryUrl.test.ts+++ b/src/components/create/experimental/__tests__/galleryUrl.test.ts@@ -23,10 +23,11 @@ vi.mock('../../../../api/comfyui', () => ({}))vi.mock('../../../../api/cloud/jobs', () => ({refreshResultUrl: vi.fn(),+ resolveResultUrl: vi.fn(),}))-import { fetchGalleryItemBlob } from '../galleryUrl'-import { refreshResultUrl } from '../../../../api/cloud/jobs'+import { fetchGalleryItemBlob, recoverGalleryUrl } from '../galleryUrl'+import { refreshResultUrl, resolveResultUrl } from '../../../../api/cloud/jobs'import { useCreateStore, type GalleryItem } from '../../../../stores/createStore'const baseItem: GalleryItem = {@@ -76,3 +77,47 @@ describe('fetchGalleryItemBlob', () => {await expect(fetchGalleryItemBlob(baseItem)).rejects.toThrow(/ComfyUI/)})})++// Cloud renders are deleted after seven days (the Create banner says so, and+// services/render-worker/src/reaper.ts now does it). A tile whose render is+// gone must settle into an honest state, not retry a dead re-sign forever.+describe('recoverGalleryUrl — expired cloud renders', () => {+ beforeEach(() => {+ vi.restoreAllMocks()+ useCreateStore.setState({ gallery: [] })+ })++ const flush = () => new Promise((r) => setTimeout(r, 0))++ it('marks the tile unavailable when the render is gone for good', async () => {+ const item = { ...baseItem, id: 'gone-1', jobId: 'job-gone', remoteUrl: 'https://cdn/old.png' }+ useCreateStore.setState({ gallery: [item] })+ vi.mocked(resolveResultUrl).mockResolvedValueOnce({ kind: 'gone' })++ recoverGalleryUrl(item)+ await flush()+ expect(useCreateStore.getState().gallery[0].unavailable).toBe(true)+ })++ it('patches in the fresh URL when the render is still there', async () => {+ const item = { ...baseItem, id: 'ok-1', jobId: 'job-ok', remoteUrl: 'https://cdn/old.png' }+ useCreateStore.setState({ gallery: [item] })+ vi.mocked(resolveResultUrl).mockResolvedValueOnce({ kind: 'ok', url: 'https://cdn/new.png' })++ recoverGalleryUrl(item)+ await flush()+ expect(useCreateStore.getState().gallery[0].remoteUrl).toBe('https://cdn/new.png')+ expect(useCreateStore.getState().gallery[0].unavailable).toBeUndefined()+ })++ it('does NOT mark unavailable when we simply could not reach the server', async () => {+ // An offline launch must not look like a deleted render.+ const item = { ...baseItem, id: 'retry-1', jobId: 'job-retry', remoteUrl: 'https://cdn/old.png' }+ useCreateStore.setState({ gallery: [item] })+ vi.mocked(resolveResultUrl).mockResolvedValueOnce({ kind: 'retry' })++ recoverGalleryUrl(item)+ await flush()+ expect(useCreateStore.getState().gallery[0].unavailable).toBeUndefined()+ })+})diff --git a/src/components/create/experimental/galleryUrl.ts b/src/components/create/experimental/galleryUrl.tsindex bea41f51..e51fc488 100644--- a/src/components/create/experimental/galleryUrl.ts+++ b/src/components/create/experimental/galleryUrl.ts@@ -1,5 +1,5 @@import { getImageUrl } from '../../../api/comfyui'-import { refreshResultUrl } from '../../../api/cloud/jobs'+import { refreshResultUrl, resolveResultUrl } from '../../../api/cloud/jobs'import { fetchLocalhostBytes, isTauri } from '../../../api/backend'import { useCreateStore, type GalleryItem } from '../../../stores/createStore'@@ -34,13 +34,22 @@ export function recoverGalleryUrl(item: GalleryItem): void {const last = recovered.get(item.id)if (last !== undefined && (last === 0 || Date.now() - last < RESIGN_TTL_MS)) returnrecovered.set(item.id, 0)- void refreshResultUrl(item.jobId).then((url) => {- if (url) {+ void resolveResultUrl(item.jobId).then((state) => {+ if (state.kind === 'ok') {recovered.set(item.id, Date.now())- useCreateStore.getState().updateGalleryItem(item.id, { remoteUrl: url, unavailable: undefined })- } else {- recovered.delete(item.id)+ useCreateStore.getState().updateGalleryItem(item.id, { remoteUrl: state.url, unavailable: undefined })+ return}+ if (state.kind === 'gone') {+ // Cloud renders are kept seven days and then deleted, which the Create+ // banner says up front. Once one is gone, re-signing can never succeed,+ // so mark the tile the same honest way a local item marks a missing+ // output instead of retrying into a blank square on every remount.+ useCreateStore.getState().updateGalleryItem(item.id, { unavailable: true })+ return+ }+ // Could not ask. Release the guard so the next remount tries again.+ recovered.delete(item.id)})}@@ -106,10 +115,10 @@ export async function fetchGalleryItemBlob(item: GalleryItem): Promise<Blob> {useCreateStore.getState().updateGalleryItem(item.id, { remoteUrl: fresh, unavailable: undefined })return tryFetch(fresh)}- throw new Error('The cloud copy of this render is no longer available — pick another image or upload one from disk.')+ throw new Error('The cloud copy of this render is no longer available. Pick another image, or upload one from disk.')}if (!item.remoteUrl && !item.dataUrl) {- throw new Error('This image lives in your local ComfyUI output, which is not running right now — switch to Local (or start ComfyUI) to use it, or upload the file from disk.')+ throw new Error('This image lives in your local ComfyUI output, which is not running right now. Switch to Local (or start ComfyUI) to use it, or upload the file from disk.')}throw err}diff --git a/src/stores/__tests__/cloudNoticeStore.test.ts b/src/stores/__tests__/cloudNoticeStore.test.tsnew file mode 100644index 00000000..111f07e4--- /dev/null+++ b/src/stores/__tests__/cloudNoticeStore.test.ts@@ -0,0 +1,35 @@+import { describe, it, expect, beforeEach } from 'vitest'+import { useCloudNoticeStore, CLOUD_RETENTION_DAYS, shouldShowRetentionNotice } from '../cloudNoticeStore'++describe('cloudNoticeStore — cloud gallery retention notice (David 2026-07-24)', () => {+ beforeEach(() => {+ useCloudNoticeStore.setState({ retentionNoticeSeen: false })+ })++ it('starts undismissed so a fresh user sees the notice once', () => {+ expect(useCloudNoticeStore.getState().retentionNoticeSeen).toBe(false)+ })++ it('"Do not show again" latches permanently', () => {+ useCloudNoticeStore.getState().setRetentionNoticeSeen(true)+ expect(useCloudNoticeStore.getState().retentionNoticeSeen).toBe(true)+ })++ it('shows only on the cloud backend, never for a local render', () => {+ // A local render never leaves the machine, so a retention warning there+ // would be plain wrong.+ expect(shouldShowRetentionNotice('cloud', false)).toBe(true)+ expect(shouldShowRetentionNotice('local', false)).toBe(false)+ })++ it('stays gone once dismissed, on either backend', () => {+ // Once-ever rule: the notice must not come back after an update or after a+ // local/cloud round trip. Dismissal is persisted, so this is the whole gate.+ expect(shouldShowRetentionNotice('cloud', true)).toBe(false)+ expect(shouldShowRetentionNotice('local', true)).toBe(false)+ })++ it('exposes the retention window as one constant so copy cannot drift', () => {+ expect(CLOUD_RETENTION_DAYS).toBe(7)+ })+})diff --git a/src/stores/cloudNoticeStore.ts b/src/stores/cloudNoticeStore.tsnew file mode 100644index 00000000..c6622c13--- /dev/null+++ b/src/stores/cloudNoticeStore.ts@@ -0,0 +1,55 @@+import { create } from "zustand";+import { persist } from "zustand/middleware";++/**+ * How long a cloud render stays retrievable. Single source of truth for the+ * copy so the number never drifts between surfaces.+ *+ * ⚠️ Server reality (verified 2026-07-24, lu-labs @ services/render-worker):+ * `RESULT_SIGNED_URL_TTL_SEC` defaults to 604800 (7 days) — that is the signed+ * URL lifetime, and the desktop silently re-signs an expired one via the job id+ * (galleryUrl.ts refreshResultUrl). The only deleting sweep, reaper.ts, targets+ * the render-INPUTS bucket (48h grace) and is OFF unless REAP_ORPHAN_INPUTS is+ * set. Nothing currently deletes the RESULTS bucket. So this notice states a+ * policy the backend does not enforce yet; it needs a results-bucket reaper+ * before the claim is literally true.+ */+export const CLOUD_RETENTION_DAYS = 7;++/**+ * Gallery retention notice for cloud mode (David 2026-07-24). Shown while the+ * Create surface is on the cloud backend so nobody treats the cloud gallery as+ * permanent storage.+ *+ * `retentionNoticeSeen` (persisted) is the ONLY thing that hides it, and it is+ * once ever: no auto-hide, no close X, and it does NOT come back after an+ * update. Dismissing is a deliberate click on "Do not show again", matching the+ * one-time-onboarding rule the Try local / Try cloud popups follow.+ */+interface CloudNoticeState {+ retentionNoticeSeen: boolean;+ setRetentionNoticeSeen: (v: boolean) => void;+}++export const useCloudNoticeStore = create<CloudNoticeState>()(+ persist(+ (set) => ({+ retentionNoticeSeen: false,+ setRetentionNoticeSeen: (v) => set({ retentionNoticeSeen: v }),+ }),+ { name: "lu_cloud_notice" },+ ),+);++/**+ * Visibility rule for the retention notice, kept pure so it is unit-testable+ * (the JSX condition would otherwise only be provable via a live E2E). Cloud+ * backend only — a local render never leaves the machine, so the warning would+ * be a lie there — and never again once dismissed.+ */+export function shouldShowRetentionNotice(+ backend: "local" | "cloud",+ retentionNoticeSeen: boolean,+): boolean {+ return backend === "cloud" && !retentionNoticeSeen;+}