Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a failed Claude text generation now shows the CLI's own error #12652

ClosedMnigos(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/12652/headopened View on GitHub

Showing 2 changed files with 84 additions and 1 deletion.

x
0 of 2 viewed, 2 left
62 additions and 0 deletionsapps/server/src/textGeneration/ClaudeTextGeneration.test.tsModified
View file
@@ -555,6 +555,68 @@
​
+ const apiError =
+ "API Error: 400 Model blocked by guardrail: 4 endpoints excluded for claude-haiku-4-5";
+ const wrapperNotice = "Using the OpenRouter credential from the global credential file.";
+ for (const [name, input, expectedDetail] of [
+ [
+ "the stdout result over a wrapper notice on stderr",
+ {
+ output: JSON.stringify({ is_error: true, api_error_status: 400, result: apiError }),
+ stderr: wrapperNotice,
+ },
+ `Claude CLI command failed: ${apiError}`,
+ ],
+ [
+ "the result message of verbose stdout",
+ {
+ output: JSON.stringify([
+ { type: "system", subtype: "init" },
+ { type: "result", is_error: true, result: apiError },
+ ]),
+ stderr: wrapperNotice,
+ },
+ `Claude CLI command failed: ${apiError}`,
+ ],
+ [
+ "a capped stdout result",
+ { output: JSON.stringify({ is_error: true, result: `API Error: ${"x".repeat(600)}` }) },