Merge pull request #58531 from NousResearch/salvage/3033-contents-api-retry

fix(skills): retry rate-limited Contents API directory listings (salvage #3033)
This commit is contained in:
Teknium 2026-07-05 00:45:29 -07:00 committed by GitHub
commit d51657c0c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -909,12 +909,13 @@ class GitHubSource(SkillSource):
def _download_directory_recursive(self, repo: str, path: str) -> Dict[str, str]:
"""Recursively download via Contents API (fallback)."""
url = f"https://api.github.com/repos/{repo}/contents/{path.rstrip('/')}"
try:
resp = httpx.get(url, headers=self.auth.get_headers(), timeout=15, follow_redirects=True)
if resp.status_code != 200:
logger.debug("Contents API returned %d for %s/%s", resp.status_code, repo, path)
return {}
except httpx.HTTPError:
# Route through _github_get so directory listing gets the same
# 429/403-rate-limit retry + backoff as file fetches (#3033).
resp = self._github_get(url)
if resp is None:
return {}
if resp.status_code != 200:
logger.debug("Contents API returned %d for %s/%s", resp.status_code, repo, path)
return {}
entries = resp.json()