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(create): confirm before reinstalling the local trainer
purplea7bfc7bd2ea5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 85df9814..46405d57 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -136,6 +136,10 @@ installs stop losing environment variables to it.shows.- **ltx-2 LoRA renders in the desktop app now carry a credit cost**, matchingthe web catalog, instead of pricing as free.+- **Reinstall trainer in Character Studio now opens a confirmation dialog+ first**, showing the current trainer folder and the same install-path field+ as the first setup, instead of starting the reinstall the moment the button+ is clicked.## [3.0.0] - 2026-09-13diff --git a/e2e/trainer-error-readable.spec.ts b/e2e/trainer-error-readable.spec.tsindex 01fff933..bff3f8cd 100644--- a/e2e/trainer-error-readable.spec.ts+++ b/e2e/trainer-error-readable.spec.ts@@ -30,6 +30,9 @@ for (const ready of [false, true]) {await page.getByRole('button', { name: /^Create$/ }).click()await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()await page.getByRole('button', { name: ready ? 'Reinstall trainer' : 'Set up trainer', exact: true }).click()+ // Z5: "Reinstall trainer" oeffnet jetzt nur den Bestaetigungsdialog; der+ // Install-Befehl feuert erst nach "Reinstall" darin, nicht beim ersten Klick.+ if (ready) await page.getByRole('dialog').getByRole('button', { name: 'Reinstall', exact: true }).click()const note = page.getByRole('status').filter({ hasText: 'Diagnostic line 80' })await expect(note).toBeVisible()const result = await note.evaluate((el) => {diff --git a/e2e/trainer-reinstall-confirm.spec.ts b/e2e/trainer-reinstall-confirm.spec.tsnew file mode 100644index 00000000..2cd065ff--- /dev/null+++ b/e2e/trainer-reinstall-confirm.spec.ts@@ -0,0 +1,142 @@+import { test, expect } from '@playwright/test'+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'+import { routeCloud, seedOnboardingDone, cloudSwitch } from './support/cloud-mock'++/**+ * Z5 (box-gruen/b BERICHT.md, Zusatzpunkt Z5, e2e Windows 18.09.2026): auf+ * einer Box mit bereits installiertem Trainer hat "Reinstall trainer"+ * `install_character_trainer` im selben Moment ausgeloest, in dem geklickt+ * wurde -- keine Bestaetigung, keine Chance, den Installationsordner vorher+ * zu sehen oder zu aendern, echte pip-Aktivitaet (5,3 GB venv, ein editable+ * Reinstall) hat begonnen, bevor der Tester irgendetwas entschieden hatte.+ * Diese Spec beweist den Fix: der Klick oeffnet jetzt nur einen Dialog, und+ * `install_character_trainer` wird genau einmal aufgerufen, erst nachdem+ * "Reinstall" gedrueckt wurde, mit dem Pfad, der im eigenen Ordnerfeld des+ * Dialogs steht.+ *+ * Run: npx playwright test e2e/trainer-reinstall-confirm.spec.ts+ */++const SHOT_DIR = '/Users/purple/Desktop/LU/lu-301/bau/trainerconfirm-shots'++async function gotoReadyTrainer(page: import('@playwright/test').Page) {+ await page.addInitScript(tauriMockInit, {+ assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' as const,+ })+ await page.addInitScript(() => {+ const bridge = (window as unknown as {+ __TAURI_INTERNALS__: { invoke: (cmd: string, args: unknown) => Promise<unknown> }+ }).__TAURI_INTERNALS__+ const invoke = bridge.invoke+ ;(window as unknown as { __installCalls: unknown[] }).__installCalls = []+ bridge.invoke = async (cmd: string, args: unknown) => {+ if (cmd === 'character_trainer_status') return {+ envReady: true, basesReady: true, dit: 'x', textEncoder: 'x', vae: 'x',+ root: 'C:\\test-trainer', customized: false, suggestedRoot: null,+ install: { status: 'idle', logs: [] },+ }+ if (cmd === 'install_character_trainer') {+ ;(window as unknown as { __installCalls: unknown[] }).__installCalls.push(args)+ const installPath = (args as { installPath?: string } | null)?.installPath+ if (installPath && !/^[A-Za-z]:\\|^\//.test(installPath)) {+ throw new Error('The trainer folder must be an absolute path.')+ }+ return { status: 'installing' }+ }+ return invoke(cmd, args)+ }+ })+ await seedOnboardingDone(page)+ await routeCloud(page, { license: 'active', access: true, mediaLive: true })+ await page.goto('/')+ await expect(cloudSwitch(page)).toBeVisible()+ await page.getByRole('button', { name: /^Create$/ }).click()+ await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()+}++async function installCallCount(page: import('@playwright/test').Page): Promise<number> {+ return page.evaluate(() => (window as unknown as { __installCalls: unknown[] }).__installCalls.length)+}++test('Reinstall trainer opens a dialog first -- no install call on the bare click (Negativkontrolle)', async ({ page }, testInfo) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ await expect(dialog).toBeVisible()+ expect(await installCallCount(page)).toBe(0)+ await page.screenshot({ path: `${SHOT_DIR}/${testInfo.titlePath.length}-dialog-open.png` })+})++test('the dialog shows the current trainer folder, pre-filled, and focuses Cancel', async ({ page }) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ await expect(dialog).toBeVisible()+ await expect(dialog.locator('input')).toHaveValue('C:\\test-trainer')+ await expect(dialog.getByRole('button', { name: 'Cancel' })).toBeFocused()+})++test('Cancel closes the dialog and calls nothing', async ({ page }) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ await expect(dialog).toBeVisible()+ await dialog.getByRole('button', { name: 'Cancel' }).click()+ await expect(dialog).not.toBeVisible()+ expect(await installCallCount(page)).toBe(0)+ // Der Trainer bleibt exakt wie vorher -- der Knopf zeigt wieder sein Ruhe-Label.+ await expect(page.getByRole('button', { name: 'Reinstall trainer', exact: true })).toBeVisible()+})++test('Escape closes the dialog and calls nothing', async ({ page }) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ await expect(dialog).toBeVisible()+ await page.keyboard.press('Escape')+ await expect(dialog).not.toBeVisible()+ expect(await installCallCount(page)).toBe(0)+})++test('confirming calls install_character_trainer exactly once, with the edited path', async ({ page }, testInfo) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ const field = dialog.locator('input')+ await field.fill('D:\\NewTrainerDrive')+ await dialog.getByRole('button', { name: 'Reinstall', exact: true }).click()+ await expect(dialog).not.toBeVisible()+ expect(await installCallCount(page)).toBe(1)+ const calls = await page.evaluate(() => (window as unknown as { __installCalls: unknown[] }).__installCalls)+ expect(calls).toEqual([{ installPath: 'D:\\NewTrainerDrive' }])+ await page.screenshot({ path: `${SHOT_DIR}/${testInfo.titlePath.length}-confirmed-reinstall.png` })+})++test('confirming with an unchanged path reinstalls to the same folder, still exactly once', async ({ page }) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ await dialog.getByRole('button', { name: 'Reinstall', exact: true }).click()+ await expect(dialog).not.toBeVisible()+ expect(await installCallCount(page)).toBe(1)+ const calls = await page.evaluate(() => (window as unknown as { __installCalls: unknown[] }).__installCalls)+ expect(calls).toEqual([{ installPath: 'C:\\test-trainer' }])+})++test('an invalid path blocks: the backend rejects, no environment ever gets touched', async ({ page }, testInfo) => {+ await gotoReadyTrainer(page)+ await page.getByRole('button', { name: 'Reinstall trainer', exact: true }).click()+ const dialog = page.getByRole('dialog', { name: 'Reinstall the trainer?' })+ const field = dialog.locator('input')+ await field.fill('relative-path-not-allowed')+ await dialog.getByRole('button', { name: 'Reinstall', exact: true }).click()+ // Der Dialog schliesst optimistisch (dieselbe UX wie beim "Set up trainer"+ // des Erstsetup-Gates); die Ablehnung erscheint als Statuszeile.+ const note = page.getByRole('status').filter({ hasText: 'absolute path' })+ await expect(note).toBeVisible()+ expect(await installCallCount(page)).toBe(1)+ await page.screenshot({ path: `${SHOT_DIR}/${testInfo.titlePath.length}-invalid-path-blocked.png` })+ // Erneutes Klicken auf Reinstall haeuft keinen zweiten Aufruf auf den+ // abgelehnten obendrauf -- der Knopf zeigt wieder sein Ruhe-Label.+ await expect(page.getByRole('button', { name: 'Reinstall trainer', exact: true })).toBeVisible()+})diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsxindex 3a877d07..9a5ace89 100644--- a/src/components/create/experimental/SpecialIntentControls.tsx+++ b/src/components/create/experimental/SpecialIntentControls.tsx@@ -35,6 +35,7 @@ import { Segmented } from '../ui/Segmented'import { Slider } from '../ui/Slider'import { cn } from '../ui/cn'import { useClickAway } from '../ui/useClickAway'+import { Modal } from '../../ui/Modal'export function SpecialControls({ intent }: { intent: CreateIntent }) {switch (intent) {@@ -257,6 +258,93 @@ function CharacterPanel() {)}+// Das Trainer-Installationspfad-Feld, gemeinsam genutzt vom Erstsetup-Gate+// UND dem Reinstall-Bestaetigungsdialog (Z5-Fund, box-gruen/b): beide+// brauchen genau dasselbe "Pfad eintippen wird zum Installationsziel"+// Bedienelement mit derselben Rust-Validierung, also eine Komponente statt+// zweier Kopien, die auseinanderlaufen koennten. `status` speist nur+// `trainerRootHint`; Wert und Aenderungs-Handler gehoeren dem Aufrufer.+function TrainerPathField({+ value,+ onChange,+ status,+}: {+ value: string+ onChange: (v: string) => void+ status: Pick<TrainerStatus, 'root' | 'customized' | 'suggestedRoot'>+}) {+ return (+ <div className="flex flex-col items-center gap-0.5">+ <input+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder={`e.g. ${trainerPathPlaceholder(isWindows(), isMacOS())}`}+ className="t-control w-64 px-2.5 h-[var(--control-h-sm)] rounded-md bg-white/[0.03] border border-white/[0.06] text-gray-200 placeholder-gray-600 focus:outline-none focus:border-white/15"+ />+ <span className="t-label text-gray-600">{trainerRootHint(status, value, status.suggestedRoot)}</span>+ </div>+ )+}++// Z5 (box-gruen/b, e2e Windows, 18.09.2026): "Reinstall trainer" hat bisher+// install_character_trainer im selben Moment ausgeloest, in dem der Knopf+// geklickt wurde, ohne Bestaetigung, ohne Chance, den Installationsordner+// vorher zu sehen oder zu aendern. Die Rust-Seite loescht `<root>` dabei+// NICHT (siehe Doc-Kommentar von provision_trainer_env: `<root>/train` und+// `<root>/models` werden nie angefasst), ersetzt aber die venv (Rebuild oder+// Torch/musubi neu installieren, siehe `venv_action`), und genau das hat den+// Tester auf box-gruen mitten im Klick ueberrascht. Dieser Dialog sagt das+// ehrlich, zeigt DASSELBE Pfad-Feld wie das Erstsetup (dieselbe Komponente,+// dieselbe Rust-Validierung) und ruft den Install-Befehl erst auf, wenn der+// Kunde "Reinstall" drueckt.+function TrainerReinstallModal({+ open,+ onClose,+ status,+ onConfirm,+}: {+ open: boolean+ onClose: () => void+ status: TrainerStatus+ onConfirm: (path: string) => void+}) {+ const [path, setPath] = useState(status.root)+ // Bei jedem Oeffnen frisch aus dem echten aktuellen Root setzen, damit ein+ // getippter und dann abgebrochener Pfad aus einem frueheren Oeffnen nie in+ // das naechste durchsickert, und das Feld immer mit dem startet, was+ // tatsaechlich gerade installiert ist.+ useEffect(() => {+ if (open) setPath(status.root)+ }, [open, status.root])++ return (+ <Modal open={open} onClose={onClose} title="Reinstall the trainer?">+ <div className="space-y-4 text-sm text-gray-200">+ <p className="t-body leading-relaxed text-gray-300">+ This replaces the trainer's Python environment: PyTorch and musubi-tuner get reinstalled from scratch. Your training photos and downloaded base models are not touched. Setup needs about 3 GB of downloads, same as the first install.+ </p>+ <TrainerPathField value={path} onChange={setPath} status={status} />+ <div className="flex flex-col gap-2 pt-1">+ <button+ onClick={() => onConfirm(path)}+ data-destructive+ className="w-full px-4 py-2 rounded-lg bg-blue-500/20 hover:bg-blue-500/30 border border-blue-500/30 text-blue-200 text-sm font-medium transition-colors"+ >+ Reinstall+ </button>+ <button+ onClick={onClose}+ data-autofocus+ className="w-full px-4 py-1.5 rounded-lg hover:bg-white/5 text-gray-500 hover:text-gray-300 text-xs transition-colors"+ >+ Cancel+ </button>+ </div>+ </div>+ </Modal>+ )+}+// Local training readiness + inputs (2.5.8 A5). Three gates render in order:// trainer env (one-time musubi setup) -> Z-Image base files -> the actual// trigger/steps inputs. The Rust side is the source of truth for readiness.@@ -285,6 +373,8 @@ function LocalTrainControls() {// field was pre-filled and they clear it on purpose), stop overwriting// their edit with the backend's current root on every poll.const [pathTouched, setPathTouched] = useState(false)+ // Z5 (box-gruen/b): der Bestaetigungsdialog vor "Reinstall trainer".+ const [reinstallOpen, setReinstallOpen] = useState(false)const refresh = useCallback(() => {characterTrainerStatus().then(setStatus).catch(() => setStatus(null))@@ -367,6 +457,19 @@ function LocalTrainControls() {setBusy(null)}}+ // Z5 (box-gruen/b): der Reinstall-Dialog sammelt seinen EIGENEN Pfad+ // (vorbelegt aus dem aktuellen Root, siehe `TrainerReinstallModal`), fasst+ // also `installPath` nicht an -- das Feld gehoert dem Erstsetup-Gate oben,+ // das nicht mehr rendert, sobald `envReady` wahr ist.+ const confirmReinstall = async (path: string) => {+ setReinstallOpen(false)+ setBusy('install')+ setNote('Setting up the trainer...')+ try { await installCharacterTrainer(path.trim() || undefined) } catch (e) {+ setNote(e instanceof Error ? e.message : 'Install could not start.')+ setBusy(null)+ }+ }const startBases = async () => {if (!status) returnsetBusy('bases')@@ -402,15 +505,11 @@ function LocalTrainControls() {</Button></div>{busy !== 'install' && (- <div className="flex flex-col items-center gap-0.5">- <input- value={installPath}- onChange={(e) => { setInstallPath(e.target.value); setPathTouched(true) }}- placeholder={`e.g. ${trainerPathPlaceholder(isWindows(), isMacOS())}`}- className="t-control w-64 px-2.5 h-[var(--control-h-sm)] rounded-md bg-white/[0.03] border border-white/[0.06] text-gray-200 placeholder-gray-600 focus:outline-none focus:border-white/15"- />- <span className="t-label text-gray-600">{trainerRootHint(status, installPath, status.suggestedRoot)}</span>- </div>+ <TrainerPathField+ value={installPath}+ onChange={(v) => { setInstallPath(v); setPathTouched(true) }}+ status={status}+ />)}{note && <div role="status" tabIndex={0} className="text-xs leading-relaxed text-gray-600 max-w-[520px] max-h-40 overflow-y-auto select-text whitespace-pre-wrap text-center break-words">{note}</div>}</div>@@ -469,7 +568,7 @@ function LocalTrainControls() {build could not reach it (bob80817, D#102). */}<buttontype="button"- onClick={startInstall}+ onClick={() => setReinstallOpen(true)}disabled={busy === 'install'}className="underline underline-offset-2 text-gray-500 hover:text-gray-300 disabled:opacity-50 transition-colors">@@ -478,6 +577,12 @@ function LocalTrainControls() {</div>)}{note && <div role="status" tabIndex={0} className="text-xs leading-relaxed text-gray-600 max-w-[520px] max-h-40 overflow-y-auto select-text whitespace-pre-wrap text-center break-words">{note}</div>}+ <TrainerReinstallModal+ open={reinstallOpen}+ onClose={() => setReinstallOpen(false)}+ status={status}+ onConfirm={confirmReinstall}+ /></div>)}diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.tsindex 116fa49e..7b1e2521 100644--- a/src/lib/release-notes.ts+++ b/src/lib/release-notes.ts@@ -158,6 +158,7 @@ export const RELEASE_NOTES: ReleaseNote[] = ['Dismissing the stale model notice in the chat header now actually dismisses it, instead of it reappearing on the very next update.','The reason the Coding Agent will not let go of its current folder is now shown as a visible line, instead of only a tooltip a disabled button never shows.','ltx-2 LoRA renders in the desktop app now carry a credit cost, matching the web catalog, instead of pricing as free.',+ 'Reinstall trainer in Character Studio now opens a confirmation dialog first, showing the current trainer folder and the same install-path field as the first setup, instead of starting the reinstall the moment the button is clicked.',],},],