Skip to content

Do not fail Build profile diff when the CI logs cluster read fails transiently - #120121

Closed
groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:build-profile-diff-skip-on-transient-cluster-read
Closed

groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:build-profile-diff-skip-on-transient-cluster-read

Conversation

@groeneai

@groeneai groeneai commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #117375
Related: #119039
Related: #115706

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

A Build profile diff read that fails only with server errors or timeouts is now a skipped comparison with a pinned comment saying it did not run.

Description

Authorised in #115706 (comment) .

Build profile diff reds a commit when the shared CI logs cluster cannot answer, sending a contributor to an uninvolved diff. The endpoint's own memory limit refuses the query: Code: 241 ... OvercommitTracker decision: Query was selected to stop. Job-level rows on the public CI database today, through 17:50 UTC: 79 failures against 141 successes over 75 pull requests, with no success after 13:46:49. Earlier: 160 against 167 on 09-07, and 16 to 25 a day on 09-08, 09-13 and 09-14.

select raises TransientReadFailure when every observed failure was a >= 500 or a requests.exceptions.Timeout; main turns that into SKIPPED with a pinned comment saying so. The result is not cached, so a later run retries, and skips stay countable: checks rows with check_name = 'Build profile diff' AND check_status = 'skipped', 0 over 30 days.

The readiness probe is now classified the same way. It used to return a bare False and print No connection to LogCluster with neither status nor body, so a run that failed there was red with nothing to attribute it to. It prints both now, and a >= 500 or a timeout there is transient. One readiness failure vetoes the skip, so of today's six failing legs none would have skipped before this round.

observed failures outcome
only 5xx and timeouts, retries exhausted skipped, comment says it did not run
a 403, or any other non-5xx refusal red
a non-timeout exception, or a probe answering something other than 1 red
the comment did not post red

Db.query untouched, do_query still fail-closed. Overlaps my open #118708 , which rewrites select's tail; whichever merges second rebases.

The two failure shapes, from the job logs

Three of today's six failing legs between 13:50 and 14:30 UTC lost all eight attempts at the probe, and three mixed both shapes. After this round a leg skips once its probe is seen to answer a >= 500, which is what this pressure returns.

091c46e6 of pull request 119039: the probe passed and one select call lost all 8 attempts.

20:01:53  WARNING: LogCluster select failed with exception  requests.exceptions.ReadTimeout (read timeout=60)
20:02:44  WARNING: LogCluster select failed with code 500
          ... 4 more timeouts and 2 more 500s ...
20:10:39  ERROR: Failed to select from LogCluster ... "Code: 241 ... (MEMORY_LIMIT_EXCEEDED)"
20:10:40  RuntimeError: CI logs cluster query failed: SELECT file, library,

22a87338 of pull request 117375: the shape this round adds. All 8 attempts died at the probe, so the query was never sent, and the log says nothing about why.

13:57:28  ERROR: No connection to LogCluster
13:57:28  WARNING: LogCluster not ready
          ... 7 more pairs at 13:57:33, :43, :58, 13:58:18, :43, 13:59:13, :48 ...
14:00:30  RuntimeError: CI logs cluster query failed: SELECT count() AS c FROM binary_sizes

Counted in that log: 8 readiness failures, 0 select-level failures, 0 connection exceptions. The gaps are the 5*(retry+1) backoff. Source: https://s3.amazonaws.com/clickhouse-test-reports/PRs/117375/22a87338ef8d1310b668becc4d00e9121f07d157/pr/build_profile_diff/job.log


Workflow [PR]
Sync PR [sync-upstream/pr/120121]

groeneai and others added 2 commits September 15, 2026 04:23
…ansiently

Since 2026-09-13 20:00 UTC this check has 45 error legs over 42 pull requests
against 380 successes, and 27 of those errors, over 24 pull requests, are one
read failing in compare_compile_times. The read is not refused. On 091c46e a
single LogCluster.select call lost all eight attempts between 20:01:53 and
20:09:59, five to a 60 s client read timeout and three to an HTTP 500, the last
carrying

  Code: 241. DB::Exception: (total) memory limit exceeded: would use 212.51 GiB
  ... maximum: 212.40 GiB. OvercommitTracker decision: Query was selected to
  stop by OvercommitTracker. (MEMORY_LIMIT_EXCEEDED)

