Skip to content

Commit c2eadb3

Browse files
d-csclaude
andcommitted
fix(webapp): treat FAILED buffered runs as terminal in the run-header synth
`buildSyntheticRunHeader` only checked for `CANCELED` when mapping `SyntheticRun.status` to the run-header's `status` / `isFinished` fields. `SyntheticRun.status` can also be `"FAILED"` (set by `readFallback.server.ts` when the buffer entry's status is FAILED — e.g. after the drainer's terminal-failure path), so a FAILED buffered run showed in the page header as `PENDING` + `isFinished: false`, which left the Cancel button visible for an already-failed run. Add a parallel `isFailed` branch (mapping to `SYSTEM_FAILURE`, matching `buildSyntheticSpanRun`'s same-shape decision for the right-side panel) and OR it into `isFinished`. Symmetric across the header + span panel so admins no longer see "Pending" + "FAILED" simultaneously on the same run. Devin follow-up on PR #3757. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b1e358f commit c2eadb3

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

apps/webapp/app/v3/mollifier/syntheticRunHeader.server.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ import type { SyntheticRun } from "./readFallback.server";
55
// shape matches `RunPresenter.getRun`'s `runData` — keep this in sync
66
// when fields are added there.
77
//
8-
// CANCELED state is reflected back from `SyntheticRun.cancelledAt` /
9-
// `status` so that after a buffered-cancel the NavBar shows the run as
10-
// CANCELED + isFinished:true (which collapses the Cancel button) before
11-
// the drainer materialises the PG row. This mirrors what
12-
// `buildSyntheticSpanRun` does for the right-side details panel — the
13-
// SyntheticRun.cancelledAt contract comment in readFallback.server.ts
14-
// names this exact UI surface.
8+
// CANCELED and FAILED state is reflected back from
9+
// `SyntheticRun.cancelledAt` / `status` so terminal buffered runs show
10+
// the correct status in the NavBar + isFinished:true (which collapses
11+
// the Cancel button on the page header) before the drainer materialises
12+
// the PG row. This mirrors what `buildSyntheticSpanRun` does for the
13+
// right-side details panel — the SyntheticRun.cancelledAt contract
14+
// comment in readFallback.server.ts names this exact UI surface.
15+
//
16+
// FAILED status maps to `SYSTEM_FAILURE` to match the drainer's
17+
// non-retryable terminal path, which is what `buildSyntheticSpanRun`
18+
// uses too. Symmetric across the header + span-detail panel so an
19+
// admin doesn't see "Pending" + "FAILED" simultaneously on the same
20+
// run.
1521
export function buildSyntheticRunHeader(args: {
1622
run: SyntheticRun;
1723
environment: {
@@ -23,15 +29,20 @@ export function buildSyntheticRunHeader(args: {
2329
}) {
2430
const { run, environment } = args;
2531
const isCancelled = run.status === "CANCELED";
32+
const isFailed = run.status === "FAILED";
2633

2734
return {
2835
id: run.friendlyId,
2936
number: 1,
3037
friendlyId: run.friendlyId,
3138
traceId: run.traceId ?? "",
3239
spanId: run.spanId ?? "",
33-
status: isCancelled ? ("CANCELED" as const) : ("PENDING" as const),
34-
isFinished: isCancelled,
40+
status: isCancelled
41+
? ("CANCELED" as const)
42+
: isFailed
43+
? ("SYSTEM_FAILURE" as const)
44+
: ("PENDING" as const),
45+
isFinished: isCancelled || isFailed,
3546
startedAt: null,
3647
completedAt: run.cancelledAt ?? null,
3748
logsDeletedAt: null,

0 commit comments

Comments
 (0)