Skip to content

feat: retry 502/503/504 with jittered backoff (SHA-1994)#1

Merged
Mlaz-code merged 2 commits into
mainfrom
sha-1994-sdk-retry
Apr 19, 2026
Merged

feat: retry 502/503/504 with jittered backoff (SHA-1994)#1
Mlaz-code merged 2 commits into
mainfrom
sha-1994-sdk-retry

Conversation

@Mlaz-code
Copy link
Copy Markdown
Contributor

Summary

  • Sync + async HTTP clients now retry transient upstream failures (502/503/504 or connect/read errors) up to 3 times
  • Full-jitter exponential backoff: 500ms base → 4s cap
  • Shields SDK users from the ~3s cold-start gap when sharp-api-go restarts

Context

Filed against SHA-1994. During the SHA-1929 deploy on 2026-04-19 15:53 UTC, sharp-api-go was restarted via systemctl to pick up new ClickHouse env vars — this caused 74 × 5xx over ~3s for live customer requests. The server side is being fixed with a dedicated config-reload helper (sharp-api-go repo), and the SDKs add defense-in-depth retry so SDK users don't see the gap at all.

Test plan

  • 87 existing tests pass locally
  • Verify retry actually kicks in via a dummy 503 mock once CI runs

🤖 Generated with Claude Code

Mlaz-code and others added 2 commits April 19, 2026 12:42
Sync + async HTTP clients now retry up to 3 times on transient upstream
failures (502/503/504 or connect/read errors) with full-jitter exponential
backoff (500ms base → 4s cap). Shields SDK users from the ~3s cold-start
gap when sharp-api-go restarts during deploys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Python 3.9 reached EOL 2025-10. The package declared 3.9 support but has
never actually worked on 3.9 — models.py uses `int | float` union syntax
which Pydantic evaluates at runtime and which fails on 3.9. Main-branch
CI has been red on 3.9 since the initial release.

Rather than adding a runtime dependency (eval_type_backport) or rewriting
all PEP 604 unions, drop 3.9 from the test matrix and bump floors in
pyproject.toml (requires-python, classifiers, ruff target-version,
pyright pythonVersion).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Mlaz-code Mlaz-code merged commit 2ee5873 into main Apr 19, 2026
@Mlaz-code Mlaz-code deleted the sha-1994-sdk-retry branch April 19, 2026 16:58
Mlaz-code added a commit that referenced this pull request May 7, 2026
* feat: retry 502/503/504 with jittered backoff Sync + async HTTP clients now retry up to 3 times on transient upstream
failures (502/503/504 or connect/read errors) with full-jitter exponential
backoff (500ms base → 4s cap). Shields SDK users from the ~3s cold-start
gap when the SharpAPI server restarts during deploys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: drop Python 3.9 support Python 3.9 reached EOL 2025-10. The package declared 3.9 support but has
never actually worked on 3.9 — models.py uses `int | float` union syntax
which Pydantic evaluates at runtime and which fails on 3.9. Main-branch
CI has been red on 3.9 since the initial release.

Rather than adding a runtime dependency (eval_type_backport) or rewriting
all PEP 604 unions, drop 3.9 from the test matrix and bump floors in
pyproject.toml (requires-python, classifiers, ruff target-version,
pyright pythonVersion).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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