fix(agent): normalize provider failures#907
Conversation
Co-Authored-By: OpenAI GPT-5.4 <noreply@openai.com> Co-Authored-By: immutable dcramer <david@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: OpenAI GPT-5.4 <noreply@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com> Co-Authored-By: immutable dcramer <david@sentry.io>
Co-Authored-By: OpenAI Codex <codex@openai.com> Co-Authored-By: immutable dcramer <david@sentry.io> Co-Authored-By: Nick <nicholas.deschenes@sentry.io>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: immutable dcramer <david@sentry.io> Co-Authored-By: Nick <nicholas.deschenes@sentry.io>
Co-Authored-By: immutable dcramer <david@sentry.io> Co-Authored-By: Nick <nicholas.deschenes@sentry.io>
Co-Authored-By: OpenAI GPT-5.4 <noreply@openai.com> Co-Authored-By: immutable dcramer <david@sentry.io> Co-Authored-By: Nick <nicholas.deschenes@sentry.io>
Co-Authored-By: OpenAI GPT-5.4 <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 22698f0. Configure here.
| message: string, | ||
| ): ProviderErrorKind { | ||
| if (/content.?policy|safety|moderation/i.test(message)) | ||
| return "content_policy"; |
There was a problem hiding this comment.
Overbroad safety error classification
Medium Severity
classifyProviderError treats any message containing bare safety as content_policy, which is non-retryable. Transient provider failures whose text happens to include that word are therefore dropped from retry/fallback even when status or other signals indicate a temporary outage.
Reviewed by Cursor Bugbot for commit 22698f0. Configure here.
| messages: agent!.state.messages, | ||
| retryableFailure: | ||
| lastAssistant !== undefined && | ||
| isRetryableAssistantError(lastAssistant), |
There was a problem hiding this comment.
Thrown failures skip normalization
Medium Severity
The agent catch path stores the raw thrown value as providerError, while finalizeFailedTurnReply only emits actionable copy and provider attributes when that value is a ProviderError. buildTurnResult normalizes via createProviderError, so transport throws that never become assistant stopReason: "error" messages still get the generic terminal reply and empty provider telemetry.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 22698f0. Configure here.


summary
ProviderErrorcontract for provider/auth/capacity/rate-limit/network failuresError.nameretry signaling with typed fieldscontext
This is the first vertical slice from the provider-error investigation prompted by recurring xAI 503 capacity failures (JUNIOR-53). Gateway fallback configuration remains separate work.
tests
git diff --checkpassespnpm install --frozen-lockfilewas cancelled by the runtime before completionRequested by immutable dcramer via Junior.
--
View Junior Session in Sentry