forked from farhoodlabs/paperclip
fix(ui): always render transcript message for non-succeeded runs
Use createHistoricalTranscriptMessage for failed/cancelled/timed_out runs even before transcript data loads. This prevents the flash where a plain "run X failed" status line transforms into a foldable "failed after X minutes" header when transcripts arrive asynchronously. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -679,7 +679,10 @@ export function buildIssueChatMessages(args: {
|
|||||||
for (const run of [...linkedRuns].sort((a, b) => toTimestamp(runTimestamp(a)) - toTimestamp(runTimestamp(b)))) {
|
for (const run of [...linkedRuns].sort((a, b) => toTimestamp(runTimestamp(a)) - toTimestamp(runTimestamp(b)))) {
|
||||||
const transcript = transcriptsByRunId?.get(run.runId) ?? [];
|
const transcript = transcriptsByRunId?.get(run.runId) ?? [];
|
||||||
const hasRunOutput = transcript.length > 0 || (hasOutputForRun?.(run.runId) ?? false);
|
const hasRunOutput = transcript.length > 0 || (hasOutputForRun?.(run.runId) ?? false);
|
||||||
if (hasRunOutput) {
|
if (hasRunOutput || run.status !== "succeeded") {
|
||||||
|
// Always use the transcript message for non-succeeded runs (even before
|
||||||
|
// transcript data loads) so the message type and fold header are stable
|
||||||
|
// from initial render — avoids a flash when transcripts arrive later.
|
||||||
orderedMessages.push({
|
orderedMessages.push({
|
||||||
createdAtMs: toTimestamp(run.startedAt ?? run.createdAt),
|
createdAtMs: toTimestamp(run.startedAt ?? run.createdAt),
|
||||||
order: 2,
|
order: 2,
|
||||||
@@ -692,7 +695,7 @@ export function buildIssueChatMessages(args: {
|
|||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (run.status === "succeeded" && !includeSucceededRunsWithoutOutput) continue;
|
if (!includeSucceededRunsWithoutOutput) continue;
|
||||||
orderedMessages.push({
|
orderedMessages.push({
|
||||||
createdAtMs: toTimestamp(runTimestamp(run)),
|
createdAtMs: toTimestamp(runTimestamp(run)),
|
||||||
order: 2,
|
order: 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user