Agent: repair malformed tool calls and session files

This commit is contained in:
Justin
2026-02-03 05:17:42 +08:00
committed by Shakker
parent 0eae9f456c
commit 0da6de6624
13 changed files with 383 additions and 13 deletions

View File

@@ -35,6 +35,12 @@ describe("formatAssistantErrorText", () => {
"The AI service is temporarily overloaded. Please try again in a moment.",
);
});
it("returns a recovery hint when tool call input is missing", () => {
const msg = makeAssistantError("tool_use.input: Field required");
const result = formatAssistantErrorText(msg);
expect(result).toContain("Session history looks corrupted");
expect(result).toContain("/new");
});
it("handles JSON-wrapped role errors", () => {
const msg = makeAssistantError('{"error":{"message":"400 Incorrect role information"}}');
const result = formatAssistantErrorText(msg);