Skip to content

Honour do_not_block_pipeline_on_failure for every non-ok job status - #114956

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/honour-non-blocking-flag-for-any-non-ok-status
Aug 21, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/honour-non-blocking-flag-for-any-non-ok-status

Conversation

@groeneai

@groeneai groeneai commented Aug 15, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #107115
Related: #109071

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):

...

Description

A job that sets do_not_block_pipeline_on_failure still blocked its whole downstream closure
whenever it ended ERROR rather than FAIL.

The two consumers disagreed. hook_html.py:224 gates on not result.is_ok(), so
dependees were correctly not marked DROPPED. runner.py:910 gated on result.is_failure(),
which is FAIL/XPASS only, so an ERROR was never exempted and the job emitted
pipeline_status=failure. Every dependent job's guard is
!contains(needs.*.outputs.pipeline_status, 'failure') over a transitive needs, so that one
token skips the entire closure.

The case that hits it: an integration shard exhausts its 7200 s parallel-phase budget and appends
a synthetic Timeout child while every real test passes. One non-ok child means
force_ok_exit = True, so the job declares itself non-blocking, but the same timeout sets the
error flag and set_error() makes the status ERROR. That skipped 107 of 175 results on #107115
and 112 of 177 on #109071, including all five Bugfix validation (*) jobs. Because those never
ran, new_tests_check.py read them as PENDING and failed Finish Workflow with "it's not
actually a regression test for the fix", reporting a timeout in an unrelated shard as a verdict on
the author's regression test. 8 occurrences across 8 PRs and 5 of the 6 shards in 30 days.

runner.py now uses the same predicate as hook_html, extracted so it is reachable from a test.
They have been asymmetric since the runner.py consumer was added in b35b5fd41f28412.
functional_tests.py:1527 passes the same flag after a path that can also end ERROR, so it is
fixed by the same line.

Merge-blocking is unchanged. ready_for_merge is computed from job.allow_failure alone
(native_jobs.py:1102-1117) and never reads this flag; all six shards are allow_failure=False,
so a failing shard still blocks the merge and still reports red. Only downstream dispatch changes.
new_tests_check.py is left as it is: its strict check is correct once the jobs actually run.

Validation

Every mutation below was applied to production code and the suite re-run.

arm mutation result
0 the fix 45 passed
A predicate reverted to is_failure() (pre-fix behaviour) 11 failed, incl. the end-to-end shard shape
B exemption made unconditional, flag ignored (negative control) 14 failed (every flag=False row)
C hook_html predicate drifted to is_failure() 1 failed (the agreement pin)
D output site re-derives the status inline, helper left unused 1 failed (the delegation pin)
E merge gate made to read the flag 1 failed (the merge-gate pin)
F emitted token hardcoded, or overridden after the call 1 failed each (the emit pin)

Arm B is what rules out a vacuous oracle: a test that ignored the flag would stay green. Arms D,
E and F each redden exactly one test, pinning the seams nothing else covers: the call site the
extraction created, the token actually emitted, and the merge computation the paragraph above
rests on.

The new test parametrizes every non-ok member of Result.Status (FAIL, ERROR, XPASS,
DROPPED, UNKNOWN, PENDING, RUNNING) and all three ok members against flag on/off, asserts
the two consumers reach the same verdict, reproduces the measured production shape (903 OK +
17 SKIPPED + 1 Timeout), and pins allow_failure=False on the six shards.

Full ci/tests: 972 passed / 31 skipped / 8 failed with the fix, versus 927 / 31 / 8 on pristine
runner.py. The same 8 pre-existing environment failures on both arms (clickhouse was not found in PATH); the delta is the new tests.

