microsoft / microsoft/amplifier

[provider-vllm] Continuation calls should retry retryable HTTP errors (524/502/503/529) with backoff

Open
#340 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
261
Avg merge
3h 28m
Merged PRs (30d)
13

Description

Problem

Module: amplifier-module-provider-vllm

When a response hits max_output_tokens and the provider enters its auto-continuation loop, any exception during a continuation call — including explicitly retryable infrastructure errors — causes the loop to immediately give up and return a partial (truncated) response.

The give-up handler in amplifier_module_provider_vllm/__init__.py (lines ~1486–1491, continuation loop ~1303–1491) is a bare except Exception that logs and breaks:

except Exception as e:
    logger.error(
        f"[PROVIDER] Continuation call {continuation_count} failed: {e}. "
        f"Returning partial response from {continuation_count} continuation(s)"
    )
    break  # Return what we have so far

There is no inspection of the error's retryability, no honoring of retry_after, and no backoff.

Observed behavior

This was observed in practice: a continuation call failed with an HTTP 524 whose error payload explicitly included "retryable": true and a retry_after value, yet the provider gave up after a single attempt and persisted a mid-sentence-truncated assistant message (vllm:status: "incomplete", vllm:incomplete_reason: "max_output_tokens").

Continuations are an especially safe/cheap retry case: the prompt is unchanged and largely KV-cached, so a retry costs little.

Proposed fix

In the continuation loop's exception handler:

  1. Classify the error using the same retryable/retry_after error classification that already guards the primary request path (this exists in the sibling provider-openai code at __init__.py:~1700–1714, 1807, 1873–1898; the continuation loop bypasses it).
  2. For retryable errors (524, 502, 503, 529, connection errors): retry with backoff, honoring retry_after when provided, up to N attempts (bounded — could reuse or parallel MAX_CONTINUATION_ATTEMPTS).
  3. Only after retries are exhausted, fall back to the current behavior (log + return partial response).

Related

The identical pattern is duplicated in microsoft/amplifier-module-provider-openai (amplifier_module_provider_openai/__init__.py:~2140–2157), from which this module is derived — and likely in other Responses-API-lineage providers (provider-azure-openai, provider-chat-completions). This issue targets provider-vllm since that's where the failure was observed, but maintainers may want to apply the same fix across the family.


Note: The provider-vllm repository has issues disabled, so this issue is filed in the central Amplifier repo for coordination.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in amplifier_module_provider_vllm/init.py at the continuation loop (~1303–1491), especially the exception handler around lines 1486–1491, and compare the retry classification in provider-openai/init.py (~1700–1714, 1807, 1873–1898). Trace how retryable and retry_after are handled on the primary request path, then determine the bounded continuation retry behavior. Done when retryable 524/502/503/529 and connection errors use backoff and only return a partial response after retries are exhausted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.