Bug: GitHub rate-limit handling sleeps up to 1h but never retries the failed request
Author: rajarshidattapyCreated Sep 12, 2026Updated Sep 12, 2026
Description
When X-RateLimit-Remaining drops below 10, _fetch_github_api sleeps until the reset time (capped at 1 hour), but then just returns the response it already received. The request is never re-sent:
https://github.com/interviewstreet/hiring-agent/blob/70fd3ea/github.py#L63-L113
if remaining < 10 and rate_limit_reset:
...
time.sleep(wait_seconds)
print(f"✅ Rate limit should be reset now. Continuing...")
...
data = response.json() if response.status_code == 200 else {}
return status_code, dataSo when the limit is actually exhausted (403/429 with remaining == 0):
- The run blocks for up to an hour, prints "Continuing...", and then returns
(403, {})anyway. fetch_github_profileprintsGitHub API error: 403 - {}, and enrichment is lost despite the wait.- Or
fetch_repo_contributorsreturns[], so the repo getscontributor_count = 0andauthor_commit_count = 0and is dropped fromgenerate_projects_json.
Separately, when the request succeeded but remaining is between 1 and 9, it still sleeps up to an hour before returning perfectly good data. Unauthenticated users (60 req/hour) hit this after ~50 repositories.
(#9 covers GitHub API reliability broadly; this is the specific wait-without-retry logic added since.)
Expected
- On 403/429 with
remaining == 0, wait until reset and retry the request (bounded attempts). - On a successful response, return immediately. Only throttle before the next request if needed.
Source: interviewstreet/hiring-agent