diff --git a/frontend/src/lib/components/copilot/chat/RunScriptCard.svelte b/frontend/src/lib/components/copilot/chat/RunScriptCard.svelte index 4aff51d002..ca5e717891 100644 --- a/frontend/src/lib/components/copilot/chat/RunScriptCard.svelte +++ b/frontend/src/lib/components/copilot/chat/RunScriptCard.svelte @@ -208,9 +208,12 @@ // Keyed by call id: a bare flag would carry one card's collapse onto the next message // reusing this instance. Open by default, since the run is what was asked for — // except for an inspection, which is usually a step in the reasoning rather than - // the answer, and which pays a fetch for being opened. + // the answer, and which pays a fetch for being opened. A run cancelled before it started + // is closed too: the row already says Cancelled, and there is no run to show. let toggled = $state<{ id: string; open: boolean } | undefined>(undefined) - const expanded = $derived(toggled?.id === message.tool_call_id ? toggled.open : !inspected) + const expanded = $derived( + toggled?.id === message.tool_call_id ? toggled.open : !inspected && (ran || !canceled) + ) $effect(() => { const target = inspected