mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix(skills): retry rate-limited Contents API directory listings
The Contents-API fallback's directory listing used a raw httpx.get with no retry, so a 429/403 rate limit aborted the whole skill download even though file fetches already retry via _github_get. Route the directory listing through the same helper (429/reset-aware backoff, 5xx retry, rate-limit flagging). Salvage of PR #3033's intent — rerouted through the _github_get helper that landed after the PR was opened, instead of the PR's ad-hoc retry loops. Co-authored-by: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com>
This commit is contained in:
parent
e670d9cdd6
commit
a0c90edf48
1 changed files with 7 additions and 6 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue