Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions packages/cloud-agents/src/server/non-task-provider-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,16 @@ export function classifyNonTaskInferenceError(
};
}

// The SDK marks credential rejections non-retryable too. Preserve their
// specific category so pre-save validation can reject a known-bad key.
if (!gatewayBlocked && (statusCode === 401 || statusCode === 403)) {
return {
message: 'The inference provider rejected these credentials.',
reason: 'invalid_credentials',
retryable: false,
};
}

if (isInferenceErrorExplicitlyNonRetryable(inferenceError)) {
return {
message: 'The inference provider rejected the request.',
Expand Down Expand Up @@ -3109,14 +3119,6 @@ export function classifyNonTaskInferenceError(
};
}

if (statusCode === 401 || statusCode === 403) {
return {
message: 'The inference provider rejected these credentials.',
reason: 'invalid_credentials',
retryable: false,
};
}

if (statusCode === 404) {
return {
message: 'The selected model is unavailable with these credentials.',
Expand Down
Loading