Exactly two production complete_job( call sites pass this flag, and both are covered by this
one line. The only other writer of pipeline_status is the config job's unconditional
success. The remaining is_failure() uses are test-level row filtering or rendering, not
job-level gating.

Version info

  • Merged into: 26.8.1.1812 (included in 26.8 and later)

groeneai and others added 3 commits August 15, 2026 12:13
A job that sets `do_not_block_pipeline_on_failure` still blocked its whole
downstream closure whenever it ended `ERROR` rather than `FAIL`.

The two consumers of the flag disagreed. `hook_html` gates on
`not result.is_ok()`, so dependees were correctly not marked `DROPPED`, while
`runner._post_run` gated on `result.is_failure()`, which covers `FAIL`/`XPASS`
only, so an `ERROR` was never exempted and the job emitted
`pipeline_status=failure`. Every dependent job's generated guard is
`!contains(needs.*.outputs.pipeline_status, 'failure')` over a transitive
`needs`, so that one token skips the entire closure. Both predicates were
introduced together in b35b5fd and have been asymmetric since.

The case that hits it: an integration shard exhausts its 7200s parallel-phase
budget and appends a synthetic `Timeout` child while every real test passes.
One non-ok child means `force_ok_exit = True`, so the job declares itself
non-blocking, but the same timeout sets the error flag and `set_error()` makes
the job-level status `ERROR`. That skipped 107 of 175 results on ClickHouse#107115 and
112 of 177 on ClickHouse#109071, including all five `Bugfix validation (*)` jobs. Because
those never ran, the `new_tests_check` post-hook read them as `PENDING` and
failed `Finish Workflow` reporting that the test is not actually a regression
test for the fix, so a harness timeout in an unrelated shard became a verdict
on the author's regression test. 8 occurrences across 8 PRs and 5 of the 6
shards in 30 days.

The predicate is extracted into `Runner._pipeline_status` so a test can assert
the production decision rather than a copy of it, following
`_skip_missing_optional_artifact` in the same file. `functional_tests` passes
the same flag after a path that can also end `ERROR`, so it is fixed by the
same line.

Merge-blocking is unchanged: `ready_for_merge` is computed from
`job.allow_failure` alone and never reads this flag, and all six shards are
`allow_failure=False`, so a failing shard still blocks the merge and still
reports red. Only downstream dispatch changes. `new_tests_check` is left as it
is, since its strict check is correct once the jobs actually run.

Co-Authored-By: Claude Fable 5 <[email protected]>
The suite asserted `Runner._pipeline_status` directly and nothing else, so the
seam the extraction created was untested: `_post_run` could stop calling the
helper and re-derive the status inline, and every test stayed green. That is the
regression this change exists to prevent, so it is now pinned at the call site.

The merge-safety property was pinned only by configuration. Asserting
`allow_failure is False` on the six shards is a fact about `job_configs`, not
about the merge computation, so flipping that config would have silently removed
the evidence for the claim that `ready_for_merge` never reads this flag. The
invariant is now asserted where it lives. Driving `_finish_workflow` itself was
rejected: it needs a live environment, S3, GH and workflow job data, so such a
test would re-implement the harness and assert its own copy.

Both use the `inspect.getsource` idiom already used elsewhere under `ci/tests`.

Mutating the call site to re-derive the status inline, and the merge gate to
read the flag, each redden exactly one of the two new tests and leave the other
44 green. That asymmetry is what shows the gaps were reachable rather than
theoretical.

Co-Authored-By: Claude Fable 5 <[email protected]>
The predicate that decides whether a non-blocking job skips its downstream
closure is only observable through the line that writes the GH Actions output.
The previous assertions pinned that the helper is called, so two mutations
restored the production failure while leaving the suite green: emitting the
literal "pipeline_status=failure" instead of the f-string, and overriding the
variable after the helper call. Both are verified to redden now, and only that
one test, while a benign refactor that merely prints the value stays green.

Test-only change. ci/praktika/runner.py, native_jobs.py and hook_html.py are
byte-identical to the previous commit.
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review

Three rounds: an independent cold read of the resulting code plus a second-model gate pass each
round, both without access to the implementation notes. Every finding was adjudicated against the
tree. The production change stayed byte-identical throughout; every remedy was additive test
coverage, and every mutation was applied to production code rather than to a copy. The final gate
pass returned no findings.

⚠️ The tests pinned the extracted predicate but not the call site that uses it - AGREED,
fixed. Every assertion called Runner._pipeline_status directly; nothing referenced _post_run
or the pipeline_status output. Restoring the old inline decision at the output writer while
leaving the helper defined kept all 43 tests green, so the exact regression this change prevents
was reachable with a green suite. Added a delegation pin plus a mutation arm that reverts the call
site and reddens only that test.

⚠️ The delegation pin still passed if the delegation survived but its result was discarded -
AGREED, fixed. Emitting a literal status, or reassigning the variable after the helper call, left
the helper called and the assertions satisfied while restoring the old behaviour. I verified both
mutations before prescribing anything. The emitted expression is now pinned and a hardcoded
verdict anywhere in the function fails the test, with a mutation arm for each case. I rejected a
stronger variant that counts assignments to the variable: it reddens on a benign added print,
which would be a brittle oracle.

⚠️ The merge-safety claim was pinned by configuration, not by the invariant - AGREED in part,
fixed differently. The existing test asserts allow_failure=False on the six shards, which is a
fact about the job configs. What needs guarding is the claim that merge readiness never reads
do_not_block_pipeline_on_failure, and that is now asserted directly, with a mutation arm that
adds such a read and reddens. I did not take the suggested route of driving the merge computation
from a unit test: it is 177 lines needing a live environment, S3, GitHub auth and workflow job
data, so the test would re-implement the harness and assert its own copy rather than the
production path.

⚠️ Two claims in the description were true of the base tree but not of the published one -
AGREED, both corrected. A call-site count and a line number went stale as the branch grew, and a
provenance sentence said both consumers were introduced by the same commit. The report-side
predicate in fact predates that commit by 40 days; the commit renamed the flag and added the
runner-side consumer. The count and line number are gone and the provenance sentence is corrected
against history.

💡 A behavioural test of the report-side dependee drop, and of the emitted output, instead of the
source pins
- disagreed. Those decisions sit inside a ~200-line hook and a 342-line method that
need a live environment, S3, CIDB and GitHub auth, so the same re-implementation objection
applies. The pins are not vacuous: each has a mutation arm that reddens it alone, and the idiom
has four precedents in ci/tests plus a sibling helper in the same file.

💡 The added docstring lines outnumber the added code lines - disagreed. Three of them replace
a pre-existing comment at the same decision (nine lines removed), so the ratio is an artifact of
extracting the predicate; each surviving line states a standing invariant with no reference to the
fix. The sibling helper in the same file has the same shape.

💡 A widening path outside the changed lines - checked and found contained, so not raised as a
finding. An artifact-upload failure can set the job status to ERROR after the non-blocking flag
was already recorded, which post-change would be exempted where it previously was not. Of the
ninety-five job configs that can carry this flag, twenty provide artifacts and all twenty provide
them as optional, whose only consumer is LLVM Coverage; a missing optional artifact is skipped
with a warning and never reaches that error path. The six shards in question provide no artifacts
at all.

No blocker was raised against the production change.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? YES. python3 -m pytest ci/tests/test_pipeline_status_non_blocking.py -v, 45/45, pure python, no server or build and no randomization. Before the test existed the divergence was reproduced at unmodified HEAD by rebuilding the measured shard shape and evaluating both consumers: is_ok=False is_failure=False flag=True gives runner.py failure while hook_html drops nothing.
b Root cause explained? YES. A session-timeout appends one child Result(name="Timeout", status=FAIL), so 0 < failures_cnt < 2 sets force_ok_exit=True and the job passes do_not_block_pipeline_on_failure=True. The same timeout sets the error flag, so set_error() makes the job-level status ERROR. runner.py:910 gated on is_failure() (FAIL/XPASS only, result.py:238-239), so an ERROR was never exempted and the job emitted pipeline_status=failure, which skips the transitive downstream closure (yaml_generator.py:271,320-334). Every link re-verified against the tree this session.
c Fix matches root cause? YES. The flag means "do not block on this non-ok result" and the predicate now reads exactly that, at the single site where the two consumers diverged. Nothing is widened, no timeout raised, no status special-cased. Four alternatives (balancer LPT, raising session_timeout_parallel or re-splitting 6 to 8, allow_failure=True, a bespoke "session-timeout with zero failures" predicate) were rejected with measurements; the last two would weaken the gate or duplicate an existing flag.
d Test intent preserved / new tests added? YES. No existing test changed, removed or weakened. New ci/tests/test_pipeline_status_non_blocking.py, 45 cases, asserting the production Runner helper directly rather than a copy of the predicate. The extraction follows Runner._skip_missing_optional_artifact in the same file, which exists for the same reason. Two of the cases pin the seams the rest are blind to: that the output site still delegates to the helper and emits its return value, and that the merge computation never reads this flag.
e Both directions demonstrated? YES, seven arms, each mutation applied to production code: fix = 45 passed; predicate reverted to is_failure() = 11 failed incl. the end-to-end shard shape; exemption made unconditional (negative control) = 14 failed; hook_html predicate drifted = 1 failed (the agreement pin); the output site re-deriving the status inline while the helper stays defined = 1 failed (the delegation pin); the merge gate made to read the flag = 1 failed (the merge-gate pin); the emitted token hardcoded, and separately overridden after the helper call, 1 failed each (the emit pin). The control is what rules out a vacuous oracle, and the last three pin the seams the other arms are blind to. A benign refactor that only prints the value stays green, so the emit pin is not brittle.
f Fix is general across code paths? YES, swept this session. Every complete_job( call site in ci/ was enumerated; exactly two pass this flag: integration_test_job.py:1522 (reported) and functional_tests.py:1527, whose result can also reach ERROR (child ERROR at :1117/1169 rolls up via create_from) and which the same line fixes. The only other pipeline_status writer is the config job's unconditional success. The remaining non-test is_failure() uses are test-level row filtering or rendering, not job-level gating; runner.py:613 is already status-agnostic.
g Fix generalizes across inputs (params/datatypes/wrappers)? YES. The input domain is Result.Status; the test parametrizes every non-ok member (FAIL, ERROR, XPASS, DROPPED, UNKNOWN, PENDING, RUNNING) and all three ok members (OK, SKIPPED, XFAIL) against flag on and off. The fixture mirrors complete_job's own setter condition (flag recorded only when not is_ok()), so no case asserts a state production cannot produce.
h Backward compatible? (maintainer-approved exception only) YES. No setting, default, serialized format or SettingsChangesHistory.cpp surface. The only behaviour change is that a job which already declared itself non-blocking is now non-blocking in GitHub too, matching what hook_html already did. Category: CI Fix or Improvement.
i Invariants and contracts preserved? YES. Merge-blocking unchanged: ready_for_merge reads job.allow_failure alone (native_jobs.py:1102-1117) and never this flag; all six shards are allow_failure=False, verified by loading JobConfigs and pinned in a test, so a failing shard still blocks the merge and still reports red. The independence itself is pinned too: the flag must not appear in _finish_workflow (mutation arm E reddens that test). complete_job still exits non-zero on any non-ok result and CIDB rows are unchanged. DROPPED still yields failure (it never carries the flag). new_tests_check.py is untouched: its strict check is correct, and relaxing it would have hidden real failures. The extracted function is pure, so there is no error or early-return path to walk.

Full ci/tests: 972 passed / 31 skipped / 8 failed with the fix versus 927 / 31 / 8 on pristine runner.py (same 8 pre-existing clickhouse was not found in PATH failures on both arms, so zero regressions; the delta is the new tests). No 50/50 randomized run applies: pure-python harness change with no server, no build and no randomized settings.

Session id: cron:clickhouse-impl-slot-4:20260815-142100

@clickhouse-gh

clickhouse-gh Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6ab8867]

Summary: ✅


AI Review

Summary

This PR makes Runner emit the GitHub Actions pipeline_status output from the same non-blocking predicate that hook_html already uses, so jobs marked with do_not_block_pipeline_on_failure stop blocking their downstream closure when they end in a non-OK status outside Result.is_failure. I traced that invariant through the two current flag producers, the report-side consumer, the workflow if: conditions, the merge gate, and the current PR discussion/CI evidence, and I did not find a correctness or coverage gap that warrants an inline review comment.

Final Verdict

✅ No findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 15, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus @maxknv, could you review this? A job that sets do_not_block_pipeline_on_failure still emitted pipeline_status=failure when it ended ERROR rather than FAIL, because runner.py gated on is_failure() while hook_html.py gates on not is_ok(), so one integration shard hitting its session timeout skipped its whole transitive downstream closure including every Bugfix validation (*) job. The predicate now matches the report side; merge blocking still comes from allow_failure alone.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Aug 15, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 6ab8867fa with master 83564faa3 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 693.26 MiB 690.24 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 5 s compile time in total, 6 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 6ab8867

CI is fully finished on this head and it is clean: 177 check-runs, 7 success / 170 skipped,
0 failed, 0 cancelled, 0 still running. Config Workflow and Finish Workflow both succeeded,
and the praktika report is top-level OK with 0 dropped jobs, so the filtered matrix is a real
run rather than a void one.

Check / test Reason Owner / fixing PR
Config Workflow / Pre Hooks (15:07:20Z, 15:50:52Z) superseded: can be tested label was not yet applied when the workflow first dispatched not applicable, the same job re-ran green at 22:31:21Z on this identical commit

Those two CIDB rows are historical, not open. Both predate the label being applied; the same
Config Workflow job then completed success at 22:31:21Z on the same commit_sha, and the
praktika report for this head reports 0 dropped jobs, which is why the run is treated as covered
rather than label-gated.

The 45 tests added in ci/tests/test_pipeline_status_non_blocking.py all ran in CI Tests on
this head with 0 failures. Counts are from an aggregate CIDB query over this commit, not a tally
of the job list.

Session id: cron:our-pr-ci-monitor:20260816-003000

@groeneai groeneai added the groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect label Aug 19, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 19, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 21, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 21, 2026
Merged via the queue into ClickHouse:master with commit b9db646 Aug 21, 2026
535 of 539 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 21, 2026
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 groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants