fix: show activity panels for all turns, not just the last one

The displayItems logic only injected orphan run panels for the most
recent user message's run. Previous turns whose thinking messages
were not produced or were lost during reclassification silently
dropped their activity panels.

Now iterate all unconsumed runs and splice a turn-activity panel
after each trigger user message, ensuring every turn with a run
gets a visible activity panel in the chat transcript.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-04-15 10:29:19 +02:00
co-authored by Copilot
parent 05b3771544
commit 34fb5420a4
+21
View File
@@ -228,9 +228,30 @@ export function ChatPane({
const activeRun = runsByTrigger.get(lastUserMessageId);
if (activeRun && !consumedRunIds.has(activeRun.id)) {
items.push({ type: 'turn-activity', thinkingMessages: [], run: activeRun, turnStartedAt: activeRun.startedAt });
consumedRunIds.add(activeRun.id);
}
}
// Inject activity panels for any remaining unconsumed runs from
// previous turns (e.g. turns where thinking messages were not
// produced or were lost). Place each panel right after the trigger
// user message so it appears in the correct chronological position.
for (const run of session.runs) {
if (consumedRunIds.has(run.id)) continue;
const triggerIndex = items.findIndex(
(it) => it.type === 'message' && it.message.role === 'user' && it.message.id === run.triggerMessageId,
);
if (triggerIndex === -1) continue;
const panel: DisplayItem = {
type: 'turn-activity',
thinkingMessages: [],
run,
turnStartedAt: run.startedAt,
};
items.splice(triggerIndex + 1, 0, panel);
consumedRunIds.add(run.id);
}
// Tag the last turn-activity panel for each run so only it shows
// run-level metadata (git summary, discard button, etc.).
const lastPanelIndexByRunId = new Map<string, number>();