That is the shared read-only endpoint's server-wide limit rather than this
query's own, so the query was the OvercommitTracker's victim, and the check
still reported the failure against the pull request's commit. is_ready's
SELECT 1 passed before each of the eight attempts, so the endpoint was
reachable throughout.

select already separates the two failure classes inside its retry loop: it
retries >= 500 and request exceptions with a growing backoff, and breaks
immediately on any other non-ok status, which is the branch a 403 ACCESS_DENIED
takes. It then collapses both terminal states into one return None, so Db.query
cannot tell a query the server will refuse again from a cluster that was over
its memory limit for the ten minutes it kept asking, and main's single
except Exception turns both into a red check whose pinned comment names the
commit. The classification exists at the seam; it does not travel. It now does,
as TransientReadFailure, raised only when every observed failure of the loop was
a >= 500 or a requests.exceptions.Timeout.

The predicate is fail-closed rather than "a 5xx was seen somewhere": two
write-once flags are tracked, one for the authorised outcomes and one for every
other observed failure, and the raise is guarded on the second being unset. A
403, any other non-5xx refusal, a connection reset, a failed readiness probe,
and any mixture of those with a 5xx therefore all keep the job red. The
readiness failure is deliberately in that group even though the ruling does not
require it: is_ready also returns False for a refused SELECT 1, so admitting it
would green a credential failure. That costs the observed case nothing, since
the job log carries no readiness failure at all.

main presents that one class as a comparison that did not run: SKIPPED, which
maps to a successful GH status, is skipped by the mergeable aggregation, and
lands in cidb as check_status = 'skipped', so how often it fires is countable
from outside. The skip is conditional on the pinned comment actually saying so,
and that is enforced rather than assumed. The skip path does not pass
only_update, because post_updateable_comment posts nothing when it is set and no
tagged comment exists, and this job is the only writer of that tag;
update_comment now reports whether the comment is in place, and the skip
re-raises when it is not, so a SKIPPED leg with nothing explaining it is
unreachable. A local run re-raises with its traceback as before.

Authorised in
ClickHouse#115706 (comment) ,
where a 403 was ruled to stay red and a 5xx or a timeout was allowed to skip the
comparison as long as the pinned comment says the comparison did not run, with
no unconditional skip. I said in that thread that I would add it the first time
a transient read actually exhausted the retries; this is that case.

Out of scope on purpose: the query is unchanged, Db.query is untouched, and
do_query, the INSERT transport, keeps failing closed, because its callers assert
on its return value and a silently dropped upload corrupts every later baseline.

Validated with a throwaway harness rather than a committed test, since nothing in
the tree executes ci/tests: thirteen cases over scripted transport outcomes,
including the recorded eight-attempt sequence of the failing call, each case
killed by at least one of eleven mutation controls. Both directions were measured
with the same harness, which resolves the new exception dynamically so that it
also runs against master.

Co-Authored-By: Claude Opus 5 <[email protected]>
…it observes

Result.Status.SKIPPED is inside Result.is_ok(), and the runner posts a praktika
cache success record for any is_ok() result that does not ask it not to. That
record is keyed on (job name, job digest), a later run with the same digest finds
it in cache_success_base64, and the generated workflow condition then drops the
job from the run entirely. So the previous commit's skip, which is a verdict about
the health of a shared read-only endpoint, would have been stored as a verdict
about the content: one memory-pressure spike would have skipped the comparison
permanently for that digest, no re-run could have recovered it, no cidb row would
have recorded it, and the pinned comment would have kept saying the comparison did
not run for a commit nobody tried to compare again. On master the same failure is
red, uncached, and recoverable by re-run, so that was a regression rather than a
gap, and it contradicted the word transient.

The skip therefore completes with do_not_cache=True. The other three completions
of this job stay cacheable: not-a-pull-request, no profile data, and a real
comparison are all verdicts about the content, and reusing them for an identical
digest is the existing design. A digest hashes the checkout and the submodule
revisions; it cannot hash whether a shared cluster was over its memory limit ten
minutes ago, which is the same reasoning the bugfix-validation job records for its
own do_not_cache.

The classifier's second flag is renamed from unapproved to non_transient. Nothing
in this file approves anything, so the old name only parsed if the reader already
knew which outcomes a maintainer had authorised elsewhere; its sibling is named
for what it observes and this one now is too. Pure rename: same two write-once
flags, same fail-closed AND, same behaviour.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 15, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Two rounds. Round 1 on 5b4db851b78b: an independent model (engine: codex, 1 finding) plus my own cold
read of the resulting code (4 findings, 1 of them the same defect). Round 2 on 85a8590d564cd, after
the fix: 0 findings from either.

