Repository navigation
feat: add rate limiting and 429 retry for API requests - #6
Merged
Merged
Conversation
When ListCommits returns an error (network, auth, rate limiting), repos are now classified as "failed" instead of being silently marked "abandoned". Failed repos are excluded from code percentage calculations in the health summary to avoid skewing active/maintained/abandoned ratios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Switch from PRIVATE-TOKEN header to Authorization Bearer for GitLab API requests, and use `glab config get token` instead of `glab auth token` for CLI token retrieval. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Write a <report>.error.log file (e.g., report.error.log) next to the JSON report when API errors occur. Each line is prefixed with a category ([health], [health-details], [ai-estimate], [ai-estimate-detail]) for easy filtering with grep. Also adds RepoHealth.Error field to surface failure reasons in JSON output, and propagates partial errors from AnalyzeDetails and Estimate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add RateLimitTransport (http.RoundTripper) with configurable rate limiting and automatic retry on 429 responses with exponential backoff. Pass shared *http.Client to all provider constructors via --rate-limit CLI flag. Tested against 399-repo GitLab group: 0 rate limit errors (previously 867). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
RateLimitTransport(http.RoundTripper) with configurable token-bucket rate limiting and automatic retry on 429 responses with exponential backoff /Retry-Afterheader support--rate-limitCLI flag (default 0 = unlimited, retry-only) for bothanalyzeandtrendscommands*http.Clientto all provider constructors (GitLab, GitHub, Bitbucket) so rate limiting applies globallyTest results
Tested against
digital-science/dimensions/grantsGitLab group (399 repos):--rate-limit 3): 0 rate limit errors, 306 remaining errors (305 x 401 auth, 4 x 502 server — unrelated to rate limiting)Test plan
go test ./...passes--rate-limit 3--rate-limit 0(default, retry-only mode)🤖 Generated with Claude Code