Skip to content

GH-84: refactor(util): generalize github retry into sdk/util/retry with typed RateLimitError/AuthError#88

Merged
alekspetrov merged 1 commit into
mainfrom
pilot/GH-84
Jul 13, 2026
Merged

GH-84: refactor(util): generalize github retry into sdk/util/retry with typed RateLimitError/AuthError#88
alekspetrov merged 1 commit into
mainfrom
pilot/GH-84

Conversation

@alekspetrov

Copy link
Copy Markdown
Contributor

Summary

Automated PR created by Pilot for task GH-84.

Closes #84

Changes

GitHub Issue GH-84: refactor(util): generalize github retry into sdk/util/retry with typed RateLimitError/AuthError

Context

SaaS pre-work S0.3. GitHub is the only connector with production-grade retry: typed RateLimitError with Retry-After parsing (sdk/integrations/github/errors.go:13,37) honored by WithRetry (sdk/integrations/github/retry.go:29-74,104). Linear and Jira have no equivalent — a sync engine polling multiple trackers per tenant needs uniform typed retry. This issue generalizes the machinery; per-connector adoption for Linear/Jira lands in follow-up issues.

Implementation

  1. New package sdk/util/retry: move/generalize WithRetry, typed RateLimitError{RetryAfter}, and add typed AuthError (non-retryable — callers park immediately). Error classification must be per-connector (each connector maps its provider's responses to the typed errors) — no centralized string matching like "status 429".
  2. Migrate sdk/integrations/github to consume sdk/util/retry (behavior-preserving; keep Retry-After and X-RateLimit-Reset parsing in the github package as its classifier).
  3. Backoff: exponential with cap, honors RetryAfter when present (preserve current github semantics).

Acceptance

  • sdk/util/retry with WithRetry, RateLimitError, AuthError; table-driven tests incl. Retry-After honoring, max-attempts, AuthError short-circuit
  • github connector green on existing tests with the shared package; no duplicated retry code left in sdk/integrations/github
  • No Linear/Jira changes in this issue
  • sdk/core/api.golden untouched (new package is outside the core lock)

Refs

  • Evidence: qf-studio/pilot .agent/system/saas-asset-research.md § studio-sdk + verification appendix

…d RateLimitError/AuthError

Extracts the exponential-backoff engine (WithRetry/WithRetryVoid, context
cancellation, Retry-After honoring) out of sdk/integrations/github into a new
stdlib-only sdk/util/retry package, alongside typed RateLimitError and AuthError.
Error classification stays per-connector: sdk/util/retry only recognizes the
typed errors by default (no centralized status-code string matching), and
sdk/integrations/github wires in its own isRetryableError/extractRetryAfter
classifiers (429/403-rate-limit, 5xx, network errors, GraphQL RATE_LIMITED)
via RetryOptions.Classify/ExtractRetryAfter. Behavior-preserving for github;
Linear/Jira adoption is a follow-up.
@alekspetrov
alekspetrov merged commit 18af85e into main Jul 13, 2026
3 checks passed
@alekspetrov
alekspetrov deleted the pilot/GH-84 branch July 13, 2026 18:39
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.

refactor(util): generalize github retry into sdk/util/retry with typed RateLimitError/AuthError

1 participant