Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/client-runtime/src/work-log/presentation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ describe("workEntryIndicatesToolFailure", () => {
},
);

it("ignores failure phrases in reasoning text", () => {
const entry: WorkLogPresentationEntry = {
...base,
label: "Thinking",
tone: "thinking",
itemType: "reasoning",
toolLifecycleStatus: "completed",
detail: "That exit code 2 is just from listing the deleted directory, which is expected.",
};
expect(workEntryIndicatesToolFailure(entry)).toBe(false);
expect(workEntryDisplayIndicatesToolFailure(entry)).toBe(false);
});

it("is true for error tone", () => {
expect(
workEntryIndicatesToolFailure({
Expand Down
5 changes: 4 additions & 1 deletion packages/client-runtime/src/work-log/presentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ function workEntryIndicatesToolFailureFromOutput(
) {
return true;
}
if (!workLogEntryIsToolLike(entry)) return false;
// Reasoning detail is the model's own prose (often tens of KB), not tool
// output: scanning it is slow on long threads and misreads phrases like
// "that exit code 2 is expected" as a failed tool.
if (!workLogEntryIsToolLike(entry) || entry.itemType === "reasoning") return false;
if (
resolveT3McpToolDefinition(workEntryToolName(entry)) &&
t3ToolResultIndicatesFailure(workEntryToolOutput(entry))
Expand Down
Loading