fix(agents): recover thinking errors from provider body (#98411)

This commit is contained in:
sunlit-deng
2026-07-01 16:13:24 +08:00
committed by GitHub
parent d18b843a47
commit 95aced10b0
2 changed files with 13 additions and 0 deletions

View File

@@ -737,6 +737,18 @@ describe("wrapAnthropicStreamWithRecovery", () => {
errorMessage: terminalThinkingSignatureError,
}),
},
{
name: "ProviderHttpError errorBody",
createError: () =>
Object.assign(new Error(genericizedProviderError), {
errorBody: JSON.stringify({
error: {
message: terminalThinkingSignatureError,
type: "invalid_request_error",
},
}),
}),
},
{
name: "cyclic cause graph",
createError: () => {

View File

@@ -545,6 +545,7 @@ function shouldRecoverAnthropicThinkingError(
current.error,
current.rawError,
current.errorMessage,
current.errorBody,
current.message,
]);
for (const candidate of candidates) {