Skip to content

Feature: Support @dynamic=initialvalue for configurable initial retry-after value in GenericRandomErrorPlugin responses #1272

@waldekmastykarz

Description

@waldekmastykarz

Proposal

Extend the GenericRandomErrorPlugin to enhance the handling of the retry-after response header. Currently, the initial value for retry-after is set globally for all responses in the plugin's configuration. This feature proposes supporting a syntax of @dynamic=initialvalue within the response header, enabling the initial retry-after value to be set on a per-response basis.

Motivation

  • Allows greater flexibility and realism when simulating errors with varying backoff requirements.
  • Developers can configure different endpoints to return different initial retry-after values, improving test coverage for clients handling these scenarios.

Acceptance Criteria

  • The plugin should parse the @dynamic=initialvalue syntax from the retry-after response header configuration.
  • If present, the initial retry-after value for that response should override the global default for that invocation.
  • Documentation should be updated with usage examples.

Example

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.29.0/genericrandomerrorplugin.errorsfile.schema.json",
  "errors": [
    {
      "request": {
        "url": "https://models.github.ai/inference/chat/completions",
        "method": "POST"
      },
      "responses": [
        {          
          "statusCode": 429,
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "Retry-After",
              "value": "@dynamic=17"
            }
          ],
          "body": {
            "error": {
              "code": "RateLimitReached",
              "message": "Rate limit of 15 per 60s exceeded for UserByModelByMinute. Please wait 17 seconds before retrying.",
              "details": "Rate limit of 15 per 60s exceeded for UserByModelByMinute. Please wait 17 seconds before retrying."
            }
          }
        }
      ]
    }
  ]
}

In this example, the initial retry-after value will be set to 17 for this response, regardless of the global plugin setting.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions