Skip to content

Azure OpenAI 5xx errors not auto-retried #4232

@gustavhartz

Description

@gustavhartz

What happened?

Transient Azure OpenAI 500 came back with body "The server had an error processing your request. Sorry about that!". Auto-retry didn't fire; the agent gave up.

Two reasons it slips through:

  1. packages/ai/src/providers/azure-openai-responses.ts catch block does errorMessage = error.message and drops the HTTP status. mistral.ts already prefixes status: Mistral API error (${statusCode}): ....
  2. _isRetryableError in packages/coding-agent/src/core/agent-session.ts keys off 429|500|502|503|504|server.?error|.... With the status stripped, no code matches. The body says "server had an error" — 8 chars between, doesn't match server.?error (0–1 chars). Nothing fires.

openai-codex-responses.ts already wraps the request in a provider-level retry on 429/5xx. Azure doesn't.

Steps to reproduce

Hard to trigger on demand (Azure 5xxs are transient). Inspection: compare catch blocks of azure-openai-responses.ts vs openai-codex-responses.ts. Hit on provider: azure-openai-responses, model gpt-5.3-codex.

Expected behavior

Prefix the status onto errorMessage so the existing classifier matches (mirrors mistral.ts), or add a provider-level retry loop like openai-codex-responses.ts. Happy to PR if you'd prefer.

Version

0.73.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions