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(install): pip-Stufe statt leerem stderr, Ergebniszeile in ihrer eigenen Farbe und wegklickbar
purple1cfb737f9a55
diff --git a/src-tauri/src/commands/engine.rs b/src-tauri/src/commands/engine.rsindex 3ea57169..2405e156 100644--- a/src-tauri/src/commands/engine.rs+++ b/src-tauri/src/commands/engine.rs@@ -1476,8 +1476,13 @@ pub async fn stop_bundled_engine(app: AppHandle) -> Result<serde_json::Value, Stpub async fn bundled_engine_status(app: AppHandle) -> Result<serde_json::Value, String> {tauri::async_runtime::spawn_blocking(move || {let state = app.state::<AppState>();- // A handle whose process died is not a running engine (A15).- let probe = live_sidecar(&mut state.bundled_engine.lock().unwrap());+ // Probed inside its own block so the lock is provably gone before the+ // match below, whose arms make a blocking /health call.+ let probe = {+ let mut guard = state.bundled_engine.lock().unwrap();+ // A handle whose process died is not a running engine (A15).+ live_sidecar(&mut guard)+ };match probe {Some((port, model_path, ctx)) => serde_json::json!({"running": true,@@ -1929,10 +1934,8 @@ pub(crate) fn reap_dead_engine(slot: &mut Option<BundledEngine>) -> bool {if gone {if let Some(mut e) = slot.take() {let _ = e.child.wait();- println!(- "[Engine] the built-in engine on port {} is gone, clearing the handle",- e.port- );+ // Said for both sidecars, so the wording names neither.+ println!("[Engine] the sidecar on port {} is gone, clearing the handle", e.port);}}gone@@ -2117,9 +2120,15 @@ pub async fn bundled_embed_status(app: AppHandle) -> Result<serde_json::Value, Stauri::async_runtime::spawn_blocking(move || {let state = app.state::<AppState>();// Probe OUTSIDE the lock: holding it across a blocking HTTP call made- // every other engine command queue behind the status poll.- // Same as the chat engine: a killed sidecar is not a running one.- let probe = live_sidecar(&mut state.bundled_embed.lock().unwrap());+ // every other engine command queue behind the status poll. The guard is+ // dropped at the end of THIS block, which is the whole point of the+ // block; a `match` on the lock expression itself would hold it for the+ // length of every arm, and one of those arms probes /health.+ let probe = {+ let mut guard = state.bundled_embed.lock().unwrap();+ // Same as the chat engine: a killed sidecar is not a running one.+ live_sidecar(&mut guard)+ };match probe {Some((port, model_path, _ctx)) => serde_json::json!({"running": true,diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rsindex 2dc5672e..7a9f3f73 100644--- a/src-tauri/src/commands/install.rs+++ b/src-tauri/src/commands/install.rs@@ -611,15 +611,16 @@ pub(crate) fn requirements_failure_reason(pip_output: &str) -> &'static str {/// The same question asked of a whole pip failure rather than of its text.///-/// A15 review: an empty `stderr` means pip never wrote any, so the process-/// could not be started or could not be reaped. Classifying the diagnosis in-/// that case comes out as "pip exited with an error", which is precisely what-/// did not happen.+/// The stage decides, not the emptiness of the log. A pip that never started+/// says so; a pip that ran is judged on what it printed, and a run that printed+/// nothing at all still exited with an error rather than failing to start.pub(crate) fn requirements_failure_reason_for(f: &PipFailure) -> &'static str {- if f.stderr.is_empty() {- return "pip could not be started";+ match f.stage {+ PipStage::NotStarted => "pip could not be started",+ // It ran. Whatever it left behind is what decides, and a run that left+ // nothing behind still exited with an error.+ PipStage::Ran => requirements_failure_reason(&f.stderr),}- requirements_failure_reason(&f.stderr)}/// The live log line that names the fallback while it happens.@@ -641,12 +642,13 @@ pub(crate) fn requirements_fallback_log(folder: &str, reason: &str) -> String {pub(crate) fn finished_notice(done: &str,fallback: Option<&(String, &'static str)>,-) -> String {+) -> (String, &'static str) {match fallback {- Some((folder, reason)) => {- format!("{} {}", done, requirements_fallback_notice(folder, reason))- }- None => done.to_string(),+ Some((folder, reason)) => (+ format!("{} {}", done, requirements_fallback_notice(folder, reason)),+ "warn",+ ),+ None => (done.to_string(), "ok"),}}@@ -1477,12 +1479,30 @@ fn verify_and_heal_environment(pub(crate) struct PipFailure {pub(crate) diagnosis: String,pub(crate) stderr: String,+ /// How far the run got. A15 review: this used to be inferred from an empty+ /// `stderr`, which is true for a spawn that failed and equally true for a+ /// pip that ran, printed nothing and exited non-zero, and for a `try_wait`+ /// that failed on a live process. Two of those three were then reported as+ /// "pip could not be started", which is a lie the log cannot correct.+ pub(crate) stage: PipStage,+}++/// How far a failed pip run got before it failed.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub(crate) enum PipStage {+ /// No process. The spawn failed, or the cancel arrived before pip was ever+ /// asked to start.+ NotStarted,+ /// pip was a live process. It may have exited non-zero, printed nothing, or+ /// refused to be reaped, but it ran.+ Ran,}impl PipFailure {- /// A failure with no pip log behind it: cancelled, or pip never started.- fn bare(diagnosis: &str) -> Self {- PipFailure { diagnosis: diagnosis.to_string(), stderr: String::new() }+ /// A failure with no pip log behind it. The stage says whether that is+ /// because pip never started or because it left nothing behind.+ fn bare(stage: PipStage, diagnosis: &str) -> Self {+ PipFailure { diagnosis: diagnosis.to_string(), stderr: String::new(), stage }}}@@ -1510,7 +1530,7 @@ pub(crate) fn pip_install_streaming_with_retry_raw(for attempt in 1..=max_attempts {if cancel.as_ref().map(|c| c.load(Ordering::SeqCst)).unwrap_or(false) {- return Err(PipFailure::bare("cancelled"));+ return Err(PipFailure::bare(PipStage::NotStarted, "cancelled"));}if attempt > 1 {push_install_log(@@ -1523,7 +1543,7 @@ pub(crate) fn pip_install_streaming_with_retry_raw(// Sleep in 1-second chunks so cancel reacts within ~1s.for _ in 0..delay_seconds {if cancel.as_ref().map(|c| c.load(Ordering::SeqCst)).unwrap_or(false) {- return Err(PipFailure::bare("cancelled"));+ return Err(PipFailure::bare(PipStage::NotStarted, "cancelled"));}std::thread::sleep(std::time::Duration::from_secs(1));}@@ -1548,10 +1568,15 @@ pub(crate) fn pip_install_streaming_with_retry_raw(let mut child = match cmd.spawn() {Ok(c) => c,- Err(e) => return Err(PipFailure::bare(&format!(- "Could not start pip ({}). Is Python on PATH?",- os_error::english(&e)- ))),+ Err(e) => {+ return Err(PipFailure::bare(+ PipStage::NotStarted,+ &format!(+ "Could not start pip ({}). Is Python on PATH?",+ os_error::english(&e)+ ),+ ))+ }};let stdout = child.stdout.take();@@ -1614,7 +1639,7 @@ pub(crate) fn pip_install_streaming_with_retry_raw(let _ = child.wait();let _ = stdout_handle.join();let _ = stderr_handle.join();- return Err(PipFailure::bare("cancelled"));+ return Err(PipFailure::bare(PipStage::Ran, "cancelled"));}match child.try_wait() {Ok(Some(s)) => break s,@@ -1641,10 +1666,10 @@ pub(crate) fn pip_install_streaming_with_retry_raw(std::thread::sleep(std::time::Duration::from_millis(200));}Err(e) => {- return Err(PipFailure::bare(&format!(- "pip wait failed: {}",- os_error::english(&e)- )))+ return Err(PipFailure::bare(+ PipStage::Ran,+ &format!("pip wait failed: {}", os_error::english(&e)),+ ))}}};@@ -1673,6 +1698,7 @@ pub(crate) fn pip_install_streaming_with_retry_raw(return Err(PipFailure {diagnosis: diagnose_pip_error_for(&last_stderr, Some(python_bin)),stderr: last_stderr,+ stage: PipStage::Ran,});}}@@ -1684,6 +1710,7 @@ pub(crate) fn pip_install_streaming_with_retry_raw(diagnose_pip_error_for(&last_stderr, Some(python_bin))),stderr: last_stderr,+ stage: PipStage::Ran,})}@@ -1842,6 +1869,7 @@ pub fn install_comfyui(install.status = "installing".to_string();install.logs.clear();install.notice.clear();+ install.notice_kind.clear();install.logs.push("Starting ComfyUI installation...".to_string());drop(install);@@ -2250,10 +2278,12 @@ pub fn install_comfyui(}if let Ok(mut s) = install_status.lock() {- s.notice = finished_notice(+ let (line, kind) = finished_notice("Install finished. ComfyUI is ready to start.",requirements_fallback.as_ref(),);+ s.notice = line;+ s.notice_kind = kind.to_string();}update("complete", "ComfyUI installed successfully!");});@@ -2320,6 +2350,7 @@ pub fn repair_comfyui_env(state: State<'_, AppState>) -> Result<serde_json::Valuinstall.status = "installing".to_string();install.logs.clear();install.notice.clear();+ install.notice_kind.clear();install.logs.push("Repairing the ComfyUI environment...".to_string());}info!("comfyui env repair start");@@ -2464,10 +2495,12 @@ pub fn repair_comfyui_env(state: State<'_, AppState>) -> Result<serde_json::Valu}if let Ok(mut s) = install_status.lock() {- s.notice = finished_notice(+ let (line, kind) = finished_notice("Repair finished. ComfyUI is ready.",requirements_fallback.as_ref(),);+ s.notice = line;+ s.notice_kind = kind.to_string();}update("complete",@@ -2488,6 +2521,7 @@ pub fn install_comfyui_status(state: State<'_, AppState>) -> Result<serde_json::// to skip the ComfyUI requirements.txt puts its one closing line here,// because the log itself is dropped the moment the panel goes idle."notice": install.notice,+ "notice_kind": install.notice_kind,"download_progress": install.download_progress,"download_total": install.download_total,"download_speed": install.download_speed,@@ -2511,6 +2545,7 @@ pub fn update_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, Sinstall.status = "installing".to_string();install.logs.clear();install.notice.clear();+ install.notice_kind.clear();install.logs.push("Updating ComfyUI...".to_string());}@@ -2687,10 +2722,12 @@ pub fn update_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, Sprintln!("[Update] ComfyUI update complete");if let Ok(mut s) = install_status.lock() {- s.notice = finished_notice(+ let (line, kind) = finished_notice("Update finished. Restart ComfyUI to load the new nodes.",requirements_fallback.as_ref(),);+ s.notice = line;+ s.notice_kind = kind.to_string();}update("complete",@@ -5044,11 +5081,14 @@ mod tests {fn a_fresh_install_state_carries_no_closing_line() {let fresh = crate::state::InstallState::default();assert!(fresh.notice.is_empty());+ assert!(fresh.notice_kind.is_empty());let json = serde_json::to_value(&fresh).expect("serialises");assert_eq!(json["notice"], serde_json::json!(""));+ assert_eq!(json["notice_kind"], serde_json::json!(""));}- /// David, 03.09.: a run that worked says so, every time.+ /// David, 03.09.: a run that worked says so, every time. And it does not+ /// say it in the colour of a warning (A15 review).#[test]fn a_run_that_worked_leaves_a_closing_line_of_its_own() {for done in [@@ -5056,37 +5096,45 @@ mod tests {"Repair finished. ComfyUI is ready.","Update finished. Restart ComfyUI to load the new nodes.",] {- assert_eq!(finished_notice(done, None), done);+ let (line, kind) = finished_notice(done, None);+ assert_eq!(line, done);+ assert_eq!(kind, "ok");}}/// And a run that had to skip the requirements.txt says both halves, in- /// that order: it finished, and here is what it could not use.+ /// that order: it finished, and here is what it could not use. That one is+ /// a warning.#[test]fn a_finished_run_that_skipped_the_file_says_both_halves() {let fallback = ("C:\\Users\\ddrob\\ComfyUI".to_string(),requirements_failure_reason(INVENTED_PACKAGE),);- let line = finished_notice("Repair finished. ComfyUI is ready.", Some(&fallback));+ let (line, kind) = finished_notice("Repair finished. ComfyUI is ready.", Some(&fallback));assert!(line.starts_with("Repair finished. ComfyUI is ready. "), "got: {line}");assert!(line.contains("could not be used"), "got: {line}");assert!(line.contains("C:\\Users\\ddrob\\ComfyUI"), "got: {line}");// Negative control on the substitution: the success half is not// replaced by the warning, which is what a run that finished deserves.assert!(line.contains("Repair finished"), "got: {line}");+ assert_eq!(kind, "warn");}/// A pip that never started is not a pip that exited with an error.#[test]fn a_pip_that_never_ran_is_not_reported_as_a_pip_that_failed() {- let never_ran = PipFailure::bare("Could not start pip (not found). Is Python on PATH?");+ let never_ran = PipFailure::bare(+ PipStage::NotStarted,+ "Could not start pip (not found). Is Python on PATH?",+ );assert_eq!(requirements_failure_reason_for(&never_ran), "pip could not be started");// Negative control: a real pip failure keeps its own classification and// does not fall into the "could not be started" arm.let really_failed = PipFailure {diagnosis: "whatever the hint says".to_string(),stderr: INVENTED_PACKAGE.to_string(),+ stage: PipStage::Ran,};assert_eq!(requirements_failure_reason_for(&really_failed),@@ -5094,6 +5142,22 @@ mod tests {);}+ /// The two cases the empty-stderr shortcut used to get wrong. Both are a+ /// pip that RAN, so neither may claim it could not be started.+ #[test]+ fn a_pip_that_ran_is_never_reported_as_one_that_could_not_start() {+ // The reaping failed on a live child. pip was there.+ let wait_failed = PipFailure::bare(PipStage::Ran, "pip wait failed: interrupted");+ assert_eq!(requirements_failure_reason_for(&wait_failed), "pip exited with an error");+ // And a silent non-zero exit: it ran, it failed, it printed nothing.+ let silent = PipFailure {+ diagnosis: String::new(),+ stderr: String::new(),+ stage: PipStage::Ran,+ };+ assert_eq!(requirements_failure_reason_for(&silent), "pip exited with an error");+ }+// ── PyTorch-Kanalwahl (W2-Befund 16.08., comfy_kitchen braucht 2.6+) ─#[test]diff --git a/src-tauri/src/os_error.rs b/src-tauri/src/os_error.rsindex e4f72f9d..a7b41798 100644--- a/src-tauri/src/os_error.rs+++ b/src-tauri/src/os_error.rs@@ -457,10 +457,12 @@ mod drift_guard {// git clone both polled their child and rendered the poll's own error// straight into the progress card.".try_wait()", ".wait()",- // Asking the platform where our own folders are. Tauri answers this- // one with its own error, but that error wraps an io::Error on the- // paths that touch the disk, and the Piper voices lookup rendered it- // raw (A15 review).+ // Asking the platform where our own folders are. In tauri 2.10 this+ // fails with `Error::UnknownPath`, which carries no io::Error and is+ // English already, so today the guard changes nothing here. It is in+ // the list because the call is a platform lookup: the day a tauri+ // release words it from the OS, or wraps one, the Piper voices lookup+ // would have carried it raw again (A15 review).".app_data_dir()",];diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rsindex 8cb9ce6c..7247ed57 100644--- a/src-tauri/src/state.rs+++ b/src-tauri/src/state.rs@@ -69,6 +69,13 @@ pub struct InstallState {/// is how the backend fills it.#[serde(default)]pub notice: String,+ /// How that line should read: "ok" for a run that simply worked, "warn" for+ /// one that finished with something the user has to know. A15 review: the+ /// panel painted every closing line amber, so "Repair finished. ComfyUI is+ /// ready." arrived in the colour of a warning. The backend knows which it+ /// is and the panel does not, so it says.+ #[serde(default)]+ pub notice_kind: String,pub download_progress: u64,pub download_total: u64,pub download_speed: f64,@@ -81,6 +88,7 @@ impl Default for InstallState {phase: String::new(),logs: Vec::new(),notice: String::new(),+ notice_kind: String::new(),download_progress: 0,download_total: 0,download_speed: 0.0,diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex e4f35c08..7152ee84 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -543,6 +543,10 @@ export function ComfyUISettings() {const installDl = useComfyInstallStore((s) => s.dl)const cancelling = useComfyInstallStore((s) => s.cancelling)const installNotice = useComfyInstallStore((s) => s.notice)+ // A15 review: every closing line used to be amber, so a repair that simply+ // worked reported itself in the colour of a warning.+ const installNoticeKind = useComfyInstallStore((s) => s.noticeKind)+ const clearInstallNotice = useComfyInstallStore((s) => s.clearNotice)// A failed run must not be a dead end. The phase stays `error` until// something clears it, and with the state outliving the mount the old escape// hatch (leave the section, lose the useState) is gone. So the start buttons@@ -825,7 +829,30 @@ export function ComfyUISettings() {</p>)}{installNotice && installPhase === 'idle' && (- <p className="w-full text-[0.55rem] text-amber-500 dark:text-amber-400 leading-relaxed">{installNotice}</p>+ <div className="w-full flex items-start gap-1.5">+ <p+ data-testid="comfy-install-notice"+ data-kind={installNoticeKind}+ className={`flex-1 text-[0.55rem] leading-relaxed ${+ installNoticeKind === 'warn'+ ? 'text-amber-500 dark:text-amber-400'+ : 'text-emerald-600 dark:text-emerald-400'+ }`}+ >+ {installNotice}+ </p>+ {/* Review 03.09.: nothing ever put this line away, so one finished+ run kept unfolding the section on every visit for the rest of+ the session. */}+ <button+ onClick={clearInstallNotice}+ aria-label="Dismiss this message"+ title="Dismiss"+ className="shrink-0 p-0.5 rounded text-gray-500 hover:text-gray-300 hover:bg-white/5 transition-colors"+ >+ <X size={10} />+ </button>+ </div>)}{installPhase !== 'idle' && (<div className="w-full mt-2 space-y-1">diff --git a/src/components/settings/__tests__/comfy-notice-reads-as-what-it-is.test.ts b/src/components/settings/__tests__/comfy-notice-reads-as-what-it-is.test.tsnew file mode 100644index 00000000..a708b850--- /dev/null+++ b/src/components/settings/__tests__/comfy-notice-reads-as-what-it-is.test.ts@@ -0,0 +1,93 @@+/**+ * @vitest-environment jsdom+ *+ * A15 review, 03.09., two findings on the closing line a finished run leaves.+ *+ * 1. It was painted amber whatever it said, so "Repair finished. ComfyUI is+ * ready." arrived in the colour of a warning after an eight minute rebuild.+ * 2. Nothing ever put it away. The section unfolds itself while a line is+ * standing, so one finished run kept the section open on every visit for the+ * rest of the session.+ *+ * Run: npx vitest run src/components/settings/__tests__/comfy-notice-reads-as-what-it-is.test.ts+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, fireEvent, cleanup, act } from '@testing-library/react'++const backendCall = vi.fn()+vi.mock('../../../api/backend', () => ({+ backendCall: (...args: unknown[]) => backendCall(...args),+ isTauri: () => true,+ isMacOS: () => false,+ openExternal: vi.fn(),+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),+ secretSet: vi.fn(),+ secretDelete: vi.fn(),+ setComfyPort: vi.fn(),+ setComfyHost: vi.fn(),+}))++const { ComfyUISettings } = await import('../SettingsPage')+const { useComfyInstallStore, comfySectionShouldOpen } = await import('../../../stores/comfyInstallStore')++beforeEach(() => {+ useComfyInstallStore.getState().reset()+ backendCall.mockReset()+ backendCall.mockImplementation(async (cmd: string) => {+ if (cmd === 'comfyui_status') {+ return { running: false, found: true, complete: true, path: 'C:\\ComfyUI', isLocal: true }+ }+ if (cmd === 'install_comfyui_status') return { status: 'idle', logs: [] }+ return {}+ })+})+afterEach(() => { cleanup(); useComfyInstallStore.getState().reset() })++async function panelShowing(notice: string, noticeKind: 'ok' | 'warn') {+ useComfyInstallStore.setState({ phase: 'idle', notice, noticeKind })+ render(createElement(ComfyUISettings))+ await act(async () => { await Promise.resolve(); await Promise.resolve() })+ return screen.getByTestId('comfy-install-notice')+}++describe('the closing line reads as what it is', () => {+ it('a run that worked is not painted as a warning', async () => {+ const line = await panelShowing('Repair finished. ComfyUI is ready.', 'ok')+ expect(line.textContent).toBe('Repair finished. ComfyUI is ready.')+ expect(line.getAttribute('data-kind')).toBe('ok')+ expect(line.className).not.toContain('amber')+ })++ it('a run with something to report still is', async () => {+ // Negative control for the test above: the colour is not a constant, it+ // follows the kind the backend sent.+ const line = await panelShowing(+ 'Repair finished. ComfyUI is ready. The requirements.txt in C:\\ComfyUI could not be used.',+ 'warn',+ )+ expect(line.getAttribute('data-kind')).toBe('warn')+ expect(line.className).toContain('amber')+ })+})++describe('the closing line can be dismissed', () => {+ it('the x clears it, and the section stops unfolding itself', async () => {+ await panelShowing('Repair finished. ComfyUI is ready.', 'ok')+ expect(comfySectionShouldOpen(useComfyInstallStore.getState())).toBe(true)++ await act(async () => { fireEvent.click(screen.getByLabelText('Dismiss this message')) })++ expect(screen.queryByTestId('comfy-install-notice')).toBeNull()+ expect(useComfyInstallStore.getState().notice).toBe('')+ expect(comfySectionShouldOpen(useComfyInstallStore.getState())).toBe(false)+ })++ it('shows no dismiss control when there is nothing to dismiss', async () => {+ // Negative control: an idle panel with no line carries no stray button.+ render(createElement(ComfyUISettings))+ await act(async () => { await Promise.resolve(); await Promise.resolve() })+ expect(screen.queryByTestId('comfy-install-notice')).toBeNull()+ expect(screen.queryByLabelText('Dismiss this message')).toBeNull()+ })+})diff --git a/src/stores/__tests__/comfy-install-notice.test.ts b/src/stores/__tests__/comfy-install-notice.test.tsindex 4d8021dc..beef9d60 100644--- a/src/stores/__tests__/comfy-install-notice.test.ts+++ b/src/stores/__tests__/comfy-install-notice.test.ts@@ -117,15 +117,65 @@ describe('the ComfyUI section opens itself while a run is on screen', () => {})describe('a run that simply worked still says so', () => {- it('keeps the closing line of a clean repair', async () => {+ it('keeps the closing line of a clean repair, and does not dress it as a warning', async () => {await repairThatEndsWith({status: 'complete',logs: ['All packages import cleanly.'],notice: 'Repair finished. ComfyUI is ready.',+ notice_kind: 'ok',})expect(store().phase).toBe('idle')expect(store().notice).toBe('Repair finished. ComfyUI is ready.')+ expect(store().noticeKind).toBe('ok')const { comfySectionShouldOpen } = await import('../comfyInstallStore')expect(comfySectionShouldOpen(store())).toBe(true)})++ it('marks the line as a warning when the run had to skip the file', async () => {+ // Negative control for the test above: the colour is not a constant.+ await repairThatEndsWith({ status: 'complete', logs: ['x'], notice: SKIPPED, notice_kind: 'warn' })+ expect(store().noticeKind).toBe('warn')+ })++ it('treats a cancelled run as a warning, whoever asked for it', async () => {+ // A half rebuilt venv is not good news, and the backend sends no kind for+ // a cancel: the store decides that one.+ await repairThatEndsWith({ status: 'cancelled', logs: ['stopped'] })+ expect(store().phase).toBe('idle')+ expect(store().noticeKind).toBe('warn')+ expect(store().notice).toContain('Repair cancelled')+ })++ it('falls back to ok for a backend that names no kind', async () => {+ await repairThatEndsWith({ status: 'complete', logs: ['x'], notice: 'Repair finished.' })+ expect(store().noticeKind).toBe('ok')+ })+})++describe('the closing line can be put away', () => {+ it('clears the line and lets the section fold up again', async () => {+ const { comfySectionShouldOpen } = await import('../comfyInstallStore')+ await repairThatEndsWith({+ status: 'complete',+ logs: ['x'],+ notice: 'Repair finished. ComfyUI is ready.',+ notice_kind: 'ok',+ })+ expect(comfySectionShouldOpen(store())).toBe(true)++ store().clearNotice()+ expect(store().notice).toBe('')+ expect(store().noticeKind).toBe('ok')+ // The point of the dismiss: without it one finished run kept the section+ // unfolding itself on every visit for the rest of the session.+ expect(comfySectionShouldOpen(store())).toBe(false)+ })++ it('leaves everything else alone', async () => {+ // Negative control: dismissing a message is not a reset.+ await repairThatEndsWith({ status: 'complete', logs: ['a', 'b'], notice: SKIPPED, notice_kind: 'warn' })+ store().clearNotice()+ expect(store().logs).toEqual(['a', 'b'])+ expect(store().phase).toBe('idle')+ })})diff --git a/src/stores/comfyInstallStore.ts b/src/stores/comfyInstallStore.tsindex 4272be58..1680d88f 100644--- a/src/stores/comfyInstallStore.ts+++ b/src/stores/comfyInstallStore.ts@@ -24,6 +24,11 @@ export type ComfyInstallPhase = 'idle' | 'checking' | 'python' | 'comfyui' | 're* and they need different sentences when they end. */export type ComfyInstallKind = 'install' | 'update' | 'repair'+/** How a closing line reads. 'warn' is amber, 'ok' is not. A15 review: the+ * panel painted every closing line amber, so "Repair finished. ComfyUI is+ * ready." arrived in the colour of a warning. */+export type ComfyNoticeKind = 'ok' | 'warn'+/** What the user is told once a cancelled run has really stopped. A cancel* that leaves the panel blank reads as "nothing happened", and after a repair* that is a lie: the venv is half rebuilt at that point. */@@ -111,6 +116,9 @@ interface InstallStatusPayload {* and the run finishes on LU's own package list, which used to end in a* green idle panel that said nothing about the file it passed over. */notice?: string+ /** How that line reads: 'ok' for a run that simply worked, 'warn' for one+ * that finished with something the user has to know. */+ notice_kind?: stringdownload_progress?: numberdownload_total?: numberdownload_speed?: number@@ -124,8 +132,14 @@ interface ComfyInstallState {error: string/** Cancel requested, run not stopped yet. */cancelling: boolean- /** The one line left behind after a cancelled run. */+ /** The one line a finished or cancelled run leaves behind. */notice: string+ /** Whether that line is good news or not, which decides its colour. */+ noticeKind: ComfyNoticeKind+ /** Put the closing line away. Review 03.09.: nothing ever cleared it, so a+ * single finished run kept the section unfolding itself on every visit for+ * the rest of the session. */+ clearNotice: () => void/** Install ComfyUI, installing Python first when the box has none. */runInstall: (installPath: string) => Promise<void>/** git pull plus a dependency refresh on an existing checkout. */@@ -146,6 +160,7 @@ const IDLE = {error: '',cancelling: false,notice: '',+ noticeKind: 'ok' as ComfyNoticeKind,}export const useComfyInstallStore = create<ComfyInstallState>()((set, get) => {@@ -184,11 +199,24 @@ export const useComfyInstallStore = create<ComfyInstallState>()((set, get) => {})if (data.status === 'complete') {stopTimer()- set({ phase: 'idle', kind: null, cancelling: false, notice: String(data.notice ?? '') })+ set({+ phase: 'idle',+ kind: null,+ cancelling: false,+ notice: String(data.notice ?? ''),+ noticeKind: data.notice_kind === 'warn' ? 'warn' : 'ok',+ })} else if (data.status === 'cancelled') {// A cancel the user asked for is not a failure.stopTimer()- set({ phase: 'idle', kind: null, cancelling: false, notice: COMFY_CANCEL_NOTICE[kind] })+ set({+ phase: 'idle',+ kind: null,+ cancelling: false,+ notice: COMFY_CANCEL_NOTICE[kind],+ // A half rebuilt venv is not good news, whoever asked for it.+ noticeKind: 'warn',+ })} else if (data.status === 'error') {stopTimer()const lastLog = data.logs?.length ? String(data.logs[data.logs.length - 1]) : ''@@ -327,6 +355,8 @@ export const useComfyInstallStore = create<ComfyInstallState>()((set, get) => {}},+ clearNotice: () => set({ notice: '', noticeKind: 'ok' }),+reset: () => {stopTimer()set({ ...IDLE })