fix(web): stop recovered tool failures from marking work logs red (#7999)
This commit is contained in:
1 parent
ea8c9e5ca3
commit
b1670ac7d9
3 files changed
+103
-53
No files matched your search
@@ -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`;
|
||||
|
||||
expect(rows.find((row) => row.kind === "work-toggle")).toMatchObject({
|
||||
hiddenCount: 2,
|
||||
summary: null,
|
||||
hasFailure: true,
|
||||
});
|
||||
});
|
||||
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,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
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", () => {
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user