fix(ui): show step retries as archie's record, not the agent's report

This commit is contained in:
sam committed 2026-10-05 21:00:25 +11:00
1 parent 8de61e718e
commit cdf4e3423c
3 files changed
+100 -74

No files matched your search

+11 -1
View File
@@ -4,7 +4,7 @@ import { computed } from "vue";
import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils";
import { agentReports, stageStatusMeta } from "./stage-rail";
import { agentReports, stageRetries, stageStatusMeta } from "./stage-rail";
import { duration } from "./timeline-event";
import type { Stage, TaskEvent } from "./task-run";
@@ -29,6 +29,9 @@ const ran = computed(() => duration(props.stage.duration_ms));
const reports = computed(() =>
agentReports(props.events, props.attemptNumber, props.stage.name),
);
const retries = computed(() =>
stageRetries(props.events, props.attemptNumber, props.stage.name),
);
// The node carries the status as a shape, the same way the label's own kind
// does; the connector behind it is what makes the stages read as one run rather
@@ -98,6 +101,13 @@ const nodeClass = computed(() =>
>
{{ stage.error }}
</div>
<div
v-for="(retry, i) in retries"
:key="`retry-${i}`"
class="mt-2 text-xs text-warn"
>
{{ [retry.title, retry.detail].filter(Boolean).join(" · ") }}
</div>
<div
v-for="(report, i) in reports"
:key="i"
+17 -1
View File
@@ -39,6 +39,22 @@ export function stageStatusMeta(status?: string | null): StageStatusMeta {
* events whose attempt and stage both match. Returning an array rather than one
* value keeps a stage that ran two agents honest instead of showing the last.
*/
/** stageRetries are the failed attempts archie recorded for a retried stage. */
export function stageRetries(
events: TaskEvent[] | null | undefined,
attemptNumber: number | null | undefined,
stage: string | undefined,
): TimelineLine[] {
return (events || [])
.filter(
(ev) =>
ev?.kind === "step_retried" &&
Number(ev.attempt) === Number(attemptNumber) &&
(ev.stage || "") === (stage || ""),
)
.map((ev) => describeTimelineEvent(ev));
}
export function agentReports(
events: TaskEvent[] | null | undefined,
attemptNumber: number | null | undefined,
@@ -48,7 +64,7 @@ export function agentReports(
.filter(
(ev) =>
ev &&
(ev.kind === "agent_finish" || ev.kind === "step_retried") &&
ev.kind === "agent_finish" &&
Number(ev.attempt) === Number(attemptNumber) &&
(ev.stage || "") === (stage || ""),
)