diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx
index 81d5c9c52f..6b1629205a 100644
--- a/apps/web/src/components/chat/MessagesTimeline.test.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx
@@ -1441,10 +1441,73 @@ describe("MessagesTimeline", () => {
);
expect(markup).toContain("Ran 1 subagent");
- expect(markup).toContain("1 failed");
+ expect(markup).toContain(">failed");
+ expect(markup).not.toContain("1 failed");
expect(markup).not.toContain("✓ completed");
});
+ it("does not count a failed workflow coordinator as an extra subagent", () => {
+ const coordinator = runtimeAgent("workflow-review", {
+ kind: "workflow",
+ status: "failed",
+ workflowName: "Review",
+ phases: [{ index: 0, title: "Inspect" }],
+ });
+ const members = ["first", "second"].map((suffix) =>
+ runtimeAgent(`workflow-review:${suffix}`, {
+ kind: "workflow_agent",
+ status: "failed",
+ parentAgentId: coordinator.id,
+ phaseIndex: 0,
+ completedAt: MESSAGE_CREATED_AT,
+ }),
+ );
+ const agentPanelModel = {
+ workflows: [
+ {
+ workflow: coordinator,
+ phases: [
+ {
+ index: 0,
+ title: "Inspect",
+ members,
+ state: "done",
+ activeCount: 0,
+ settledCount: 2,
+ },
+ ],
+ unphasedMembers: [],
+ },
+ ],
+ directAgents: [],
+ runningCount: 0,
+ waitingCount: 0,
+ idleCount: 0,
+ settledCount: 3,
+ totalTokens: 0,
+ hasAgents: true,
+ liveCount: 0,
+ } satisfies AgentPanelModel;
+ const markup = renderToStaticMarkup(
+ ,
+ );
+
+ expect(markup).toContain("Ran 2 subagents");
+ expect(markup).toContain("2 failed");
+ expect(markup).not.toContain("3 failed");
+ });
+
it("keeps an older CTA on its activation after the agent identity is reused", () => {
const now = DateTime.makeUnsafe(MESSAGE_CREATED_AT);
const subagentId = NodeId.make("node-subagent-reused");
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index 0690b4158b..d74cdd31ea 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -1636,13 +1636,11 @@ const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: {
else if (status === "cancelled" || status === "interrupted") stopped += 1;
}
const coordinatorStatus = workflowGroup?.workflow.status;
- if (coordinatorStatus === "failed") failed += 1;
- if (coordinatorStatus === "cancelled" || coordinatorStatus === "interrupted") stopped += 1;
+ const coordinatorFailed = coordinatorStatus === "failed";
+ const coordinatorStopped =
+ coordinatorStatus === "cancelled" || coordinatorStatus === "interrupted";
const coordinatorSettled =
- coordinatorStatus === "completed" ||
- coordinatorStatus === "failed" ||
- coordinatorStatus === "cancelled" ||
- coordinatorStatus === "interrupted";
+ coordinatorStatus === "completed" || coordinatorFailed || coordinatorStopped;
const live = workflowGroup === undefined ? running + waiting > 0 : !coordinatorSettled;
const totalTokens = agentStates.reduce(
(sum, agent) => sum + agent.totalTokens,
@@ -1656,9 +1654,9 @@ const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: {
const working = running + waiting;
const dotClass = live
? "bg-info"
- : failed > 0
+ : failed > 0 || coordinatorFailed
? "bg-destructive"
- : idle > 0 || stopped > 0
+ : idle > 0 || stopped > 0 || coordinatorStopped
? "bg-muted-foreground/50"
: "bg-success";
const lead =
@@ -1677,11 +1675,15 @@ const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: {
: "working"
: failed > 0
? `${failed} failed`
- : idle > 0
- ? `${idle} idle`
- : stopped > 0
- ? `${stopped} stopped`
- : "✓ completed";
+ : coordinatorFailed
+ ? "failed"
+ : idle > 0
+ ? `${idle} idle`
+ : stopped > 0
+ ? `${stopped} stopped`
+ : coordinatorStopped
+ ? "stopped"
+ : "✓ completed";
return (