Skip to content

馃悰 fix(models): retry OpenRouter error responses - #902

Open
bebiksior wants to merge 1 commit into
SWE-agent:mainfrom
bebiksior:lt-retry-malformed-openrouter-responses
Open

馃悰 fix(models): retry OpenRouter error responses#902
bebiksior wants to merge 1 commit into
SWE-agent:mainfrom
bebiksior:lt-retry-malformed-openrouter-responses

Conversation

@bebiksior

Copy link
Copy Markdown

Occasionally, OpenRouter with GPT models returns a response containing an error:

{
  "error": {
    "message": "This content was flagged for possible cybersecurity risk...",
    "code": 502
  }
}

Because the response has no choices, mini-swe-agent throws KeyError: 'choices' outside its retry loop.

This change validates the response inside the retry boundary and raises OpenRouterAPIError, allowing the existing retry policy to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant