From 2fd21df1dcc57b5f2f88a2842a1c4c50d72dcbbc Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 3 Jul 2026 11:57:44 +0000 Subject: [PATCH] Dismiss any terminal run back to settings (stopped and error runs were trapped in the run view) --- .../images/train/diffusion-train-panel.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx index 07ddd01c1c..0a9f44b839 100644 --- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx +++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx @@ -415,12 +415,15 @@ export function DiffusionTrainPanel({ // than resetting in an effect) means a fresh run never inherits a stale "Stopping..." state. const stopRequested = running && stopRequestedLocal; - // Whether there is a run to show live (running or a not-yet-dismissed completed run). - // When false, the progress card + charts still render but grayed, as a preview. + // Whether there is a run to show live: running, or ANY terminal run (completed / + // stopped / error) the user has not dismissed yet. Dismissing must cover every + // terminal status, or "Train another" after a stop (and any error) would trap the + // run view with no way back to the settings. + const terminalStatuses = ["completed", "stopped", "error"]; const hasRun = Boolean( status && status.status !== "idle" && - !(status.status === "completed" && status.job_id === dismissedJobId), + !(terminalStatuses.includes(status.status) && status.job_id === dismissedJobId), ); // Notify the parent exactly once per run that produced an adapter (full completion or @@ -1226,6 +1229,22 @@ export function DiffusionTrainPanel({ {stopRequested ? "Stopping..." : "Stop training"} )} + {/* Terminal runs WITHOUT an adapter card (error, or a stop that discarded + the run) still need a way back to the settings. */} + {!running && + status && + terminalStatuses.includes(status.status) && + !completed && + !stoppedWithAdapter && ( + + )} {(completed || stoppedWithAdapter) && (