# Sev Finding Verdict Evidence / action
1 ❌ The transient SKIPPED result is cached as a praktika success, so a later run with the same job digest is dropped and the comparison never retries AGREE, fixed @ 85a8590d564cd Raised independently by the gate and by my own review. SKIPPED is inside is_ok() (ci/praktika/result.py:228), runner.py:1090-1093 caches every is_ok() result, and yaml_generator.py:250 then drops the job outright: no comparison, no CIDB row, no comment refresh, and unrecoverable by re-run, which master's ERROR path is not. Completed with do_not_cache=True, matching ci/jobs/unit_tests_bugfix_validation_job.py:711. Verified through the runner's result rebinding at runner.py:1539, which re-reads the dumped result, so ext["do_not_cache"] really reaches the one cache-write gate
2 💡 unapproved names a concept that exists only outside the code, so both of its comments have to work around the word AGREE, fixed @ 85a8590d564cd Renamed to non_transient, which is what the predicate tests and matches its sibling transient
3 💡 The skip comment says "see the job log" without linking the job report, and the check is now green Noted, not blocking build_comment wraps get_job_report_url in try/except because it can fail, so a link here costs a guard plus a branch; minimality wins on this diff
4 💡 The job's digest_config omits ci/jobs/scripts/log_cluster.py, which the sibling stateless-test config includes Noted, not blocking Pre-existing, and bounded: with finding 1 fixed the only cached records are real comparisons, whose validity does not depend on the transient classifier

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per
finding; there were none in either round. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-review-slot-8:20260915-051700

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 15, 2026
@groeneai
groeneai requested a review from leshikus September 15, 2026 05:39
@clickhouse-gh

clickhouse-gh Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fad3849]

Summary: ✅


AI Review

Summary

This PR teaches Build profile diff to treat log-cluster reads that fail only with >= 500 responses or timeouts as a skipped comparison, while keeping non-transient refusals red and preventing the skipped result from entering the Praktika job cache. I read the current diff, the full touched files, the existing review thread, and the top-level PR discussion, and I did not find an unresolved correctness issue in the current revision. The remaining risk is that the transient/non-transient split is validated by ad-hoc harnessing rather than an in-tree automated test.

Final Verdict

Status: ✅ Approve

LLVM Coverage Report

⚠️ No coverage measurement for commit fad3849: incomplete coverage measurement: 16 of 21 shard profiles are missing: LLVM_COVERAGE_FILE_ft_2.profdata, LLVM_COVERAGE_FILE_ft_3.profdata, LLVM_COVERAGE_FILE_ft_s3_async_sequential.profdata, LLVM_COVERAGE_FILE_ft_s3_db_repl_parallel_2.profdata, LLVM_COVERAGE_FILE_ft_s3_db_repl_parallel_3.profdata, LLVM_COVERAGE_FILE_ft_s3_db_repl_sequential_1.profdata, LLVM_COVERAGE_FILE_ft_s3_db_repl_sequential_2.profdata, LLVM_COVERAGE_FILE_ft_s3_sequential.profdata, LLVM_COVERAGE_FILE_it_1.profdata, LLVM_COVERAGE_FILE_it_2.profdata, LLVM_COVERAGE_FILE_it_3.profdata, LLVM_COVERAGE_FILE_it_4.profdata, LLVM_COVERAGE_FILE_it_5.profdata, LLVM_COVERAGE_FILE_it_6.profdata, LLVM_COVERAGE_FILE_it_7.profdata, LLVM_COVERAGE_FILE_it_8.profdata.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 15, 2026
if not posted:
# The skip is only legitimate while the comment says the comparison
# did not run, so an unposted comment stays a failure.
raise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If GH.post_updateable_comment fails here after a previous run already wrote the tagged build-profile-diff comment, this raise exits main before the generic except Exception block below can refresh that existing comment. The check goes red, but the pinned PR comment can still show the previous commit's comparison, which is the same stale-comment case the red path is otherwise trying to prevent. Can this fall through to the failure-comment update (or update the existing tagged comment with the failure text) before re-raising?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The control-flow reading is right: a bare raise inside one except clause never enters a sibling clause of the same try, so the generic updater below does not run. What it misses is that the refresh has already been attempted one call earlier, at the same seam.

