Skip to content

Commit 95aced1

Browse files
authored
fix(agents): recover thinking errors from provider body (#98411)
1 parent d18b843 commit 95aced1

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎src/agents/embedded-agent-runner/thinking.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,18 @@ describe("wrapAnthropicStreamWithRecovery", () => {
737737
errorMessage: terminalThinkingSignatureError,
738738
}),
739739
},
740+
{
741+
name: "ProviderHttpError errorBody",
742+
createError: () =>
743+
Object.assign(new Error(genericizedProviderError), {
744+
errorBody: JSON.stringify({
745+
error: {
746+
message: terminalThinkingSignatureError,
747+
type: "invalid_request_error",
748+
},
749+
}),
750+
}),
751+
},
740752
{
741753
name: "cyclic cause graph",
742754
createError: () => {

‎src/agents/embedded-agent-runner/thinking.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ function shouldRecoverAnthropicThinkingError(
545545
current.error,
546546
current.rawError,
547547
current.errorMessage,
548+
current.errorBody,
548549
current.message,
549550
]);
550551
for (const candidate of candidates) {

0 commit comments

Comments
 (0)