Repository navigation
Skip the targeted job instead of failing it when the GitHub API fails during test selection - #126783
Conversation
The targeted stateless and integration jobs read the pull request, its diff and, on a rerun, the start of the attempt from the GitHub API with one bare `requests.get` each. A GitHub 5xx, a network error or a rate limit raised out of the selection and ended the job `ERROR` before any test ran, which also skips every job that waits for the core blocking jobs (e.g. ClickHouse#76867: `500 Server Error` from `compare/<base>...<sha>`; 6 such jobs in 30 days in CIDB: compare 500 x3, `pulls/<N>` read timeout x2, `pulls/<N>` 403 rate limit x1). All three reads now go through `Targeting._github_get`, which retries for `github_retry_sec` (180 s, the "retries up to 3 minutes, then skip" policy of the CIDB reads) on HTTP >= 500, on `422 The diff is taking too long to generate` (GitHub serves a large diff to a later request: measured 422, 422, then 200 for a 193 MB range), and on connection, timeout and chunked-encoding errors. A rate limit (429, or a 403 with `x-ratelimit-remaining: 0` or "rate limit" in the body) is not retried, as GitHub asks not to retry before the limit resets. When the reads keep failing it raises `GitHubUnavailableError`, and both targeted jobs treat it like `CIDBTimeoutError`: `SKIPPED`, not cached, with a workflow warning and a comment. The strict wrapper of the previously failed tests re-raises it, so the rerun cutoff read is not turned into a generic `RuntimeError`. Any other HTTP error and the head-SHA guard still end the job `ERROR`. Related: ClickHouse#76867 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261019-193700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261019-191400 |
|
cc @fm4v, could you review this and add the |
|
Workflow [PR], commit [2db0c5d] Summary: ✅ AI ReviewSummaryThe PR retries transient GitHub API failures during targeted test selection and reports exhausted retries or rate limits as uncached Final VerdictStatus: ✅ Approve |
The `broken_links` style check cuts `https://api.github.com/repos/{repo}/{path}` at the first `{` and probes `https://api.github.com/repos/`, which is a 404. The URL is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ough-previously-failed-lookup Resolve the conflict in get_previously_failed_tests_with_info: the strict lookup re-raises both CIDBTimeoutError (this PR) and GitHubUnavailableError (ClickHouse#126783), so the targeted job skips when either CIDB or GitHub is unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #76867
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A targeted stateless or integration job now retries the GitHub API reads of its test selection for up to 3 minutes and is then skipped, not errored, when GitHub keeps answering with a server error, a network error, a rate limit, or a diff that is still being generated.
Description
The targeted jobs read the pull request, its diff and, on a rerun, the start of the attempt from the GitHub API with one
requests.geteach, without a retry. Any GitHub error ended the jobERRORbefore a test ran, which also skips the jobs that wait for it. Example, as reported in #76867 (comment): https://s3.amazonaws.com/clickhouse-test-reports/PRs/76867/4a5edeeaabdf6986907e20c646088d0c29f2227d/pr/stateless_tests_arm_asan_ubsan_targeted/job.log (500 Server Errorfromcompare/<base>...<sha>). In the last 30 days CIDB has 6 such jobs on 5 PRs:compare500 x3,pulls/<N>read timeout x2,pulls/<N>403 rate limit x1. The samecomparerequest for #76867 returns 200 now, so that one was transient.A large diff fails differently:
compareanswers422 The diff is taking too long to generate.and serves it to a later request (I measured 422, 422, then 200 for a 193 MB range).The three reads now go through
Targeting._github_get. It retries for 3 minutes (github_retry_sec, the same budget the CIDB reads got in review of #125613) on HTTP >= 500, on that 422, and on connection, timeout and chunked-encoding errors. A rate limit is not retried, because GitHub asks not to retry before the limit resets. If the read still fails, it raisesGitHubUnavailableError, and both targeted jobs handle it likeCIDBTimeoutError:SKIPPED, not cached, with a workflow warning and a comment. Other HTTP errors and the head-SHA check still end the jobERROR.Validation, local: master vs this change with mocked
requests.getand a fake clock (5xx, 422, network errors, rate limits, the rerun cutoff), and against the real GitHub API. On a 14-weekcomparerange, GitHub answered 422 and 502 for 3 minutes, then the read raisedGitHubUnavailableError.test_selection_smokepasses.Workflow [PR]
Sync PR [sync-upstream/pr/126783]
Version info
26.11.1.466-master(included in26.11and later)