The arm calls update_comment(...) with no only_update, so post_updateable_comment lists the PR comments, finds the tagged one left by the earlier commit and PATCHes it (ci/praktika/gh.py:1167-1174). posted is falsy only when that attempt failed, and by the failure classes in that file a fall-through repeats the attempt rather than adding a missing one:

  • the listing came back empty or unparseable (gh.py:1097-1110): the fall-through lists again through the same helper;
  • credentials, permissions or validation (gh.py:573-581): do_command_with_retries breaks out early, so repeating it changes nothing;
  • a transport error: that call already spent MAX_RETRIES_GH = 3 retries with a 4/8/16 s backoff (ci/praktika/settings.py:43);
  • no tagged comment exists: only_update=True finds nothing, warns and returns None (gh.py:1182-1185), and there is no stale comparison to replace either.

So the extra call helps only when a transport error clears in the seconds between the two writes. It is also not a regression: on master the same read raises at build_profile_diff_job.py:234, and that arm makes exactly one write attempt too, so the count is unchanged and only the text differs. I am keeping the single attempt. If a reviewer prefers the second one regardless, it is three lines and I will add it.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 15, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

The comparison did not run: every attempt of the read failed with a server error or a timeout. Commit fad38495c6dcffc86c3229253391ca042daf27af was not compared with master.

See the job log for details.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 85a8590

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Error message in clickhouse-server.log (see upgrade_error_messages.txt) error-message leak, not from this diff (which touches only ci/jobs/build_profile_diff_job.py and ci/jobs/scripts/log_cluster.py): the log grep flags a deliberate <Error> line, StorageFileLog (test_1.filelog_bad_path_attach): The absolute data path should be inside user_files_path, emitted by the relaxed-reattach branch in StorageFileLog.cpp when that fixture table survives the upgrade restart instead of being dropped first. 5 distinct PRs carry this exact signature in 14 days and 0 true-master runs do #113983 (mine, open)

Mergeable Check and PR are the two praktika aggregators. Both report exactly this one job (Mergeable Check says "Failed: Upgrade check (amd_release)") and neither carries an independent failure. The rest of this head is green: 172 check runs finished as 97 success, 74 skipped, 1 failure, and Style check (Failures: 0/15) and CH Inc sync are both green commit statuses.

Session id: cron:our-pr-ci-monitor:20260915-103126

The previous commit put every readiness failure in the non-transient group and
said that cost the observed case nothing, since the job log of the failing call
carried no readiness failure at all. That clause is now false, and it was the
weakest part of the classifier.

On 22a8733 of pull request 117375 the readiness gate is the only thing that
failed. The log holds eight "ERROR: No connection to LogCluster", eight
"LogCluster not ready", zero select-level failures and zero connection
exceptions, from 13:57:28 to 13:59:48 with gaps of 5, 10, 15, 20, 25, 30 and
35 s: one select call losing all eight attempts at the gate, so the query itself
was never sent. Then RuntimeError: CI logs cluster query failed: SELECT count()
AS c FROM binary_sizes at 14:00:30, on a commit whose CI was otherwise green.
39e4658 of 119335 and 1b0371b of 113506 are that shape to the count,
in the same hour. The three remaining failing legs of that hour, 0e6a31d of
76867, 2f40e4c of 104510 and 3a708dc of 116569, carry both shapes at
once, and a single readiness failure vetoes the skip, so the classifier as it
stands would have skipped none of the six.

is_ready cannot say which failure it saw. It returns a bare False for six
different outcomes, and on a non-ok response prints "No connection to LogCluster"
with neither the status nor the body, naming a failure that did not happen: with
zero connection exceptions in those logs the endpoint answered every probe inside
the 3 s timeout, and answered it with an error status. Which status is exactly
what the classifier needs. MEMORY_LIMIT_EXCEEDED does not appear in
exceptionCodeToHTTPStatus at all, so it falls through to
HTTP_INTERNAL_SERVER_ERROR, while ACCESS_DENIED and AUTHENTICATION_FAILED are in
the HTTP_FORBIDDEN block and SOCKET_TIMEOUT maps to HTTP_SERVICE_UNAVAILABLE. The
pressure that refuses SELECT 1 is therefore a 5xx and the grant failure that must
stay red is a 403; one integer separates them, and it was being discarded.

