Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): stop recovered tool failures from marking work logs red (#7999)

Theo Browneb1670ac7d9b5
diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
index ae05289af..81c9fdacd 100644
--- a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+++ b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts
@@ -1470,57 +1470,54 @@ describe("deriveMessagesTimelineRows", () => {
});
});
- it("keeps a failure visible when other hidden entries succeeded", () => {
- const rows = deriveMessagesTimelineRows({
- timelineEntries: [
- {
- id: "failed-work-entry",
- kind: "work",
- createdAt: "2026-01-01T00:00:01Z",
- entry: {
- id: "failed-work",
- createdAt: "2026-01-01T00:00:01Z",
- label: "Ran command",
- tone: "tool",
- toolLifecycleStatus: "failed",
- },
- },
- {
- id: "completed-work-entry",
- kind: "work",
- createdAt: "2026-01-01T00:00:02Z",
- entry: {
- id: "completed-work",
- createdAt: "2026-01-01T00:00:02Z",
- label: "Ran command",
- tone: "tool",
- toolLifecycleStatus: "completed",
- },
- },
- {
- id: "visible-info-entry",
- kind: "work",
- createdAt: "2026-01-01T00:00:03Z",
- entry: {
- id: "visible-info",
- createdAt: "2026-01-01T00:00:03Z",
- label: "Status updated",
- tone: "info",
- },
- },
- ],
- isWorking: false,
- activeTurnStartedAt: null,
- turnDiffSummaryByAssistantMessageId: new Map(),
- revertTurnCountByUserMessageId: new Map(),
- });
+ it.each([
+ ["the later success is hidden", ["failed", "completed", "info"], false],
+ ["the later success is visible", ["failed", "info", "completed"], false],
+ ["an error-toned entry recovers", ["error", "info", "completed"], false],
+ ["the final failure is hidden", ["completed", "failed", "info"], true],
+ ["the final failure is visible", ["failed", "info", "failed"], true],
+ ["the only failure is visible", ["completed", "info", "failed"], false],
+ ] as const)(
+ "uses the final tool call for mixed work groups when %s",
+ (_, statuses, hasFailure) => {
+ const timelineEntries = statuses.map((status, index) => {
+ const id = `work-${index}`;
+ const createdAt = `2026-01-01T00:00:0${index}Z`;
+
+ return {
+ id: `work-entry-${index}`,
+ kind: "work" as const,
+ createdAt,
+ entry:
+ status === "info"
+ ? { id, createdAt, label: "Status updated", tone: "info" as const }
+ : status === "error"
+ ? { id, createdAt, label: "Command failed", tone: "error" as const }
+ : {
+ id,
+ createdAt,
+ label: "Ran command",
+ tone: "tool" as const,
+ toolLifecycleStatus: status,
+ },
+ };
+ });
- expect(rows.find((row) => row.kind === "work-toggle")).toMatchObject({
- hiddenCount: 2,
- summary: null,
- hasFailure: true,
- });
- });
+ const rows = deriveMessagesTimelineRows({
+ timelineEntries,
+ isWorking: false,
+ activeTurnStartedAt: null,
+ turnDiffSummaryByAssistantMessageId: new Map(),
+ revertTurnCountByUserMessageId: new Map(),
+ });
+
+ expect(rows.find((row) => row.kind === "work-toggle")).toMatchObject({
+ hiddenCount: 2,
+ summary: null,
+ hasFailure,
+ });
+ },
+ );
});
describe("computeStableMessagesTimelineRows", () => {
diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.ts
index 8e2b295fc..d39858343 100644
--- a/apps/web/src/components/chat/MessagesTimeline.logic.ts
+++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts
@@ -953,6 +953,8 @@ export function deriveMessagesTimelineRows(input: {
}
if (hiddenEntries.length > 0) {
+ const latestToolEntry = visibleGroupedEntries.findLast(workLogEntryIsToolLike);
+
nextRows.push({
kind: "work-toggle",
id: `work-toggle:${timelineEntry.id}`,
@@ -963,9 +965,10 @@ export function deriveMessagesTimelineRows(input: {
onlyToolEntries: hiddenEntries.every(workLogEntryIsToolLike),
summary: null,
summaryKind: null,
- hasFailure: hiddenEntries.some((entry) =>
- workEntryDisplayIndicatesToolFailure(entry),
- ),
+ hasFailure:
+ latestToolEntry !== undefined &&
+ workEntryDisplayIndicatesToolFailure(latestToolEntry) &&
+ hiddenEntries.some(workEntryDisplayIndicatesToolFailure),
});
}
}
diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx
index 6d007a5b6..7ee4514c3 100644
--- a/apps/web/src/components/chat/MessagesTimeline.test.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx
@@ -973,6 +973,56 @@ describe("MessagesTimeline", () => {
expect(markup).not.toContain('aria-label="Tool call failed"');
});
+ it("keeps mixed work logs neutral after a later tool call succeeds", () => {
+ const markup = renderToStaticMarkup(
+ <MessagesTimeline
+ {...buildProps()}
+ timelineEntries={[
+ {
+ id: "entry-failed",
+ kind: "work",
+ createdAt: "2026-03-17T19:12:28.000Z",
+ entry: {
+ id: "work-failed",
+ createdAt: "2026-03-17T19:12:28.000Z",
+ label: "Run search",
+ tone: "tool",
+ itemType: "command_execution",
+ toolLifecycleStatus: "failed",
+ },
+ },
+ {
+ id: "entry-info",
+ kind: "work",
+ createdAt: "2026-03-17T19:12:29.000Z",
+ entry: {
+ id: "work-info",
+ createdAt: "2026-03-17T19:12:29.000Z",
+ label: "Status updated",
+ tone: "info",
+ },
+ },
+ {
+ id: "entry-completed",
+ kind: "work",
+ createdAt: "2026-03-17T19:12:30.000Z",
+ entry: {
+ id: "work-completed",
+ createdAt: "2026-03-17T19:12:30.000Z",
+ label: "Run tests",
+ tone: "tool",
+ itemType: "command_execution",
+ toolLifecycleStatus: "completed",
+ },
+ },
+ ]}
+ />,
+ );
+
+ expect(markup).toContain("+2 previous log entries");
+ expect(markup).not.toContain('aria-label="Hidden work includes a failure"');
+ });
+
it("shows the animated one-line label for a live tool group", () => {
const turnId = TurnId.make("turn-live");
const markup = renderToStaticMarkup(