fix runtime heartbeat API retries#133
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR Review✅ Merge allowed: 1 finding(s) reported but none are blocking ℹ️ Other Findings1. 🟡 [MEDIUM] Reliability in
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe398aa821
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not retryable or attempt == _GITHUB_API_MAX_ATTEMPTS: | ||
| raise | ||
| retry_error = exc | ||
| except urllib.error.URLError as exc: |
There was a problem hiding this comment.
Retry direct socket timeouts from urlopen
When the GitHub endpoint stalls past the explicit 20-second timeout, CPython's urlopen can raise TimeoutError directly rather than wrapping it in URLError. That exception bypasses both retry handlers here, so a transient read/connect timeout still terminates the heartbeat immediately and produces the same false alert this retry logic is meant to avoid.
Useful? React with 👍 / 👎.
| retryable = exc.code in _RETRYABLE_HTTP_STATUSES | ||
| if not retryable or attempt == _GITHUB_API_MAX_ATTEMPTS: | ||
| raise |
There was a problem hiding this comment.
Retry GitHub rate-limit 403 responses
GitHub can report primary or secondary rate-limit exhaustion with HTTP 403 (distinguishable from authorization failures by rate-limit/Retry-After headers), but this status is treated as permanently non-retryable. In that rate-limit case the heartbeat fails without an alert message instead of waiting and retrying, even though the API request will become valid again.
Useful? React with 👍 / 👎.
What changed
Why
The Runtime Heartbeat failed when GitHub returned a transient HTTP 503 while listing workflow runs. The request had no retry handling, so a short GitHub service interruption caused a false heartbeat failure even though Runtime itself remained healthy.
Validation