is_ready now returns Readiness(ready, transient) and select routes a readiness
failure by that flag, which is the rule it already applies to the POST. This
stays inside the ruling in 115706, which is phrased on the failure class rather
than on which request carried it: a 403 stays red, a 5xx or a timeout may skip as
long as the pinned comment says the comparison did not run, and there is still no
unconditional skip. Nothing else moves. A missing url or password stays red,
because a configuration break recurs on every retry; an ok status whose body is
not 1 stays red, because the server answered; a non-Timeout exception stays red,
symmetric with select's own POST arm; and any mixture containing one of those
still vetoes the skip.

The return type is a frozen dataclass with __bool__ rather than a tuple, because
do_query's "if not self.is_ready()" is deliberately untouched. Writes must fail
closed, its callers assert on the result, and a non-empty tuple is always truthy,
so a tuple would silently invert that gate and upload into a cluster that had
just refused the probe. do_query gains the better diagnostic for free, since the
print lives in is_ready.

The probe's body is printed bounded to 500 characters. A ClickHouse error puts
the code and the message first, so the bound hides no cause: the probe-shaped
Code 241 body is 697 characters and its maximum: clause is inside the first 500.
A proxy error page is bounded by nothing, and this prints once per attempt, up to
eight times, into a job log that is 50 kB in total.

The comment saying a readiness failure cannot be attributed to pressure is
deleted along with the limitation it described.

Verified against a fake endpoint driven through the CI_LOGS_HOST seam and run
against both this file and its parent commit's: seven scenarios, of which exactly
the two this change claims flip, every request answering 500 and a probe stalling
past its 3 s timeout, and five do not, a 403, a read 500, a read 400, a healthy
endpoint, and a probe answering 500 then 403. Db.query raises RuntimeError before
and TransientReadFailure after. At the production retries=8 the loop spends 180 s
and records 8 of 8, matching the artifact.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Third round, on the readiness-probe commit. An independent model (engine: codex) reviewed the
whole diff against master and returned 0 findings, having read both files in full, traced the
callers through Result, the job cache, CIDB and the comment path, and exercised the contract
with its own mock harness. My own cold read of the resulting code, done before that gate ran and
before reading the implementation notes, found five things. None is a defect in ci/; two are
claims in the description that its own cited source refutes, and I corrected those before
publishing rather than shipping them.

# Sev Finding Verdict Evidence / action
1 ⚠️ The description claimed this check fails "0 to 2 a day" in the background. The series it cites says otherwise AGREE, corrected before publication Public CI database, same predicate: 3, 0, 1, 0, 2, 0, 160, 16, 4, 1, 7, 3, 17, 25, 79 for 09-01 to 09-15. Six of fourteen days exceed 2. The description now carries the measured series
2 ⚠️ The rewritten description had dropped the line saying how a skip is counted, which is the answer to the strongest objection here: a skip is a green check, so a cluster that stays broken would go unnoticed AGREE, restored checks rows with check_name = 'Build profile diff' AND check_status = 'skipped', 0 over 30 days, is back in the description, next to the fact that the result is not cached and the pinned comment says the comparison did not run
3 💡 "48 failures against 141 successes at 16:14 UTC" did not reproduce (49 / 141) and understated an outage that was still running AGREE, replaced 79 failures against 141 successes today through 17:50 UTC, with no success after 13:46:49
4 💡 select's docstring calls a connection error transient, while the new classification counts only a 5xx or a timeout as transient for the raise noted, not blocking Both statements are true of their own subject, and the commit message states the rule exactly. Not worth a push that changes no behaviour
5 💡 The failed to retrive url guard in is_ready is unreachable, because an empty secret still yields the truthy "https://" noted, not blocking, pre-existing Measured rather than argued: with that url the probe raises a non-timeout exception, so the run stays red either way. Outside this change's contract

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Checked in the tree rather than assumed, because each one could have made the change inert:
Readiness is falsy on failure, so do_query's write gate still fails closed; SKIPPED really is
a success end to end and do_not_cache=True really is honoured, so one pressure spike cannot
become a permanent skip through the job cache; and post_updateable_comment returns a real
boolean, so the if not posted: raise guard that keeps an unannounced skip red is live rather
than dead code.

Session id: cron:clickhouse-review-slot-10:20260915-174000

