Skip to content

Commit 7ff6901

Browse files
committed
Run inspector: only show an error if the run is in a finished state
1 parent 4b6897e commit 7ff6901

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

apps/webapp/app/presenters/v3/SpanPresenter.server.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,24 @@ export class SpanPresenter extends BasePresenter {
135135
return;
136136
}
137137

138-
const finishedAttempt = await this._replica.taskRunAttempt.findFirst({
139-
select: {
140-
output: true,
141-
outputType: true,
142-
error: true,
143-
},
144-
where: {
145-
status: { in: FINAL_ATTEMPT_STATUSES },
146-
taskRunId: run.id,
147-
},
148-
orderBy: {
149-
createdAt: "desc",
150-
},
151-
});
138+
const isFinished = isFinalRunStatus(run.status);
139+
140+
const finishedAttempt = isFinished
141+
? await this._replica.taskRunAttempt.findFirst({
142+
select: {
143+
output: true,
144+
outputType: true,
145+
error: true,
146+
},
147+
where: {
148+
status: { in: FINAL_ATTEMPT_STATUSES },
149+
taskRunId: run.id,
150+
},
151+
orderBy: {
152+
createdAt: "desc",
153+
},
154+
})
155+
: null;
152156

153157
const output =
154158
finishedAttempt === null
@@ -258,7 +262,7 @@ export class SpanPresenter extends BasePresenter {
258262
costInCents: run.costInCents,
259263
totalCostInCents: run.costInCents + run.baseCostInCents,
260264
usageDurationMs: run.usageDurationMs,
261-
isFinished: isFinalRunStatus(run.status),
265+
isFinished,
262266
isRunning: RUNNING_STATUSES.includes(run.status),
263267
payload,
264268
payloadType: run.payloadType,

0 commit comments

Comments
 (0)