fix: making rate limit a warning instead of error (#14753)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Douglas Yang
2025-12-09 13:41:09 -08:00
committed by GitHub
parent 8b0b6a45c8
commit 7c6fb3aa2d

View File

@@ -8,6 +8,7 @@ import json
import os
import sys
import time
import warnings
from urllib.error import HTTPError
from urllib.request import Request, urlopen
@@ -338,6 +339,15 @@ def publish_traces(traces_dir, run_id, run_number):
is_retryable = True
error_type = f"HTTP {e.code}"
# Check for rate limit errors (non-fatal - just warn and skip)
if (
isinstance(e, HTTPError)
and e.code in [403, 429]
and "rate limit exceeded" in getattr(e, "error_body", "").lower()
):
warnings.warn("GitHub API rate limit exceeded. Skipping trace upload.")
return
if is_retryable and attempt < max_retries - 1:
print(
f"Attempt {attempt + 1}/{max_retries} failed ({error_type}). Retrying in {retry_delay} seconds..."