Skip to content

Commit 1b2b99d

Browse files
Revert "perf(client): skip irrelevant exit-code scans in tool output"
This reverts commit c5e083f.
1 parent c5e083f commit 1b2b99d

2 files changed

Lines changed: 3 additions & 56 deletions

File tree

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

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -86,58 +86,6 @@ describe("workEntryIndicatesToolFailure", () => {
8686
).toBe(false);
8787
});
8888

89-
it.each([
90-
"FILE NOT FOUND",
91-
"No files found",
92-
"ENOENT",
93-
"No such file or directory",
94-
"No such file",
95-
"CommandNotFoundException",
96-
"Command not found",
97-
"Cannot find path 'example'\nbecause it does not exist",
98-
"The term 'example'\nis not recognized",
99-
"Is not recognized as the name of a cmdlet",
100-
"A parameter cannot be found that matches parameter name",
101-
"<exited with exit code 12>",
102-
"Exited with exit code\t2",
103-
"Exit with exit code 1",
104-
"Exit code: 9",
105-
"Exit code\n3",
106-
])("detects an error after a long successful output: %s", (error) => {
107-
const entry = {
108-
...base,
109-
tone: "tool" as const,
110-
toolLifecycleStatus: "completed",
111-
detail: `${"Synthetic successful output.\n".repeat(512)}${error}`,
112-
};
113-
expect(workEntryIndicatesToolFailure(entry)).toBe(true);
114-
expect(workEntryDisplayIndicatesToolFailure(entry)).toBe(true);
115-
});
116-
117-
it.each([
118-
"Cannot find path",
119-
"Because it does not exist",
120-
"Is not recognized",
121-
"The term 'example'",
122-
"<exited with exit code 0>",
123-
"Exit code: 0",
124-
"Exit code: -1",
125-
"Exit code: 12things",
126-
])("keeps incomplete or non-failure markers successful: %s", (detail) => {
127-
expect(workEntryIndicatesToolFailure({ ...base, tone: "tool", detail })).toBe(false);
128-
});
129-
130-
it("matches paired failure phrases across legacy detail and command fields", () => {
131-
const entry = {
132-
...base,
133-
tone: "tool" as const,
134-
detail: "Cannot find path 'example'",
135-
command: "Because it does not exist",
136-
};
137-
expect(workEntryIndicatesToolFailure(entry)).toBe(true);
138-
expect(workEntryDisplayIndicatesToolFailure(entry)).toBe(false);
139-
});
140-
14189
it("does not treat error text in a command as rendered failure", () => {
14290
const entry = {
14391
label: "Ran command",

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,9 @@ function toolDetailTextLooksLikeFailure(text: string): boolean {
409409
(normalized.includes("is not recognized") && normalized.includes("the term '")) ||
410410
normalized.includes("is not recognized as the name of a cmdlet") ||
411411
normalized.includes("a parameter cannot be found that matches parameter name") ||
412-
(normalized.includes("exit code") &&
413-
(/<exited with exit code\s+[1-9]\d*\s*>/i.test(text) ||
414-
/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(text) ||
415-
/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(text)))
412+
/<exited with exit code\s+[1-9]\d*\s*>/i.test(text) ||
413+
/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(text) ||
414+
/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(text)
416415
);
417416
}
418417

0 commit comments

Comments
 (0)