Skip to content

bug: avoid default retries for non-idempotent generated requests #16

@samzong

Description

@samzong

Problem

Generated commands currently retry HTTP 429/5xx by default for every method, including POST, PUT, PATCH, and DELETE. That can duplicate non-idempotent API operations when a server returns a retryable status after partially processing the request.

Evidence

  • pkg/runtime/client.go defaults MaxRetries to 3 when unset and wraps all requests in retryTransport.
  • pkg/runtime/retry.go retries on 429, 500, 502, 503, and 504 without checking the HTTP method.
  • pkg/runtime/build.go sends all generated operations through DoRaw / DoRawFull with the default client options.
  • Existing TestRetryTransport_ReplaysBody proves a POST request body is replayed on retry.

Expected behavior

Default retries should only apply to safe/idempotent operations, or generated mutating commands should opt into retries only when the operation is explicitly safe, for example via an idempotency key or a future spec/overlay hint.

Verification

make test currently passes, so this is an uncovered behavior gap rather than a failing existing test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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