fix(ui): prefer failed grouped tool status

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
Taylor Ho
2026-04-23 11:15:20 -07:00
parent ebb9b1ae0f
commit cdadfde01b
2 changed files with 43 additions and 6 deletions
@@ -162,18 +162,18 @@ function getToolGroupTitle(toolItems: ToolChainItem[]): string {
}
function getToolGroupStatus(toolItems: ToolChainItem[]): ToolCallStatus {
if (toolItems.some((item) => getToolItemStatus(item) === "executing")) {
return "executing";
}
if (toolItems.some((item) => getToolItemStatus(item) === "pending")) {
return "pending";
}
if (toolItems.some((item) => getToolItemStatus(item) === "error")) {
return "error";
}
if (toolItems.some((item) => getToolItemStatus(item) === "stopped")) {
return "stopped";
}
if (toolItems.some((item) => getToolItemStatus(item) === "executing")) {
return "executing";
}
if (toolItems.some((item) => getToolItemStatus(item) === "pending")) {
return "pending";
}
return "completed";
}
@@ -168,4 +168,41 @@ describe("MessageBubble tool chains", () => {
expect(screen.getByText("Read main.js")).toBeInTheDocument();
});
it("shows a failed grouped chain even when another step is still pending", () => {
const msg = assistantMessage([
{
type: "toolRequest",
id: "tool-1",
chainId: "chain-1",
chainSummary: "working",
name: "Edit main.swift",
arguments: {},
status: "completed",
},
{
type: "toolResponse",
id: "tool-1",
chainId: "chain-1",
chainSummary: "working",
name: "Edit main.swift",
result: "permission denied",
isError: true,
},
{
type: "toolRequest",
id: "tool-2",
chainId: "chain-1",
chainSummary: "working",
name: "Edit README.md",
arguments: {},
status: "pending",
},
]);
render(<MessageBubble message={msg} />);
expect(screen.getByText("working through 2 steps")).toBeInTheDocument();
expect(screen.getByText("Error")).toBeInTheDocument();
});
});