GH-84: refactor(util): generalize github retry into sdk/util/retry with typed RateLimitError/AuthError#88
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
RateLimitErrorwith Retry-After parsing (sdk/integrations/github/errors.go:13,37) honored byWithRetry(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
sdk/util/retry: move/generalizeWithRetry, typedRateLimitError{RetryAfter}, and add typedAuthError(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".sdk/integrations/githubto consumesdk/util/retry(behavior-preserving; keep Retry-After and X-RateLimit-Reset parsing in the github package as its classifier).RetryAfterwhen present (preserve current github semantics).Acceptance
sdk/util/retrywithWithRetry,RateLimitError,AuthError; table-driven tests incl. Retry-After honoring, max-attempts, AuthError short-circuitsdk/integrations/githubsdk/core/api.goldenuntouched (new package is outside the core lock)Refs
.agent/system/saas-asset-research.md§ studio-sdk + verification appendix