Skip to content

fix(transport): preserve retry delay on service unavailable responses - #428

Merged
tkkhq merged 1 commit into
mainfrom
tkkhq/pgproxy-startup-recovery-tests
Nov 20, 2026
Merged

tkkhq merged 1 commit into
mainfrom
tkkhq/pgproxy-startup-recovery-tests

Conversation

@tkkhq

@tkkhq tkkhq commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Tracking

Why

  • Database capacity refusals can return HTTP 503 with Retry-After, but Python drops that retry delay when constructing ServerError. Applications need the server's delay to bound their own retries.

Summary

  • preserve numeric Retry-After on HTTP 503 as well as 429 without automatically replaying the request
  • verify typed error metadata and exactly one transport request in the native error-mapping test
  • retain the SDK's existing OpenAPI snapshot and generated client; no method or response-body schema changes are needed
  • coordinate the public database guidance in Kong/volcano-docs; publish that guidance after the Hosting and SDK behavior is released

Verification

  • Before the fix, the HTTP 503 case failed because retry_after was None instead of 17.
  • uvx --from uv==0.12.17 uv run poe test — 3,007 passed.
  • uvx --from uv==0.12.17 uv run poe lint
  • uvx --from uv==0.12.17 uv run poe types
  • uvx --from uv==0.12.17 uv run poe format-check
  • uvx --from uv==0.12.17 uv run poe generated
  • uvx --from uv==0.12.17 uv run poe package-check — isolated wheel/sdist installation and synthetic HTTP quickstart passed.
  • No package publication or live SDK acceptance is claimed.

@tkkhq
tkkhq enabled auto-merge November 20, 2026 04:03
@tkkhq tkkhq added the ai-review-override Accept this head's AI review (write access, PR author included) label Nov 20, 2026
@github-actions github-actions Bot removed the ai-review-override Accept this head's AI review (write access, PR author included) label Nov 20, 2026
@tkkhq
tkkhq disabled auto-merge November 20, 2026 17:59
@tkkhq
tkkhq marked this pull request as draft November 20, 2026 18:09
@tkkhq
tkkhq marked this pull request as ready for review November 20, 2026 18:09
@github-actions

Copy link
Copy Markdown

AI review: no P0-P2 findings

Reviewed e4638ea. Run log

For HTTP 503 responses, the SDK now reads a numeric Retry-After header into ServerError.retry_after, the same way it already does for 429. It never replays the request automatically. Every SDK error path goes through response_payload, so the change applies everywhere and only adds data. Other 5xx statuses still leave retry_after as None. The parametrized error-mapping test now checks 17 for 503. This is a low-risk, additive fix.

Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.

  • Whether Hosting (Kong/volcano-hosting#3400) actually sends database-capacity 503 responses with an integer-seconds Retry-After rather than an HTTP-date. The SDK ignores an HTTP-date value.

Human review: not needed

@tkkhq
tkkhq added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 1e566fb Nov 20, 2026
115 of 116 checks passed
@tkkhq
tkkhq deleted the tkkhq/pgproxy-startup-recovery-tests branch November 20, 2026 19:27
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.

2 participants