Skip to content

Commit 5b998d6

Browse files
Derive the all-done outcome from rows so mixed finishes never conflict
The header text came from the server subtitle (keyed off the newest terminal row) while the tint, count labels, and minimal glyph keyed off any failed row — a failed run followed by a newer completed one rendered "Agent work completed" in red with "Failed" in the island. Derive the header from the same failedRow signal so a failure dominates everywhere. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent c8137a5 commit 5b998d6

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎apps/mobile/src/widgets/AgentActivity.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,31 @@ describe("AgentActivity widget layout", () => {
238238
expect(JSON.stringify(layout.minimal)).toContain("xmark.octagon.fill");
239239
});
240240

241+
it("lets a failure dominate mixed finished outcomes across every presentation", () => {
242+
const layout = AgentActivity(
243+
{
244+
...props,
245+
// The server subtitle keys off the newest terminal row (completed
246+
// here); the layout must still read Failed everywhere so the header
247+
// text never disagrees with the tint, count slots, or minimal glyph.
248+
subtitle: "Agent work completed",
249+
activeCount: 0,
250+
activities: [
251+
makeRow({ phase: "completed", status: "Done" }),
252+
makeRow({ threadId: "thread-2", phase: "failed", status: "Failed" }),
253+
],
254+
},
255+
environment as never,
256+
);
257+
const banner = JSON.stringify(layout.banner);
258+
expect(banner).toContain("Agent work failed");
259+
expect(banner).not.toContain("Agent work completed");
260+
expect(banner).toContain("#fca5a5"); // red-300 header tint
261+
expect(JSON.stringify(layout.compactTrailing)).toContain("Failed");
262+
expect(JSON.stringify(layout.expandedLeading)).toContain("Failed");
263+
expect(JSON.stringify(layout.minimal)).toContain("xmark.octagon.fill");
264+
});
265+
241266
it("renders up to five rows in the banner", () => {
242267
const layout = AgentActivity(
243268
{

‎apps/mobile/src/widgets/AgentActivity.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,20 @@ export function AgentActivity(
125125

126126
// With nothing active the aggregate only carries recently finished work, so
127127
// "0 active agents" (and a lone "0" in the expanded island) read as broken.
128-
// Lead with the outcome instead: the server's subtitle ("Agent work
129-
// completed" / "Agent work failed") as the header, "Done"/"Failed" in the
130-
// count slots.
128+
// Lead with the outcome instead. The outcome is derived here from the rows
129+
// rather than taken from the server subtitle (which keys off the newest
130+
// terminal row): every presentation — header text, tint, count slots,
131+
// minimal glyph — must agree, and a failure anywhere should dominate a
132+
// newer success.
131133
const allDone = props.activeCount === 0;
132134
const doneLabel = failedRow ? "Failed" : "Done";
135+
const outcomeLabel = failedRow ? "Agent work failed" : "Agent work completed";
133136

134137
// Header copy: "5 active agents" + (", 1 needs attention"). The banner renders
135138
// the two parts in-line so the attention half can carry the accent color;
136139
// `summary` is the short form for tight spots (expanded center, watch card).
137140
const agentWord = props.activeCount === 1 ? "agent" : "agents";
138-
const agentsLabel = allDone ? props.subtitle : `${props.activeCount} active ${agentWord}`;
141+
const agentsLabel = allDone ? outcomeLabel : `${props.activeCount} active ${agentWord}`;
139142
const attentionSuffix =
140143
attentionRows.length > 0
141144
? `${attentionRows.length} need${attentionRows.length === 1 ? "s" : ""} attention`

0 commit comments

Comments
 (0)