@azat azat self-assigned this Sep 17, 2026
@azat

azat commented Sep 17, 2026

Copy link
Copy Markdown
Member

Closed in favor of #118708

@azat azat closed this Sep 17, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 17, 2026
…ails, and skip if it is unavailable

`LogCluster.select` returned None for every kind of read failure and printed
only the last response's text, so its one caller could say no more than
"CI logs cluster query failed: <SQL>" and the reader had to open the job log to
find that the endpoint had answered `Code: 241 ... (MEMORY_LIMIT_EXCEEDED)`.

One shape was worse than a bad message. A failure raised after the status line
is already on the wire arrives in the body, in an `exception` field next to the
rows produced before it, and `response.ok` is true. Against a stub endpoint
answering `200` with that field and an empty `data`, master's `has_pr_data` gets
`[]`, the job posts "No arm_release build profile data for commit ..." and
completes OK: a failed read is a green check.

`select` now classifies every response with one module-level predicate - a body
that is a JSON object with a non-empty `exception`, otherwise a status that is
not ok - retries such an in-band failure like a 5xx, and raises `ReadFailure`
with the status and the cluster's own error. `Db.query` keeps no failure branch.

A cluster that cannot answer at all is not the commit's fault, so when every
observed failure was a `>= 500` or a `requests` timeout, `select` raises
`TransientReadFailure` and the job is SKIPPED with a pinned comment saying the
comparison did not run. One non-5xx refusal, a probe answering something other
than `1`, or a comment that did not post keeps the check red, so a 403 is still
a failure. The skip is not cached: the verdict is the cluster's health, which no
digest input captures, and a cached success would turn one pressure spike into
a permanent skip.

The readiness probe is classified the same way. It used to return a bare False
after printing `No connection to LogCluster` with neither status nor body, so a
run that failed there was red with nothing to attribute it to; it now prints
both, and a `>= 500` or a timeout there is transient like the read itself.

Requested in ClickHouse#115706 (comment)
and ClickHouse#118708 (review) .
Supersedes ClickHouse#120121 , closed in
favour of this one.

Co-Authored-By: Claude Opus 5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 19, 2026
…ails, and skip if it is unavailable

`LogCluster.select` returned None for every kind of read failure and printed
only the last response's text, so its one caller could say no more than
"CI logs cluster query failed: <SQL>" and the reader had to open the job log to
find that the endpoint had answered `Code: 241 ... (MEMORY_LIMIT_EXCEEDED)`.

One shape was worse than a bad message. A failure raised after the status line
is already on the wire arrives in the body, in an `exception` field next to the
rows produced before it, and `response.ok` is true. Against a stub endpoint
answering `200` with that field and an empty `data`, master's `has_pr_data` gets
`[]`, the job posts "No arm_release build profile data for commit ..." and
completes OK: a failed read is a green check.

`select` now classifies every response with one module-level predicate - a body
that is a JSON object with a non-empty `exception`, otherwise a status that is
not ok - and raises `ReadFailure` with the status and the cluster's own error.
`Db.query` keeps no failure branch.

A cluster that could not serve the read is not the commit's fault, so in that
case `select` raises `TransientReadFailure` and the job is SKIPPED with a pinned
comment saying the comparison did not run. Three observations mean the read was
not served: a `>= 500`, a `requests` timeout, and an error the server reports
after it has already committed an ok status, which is the condition a `>= 500`
reports when it happens before the status goes out. The two are the same event
seen at different points of one answer, so they are classified alike.

Anything else keeps the check red: a 403 or any other refusal (an `exception`
field does not make one transient, the committed ok status does), a probe
answering something other than `1`, a non-timeout connection failure, or a
comment that did not post. One such observation is enough, which is why the
classification needs no more than the one flag that records it. The skip is not
cached: the verdict is the cluster's health, which no digest input captures, and
a cached success would turn one pressure spike into a permanent skip.

The readiness probe is classified the same way. It used to return a bare False
after printing `No connection to LogCluster` with neither status nor body, so a
run that failed there was red with nothing to attribute it to; it now prints
both, and a `>= 500` or a timeout there is transient like the read itself.

Requested in ClickHouse#115706 (comment) ,
ClickHouse#118708 (review)
and ClickHouse#118708 (comment) .
Supersedes ClickHouse#120121 , closed in
favour of this one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants