-
Notifications
You must be signed in to change notification settings - Fork 114
fix: return null for unknown stop reason in anthropic handler #1995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| const INVALID_PROVIDER_CREDENTIAL_PATTERNS = [ | ||
| /api key not valid/i, | ||
| /api key not found/i, | ||
| /please pass a valid api key/i, | ||
| ]; | ||
|
Comment on lines
+1
to
+5
|
||
|
|
||
| export function hasInvalidProviderCredentialError(errorText?: string): boolean { | ||
| if (!errorText) { | ||
| return false; | ||
| } | ||
|
|
||
| return INVALID_PROVIDER_CREDENTIAL_PATTERNS.some((pattern) => | ||
| pattern.test(errorText), | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling
shouldRetryAlternateKeyforgateway_errorcauses auth failures (e.g., 401/403 or 400 invalid-key payloads) to enter the retry path, but those retry attempts are still recorded viagetErrorType(statusCode)inchat.ts, which maps these statuses toupstream_error. In scenarios with multiple keys on the same provider,metadata.routing[].error_typewill now misreport credential failures as transient upstream failures, which can mislead routing diagnostics and dashboard analysis.Useful? React with 👍 / 👎.