Skip to content

Commit 95d9d68

Browse files
perf(web): reasoning rows skip the tool-failure text scan
Opening or streaming in a long thread rescanned every reasoning row's text (often tens of KB each) with the tool-failure regexes on every timeline derivation. Reasoning is model prose, not tool output, so the scan was both the largest script cost in those frames and a source of false failure marks ("that exit code 2 is expected"). Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ea97e8b commit 95d9d68

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎packages/client-runtime/src/work-log/presentation.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ describe("workEntryIndicatesToolFailure", () => {
7878
},
7979
);
8080

81+
it("ignores failure phrases in reasoning text", () => {
82+
const entry: WorkLogPresentationEntry = {
83+
...base,
84+
label: "Thinking",
85+
tone: "thinking",
86+
itemType: "reasoning",
87+
toolLifecycleStatus: "completed",
88+
detail: "That exit code 2 is just from listing the deleted directory, which is expected.",
89+
};
90+
expect(workEntryIndicatesToolFailure(entry)).toBe(false);
91+
expect(workEntryDisplayIndicatesToolFailure(entry)).toBe(false);
92+
});
93+
8194
it("is true for error tone", () => {
8295
expect(
8396
workEntryIndicatesToolFailure({

‎packages/client-runtime/src/work-log/presentation.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ function workEntryIndicatesToolFailureFromOutput(
365365
) {
366366
return true;
367367
}
368-
if (!workLogEntryIsToolLike(entry)) return false;
368+
// Reasoning detail is the model's own prose (often tens of KB), not tool
369+
// output: scanning it is slow on long threads and misreads phrases like
370+
// "that exit code 2 is expected" as a failed tool.
371+
if (!workLogEntryIsToolLike(entry) || entry.itemType === "reasoning") return false;
369372
if (
370373
resolveT3McpToolDefinition(workEntryToolName(entry)) &&
371374
t3ToolResultIndicatesFailure(workEntryToolOutput(entry))

0 commit comments

Comments
 (0)