From 2907084ca653fc5540bb04a409d2789ddaeec05b Mon Sep 17 00:00:00 2001 From: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Date: Mon, 16 Mar 2026 13:06:18 +0100 Subject: [PATCH] fix: OutputPicker shows stale result after 'Test up to here' (#8390) OutputPickerInner.updateLastJob() unconditionally returned testJob (from individual step tests) even when flowStateStore had newer results from a flow test. Now testJob only takes priority when a step test is actively running/streaming; otherwise flowStateStore is the source of truth. Also reset stepHistoryLoader initial flags when a flow test completes so the "Run loaded from history" indicator doesn't persist. Co-authored-by: Claude Opus 4.6 (1M context) --- frontend/src/lib/components/FlowPreviewContent.svelte | 7 +++++++ .../components/flows/propPicker/OutputPickerInner.svelte | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/FlowPreviewContent.svelte b/frontend/src/lib/components/FlowPreviewContent.svelte index f702b84397..1b8b126ca4 100644 --- a/frontend/src/lib/components/FlowPreviewContent.svelte +++ b/frontend/src/lib/components/FlowPreviewContent.svelte @@ -652,6 +652,13 @@ onDone={async ({ job: completedJob }) => { isRunning = false $executionCount = $executionCount + 1 + // Reset 'initial' flags for modules that were part of this flow test, + // so OutputPicker no longer shows "Run loaded from history" + for (const mod of completedJob.flow_status?.modules ?? []) { + if (mod.id) { + stepHistoryLoader?.resetInitial(mod.id) + } + } if (flowRecording.active) { lastRecording = flowRecording.stop() setActiveRecording(undefined) diff --git a/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte b/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte index c1662a8f80..6bc4686644 100644 --- a/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte +++ b/frontend/src/lib/components/flows/propPicker/OutputPickerInner.svelte @@ -204,7 +204,8 @@ } function updateLastJob() { - if (testJob) { + // Prefer testJob only when actively running/streaming (individual step test in progress) + if (testJob && (testJob.result_stream || testJob.type === 'QueuedJob')) { return testJob } if ( @@ -214,6 +215,8 @@ ) { return } + // Use flowStateStore as source of truth — it's updated by both individual step tests + // (ModuleTest.jobDone) and flow tests (FlowStatusViewerInner.onJobsLoadedInner) return { id: flowStateStore.val[moduleId]?.previewJobId ?? '', result: flowStateStore.val[moduleId]?.previewResult,