From ab2a973357524c2c3aa81cc4aeb716d8cfd108d1 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 30 Sep 2026 10:33:20 +0200 Subject: [PATCH] fix: collapse run card in ai chat when the run is declined (#11435) * fix: collapse run card in ai chat when the run is declined Co-Authored-By: Claude Opus 5.5 (1M context) * refactor: simplify run card collapse condition and comment Co-Authored-By: Claude Opus 5.5 (1M context) --------- Co-authored-by: Claude Opus 5.5 (1M context) --- .../src/lib/components/copilot/chat/RunScriptCard.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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