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) <noreply@anthropic.com>

* refactor: simplify run card collapse condition and comment

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem
2026-09-30 10:33:20 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 9028432e8a
commit ab2a973357
@@ -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