Agents: scope sanitizeUserFacingText rewrites to errorContext

Squash-merge #12988.

Refs: #12889 #12309 #3594 #7483 #10094 #10368 #11317 #11359 #11649 #12022 #12432 #12676 #12711
This commit is contained in:
Tak Hoffman
2026-02-09 19:52:24 -06:00
committed by GitHub
parent 64cf50dfc3
commit 54315aeacf
9 changed files with 87 additions and 39 deletions

View File

@@ -30,4 +30,14 @@ describe("extractAssistantText", () => {
};
expect(extractAssistantText(message)).toBe("Hi there");
});
it("rewrites error-ish assistant text only when the transcript marks it as an error", () => {
const message = {
role: "assistant",
stopReason: "error",
errorMessage: "500 Internal Server Error",
content: [{ type: "text", text: "500 Internal Server Error" }],
};
expect(extractAssistantText(message)).toBe("HTTP 500: Internal Server Error");
});
});