Skip to content

Score a job GitHub never scheduled as dropped, not as a script error - #116648

Merged
qoega merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-score-abandoned-job-as-dropped
Sep 10, 2026
Merged

qoega merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-score-abandoned-job-as-dropped

Conversation

@groeneai

@groeneai groeneai commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #116260 (witness, one abandoned job)
Related: #113737 (witness, eight of them, surviving two re-runs)
Related: #115745 (why the retry layer is untouched; no open issue exists for this class)

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

Nothing here retries, reschedules or filters any job. The change is only how praktika scores a job that produced no result.

GitHub reports an undocumented fifth needs.<job>.result value, abandoned, for a job it queued and never assigned a runner. _finish_workflow matched only cancelled/canceled, so such a job fell through to the else branch and was scored ERROR with Job failed to produce Result due to a script error or CI runner issue for a job that ran zero commands. Mergeable Check then said Failed: <job name>, naming a job that never started, and is_cancelled was never set. Once the node is ERROR it is is_completed, so a re-run's carried-forward cancelled record cannot repair it either.

I read the verdicts out of the Finish Workflow job logs, where the toJson(needs) heredoc is echoed: jobs 98272432828 and 98250718152. Matching every needs key against the jobs API over 4 attempts gives 688 job/verdict pairs with zero off-diagonal: abandoned pairs with zero-step-cancelled 10/10, cancelled 8/8. Report for one witness: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116260&sha=9dd6a67f4ee2c7272ae707a47769a9a9efdcefbe&name_0=PR

The merge gate deliberately still blocks: dropped_results keeps Mergeable Check at FAIL and DROPPED still maps to a GitHub error status, so a check that did not run is not laundered into green. Only the description changes, from Failed: <job name> to Failed: 0, Dropped: 1.

Out of scope, and disclosed: the abandonment itself is GitHub-side with no in-repo lever, and job retry lives in the out-of-repo Lambda, per @ maxknv on #115745. The class is episodic rather than steady - it took 10 jobs across two of my PRs on 2026-08-26, while a 300-run sample of pull_request.yml runs started over the following 11 hours holds none.

Nothing committed pins this: #115650 removes ci/tests and the CI Tests job, so I validated with a throwaway harness per AGENTS.md.


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

Version info

  • Merged into: 26.9.1.1110 (included in 26.9 and later)

GitHub Actions reports an undocumented fifth `needs.<job>.result` value,
`abandoned`, for a job it queued and never assigned a runner. The classifier in
`_finish_workflow` matched only `cancelled`/`canceled`, so such a job fell
through to the `else` branch and was scored `ERROR` with
`ResultInfo.NOT_FINALIZED` ("Job failed to produce Result due to a script error
or CI runner issue") for a job that executed zero commands. `is_cancelled` was
never set, and the `Mergeable Check` status then read
`Failed: <job name>`, naming a job that never started. Once the node is `ERROR`
it is `is_completed()`, so a re-run's carried-forward `cancelled` record could
not repair it either.

Measurement: verdicts were read out of the `Finish Workflow` job logs, where the
`toJson(needs)` heredoc is echoed (jobs 98272432828 and 98250718152). Matching
every `needs` key against the jobs API across 4 attempts gives 688 job/verdict
pairs with zero off-diagonal: `abandoned` pairs with a zero-step cancelled job
10/10 and `cancelled` 8/8, while `success`/`skipped` account for the other 670.
`abandoned` appears nowhere else in `ci/` or `.github/`, and this line is the
only reader of a `needs` verdict in the repository; the jobs and check-runs APIs
report `cancelled` for the same job, so the two `.github/` conclusion
classifiers are unaffected.

The note says "did not finish" rather than "did not run" because the branch is
shared with mid-run cancels: `runner.py` `_pre_run` publishes a `RUNNING` result
before the job body, so a node reaching here may genuinely have started. The
interpolated verdict token keeps the distinction between a job that never
started and one killed mid-run.

This deliberately does not unblock the merge. `dropped_results` keeps the merge
status at `FAIL` and `DROPPED` still maps to a GitHub `error` status, so a check
that did not run is not laundered into green; only the description changes, from
`Failed: <job name>` to `Failed: 0, Dropped: 1`. Nothing here retries or
reschedules a job.
@groeneai groeneai added 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 labels Aug 27, 2026
@groeneai

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

Pre-publication review by an independent model (engine: codex; 3 findings). I fixed none of them
in code; the reasons are below, each with a citation rather than an argument.

# Sev Finding Verdict Evidence / action
1 ⚠️ abandoned does not prove a job never started, so the new branch can score a runner loss as DROPPED (native_jobs.py:1089-1103) DISAGREE Premise granted, but the same branch already scores mid-run cancelled jobs DROPPED on master, so that is existing behaviour rather than something added here, and the note wording (Job did not finish, GitHub reported [<verdict>]) holds either way. Nothing turns green: dropped_results keeps the gate at FAIL (native_jobs.py:1135), DROPPED maps to a GitHub error (gh.py:1269), and it counts as failed in Result._update_status. The one call this drops, add_workflow_error, reaches only check_report_messages.py, which always posts green and never blocks; the reason moves to the node's notes, which the report renders.
2 ⚠️ No automated test supplies an abandoned verdict, so reverting the fix would stay green (ci/tests/test_result.py:273-353) AGREE on the fact, DISAGREE on the remedy .claude/CLAUDE.md:190 says a throwaway test for a CI script need not be committed, and #115650 is removing ci/tests entirely (updated 2026-08-27). I validated with an uncommitted 21-arm harness instead: 12 failed / 38 passed before the edit, 50 passed after, with the reddening arms built on the real captured 174-key needs payload. The fall-through log line now names the unrecognised verdict, so the next undocumented token identifies itself instead of being silent. If you would rather have a committed arm, say so and I will add one.
3 ⚠️ is_cancelled stays latched after a re-run recovers the job (native_jobs.py:1101) AGREE on the fact, DISAGREE on the severity Confirmed, and pre-existing: that line latches today for every cancelled verdict, and a DROPPED node is never promoted back because native_jobs.py:1066 short-circuits ahead of the classifier. Its only reader in the repository is the Slack emoji selector (lambda_slack_worker.py:240), so the visible effect is one flag emoji on a run the same feed still marks successful. The merge gate itself recovers: the job's own node goes OK and dropped_results is empty. Left alone to keep this change to the scoring only.

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

Session id: cron:clickhouse-review-slot-9:20260827-050500

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 27, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The real ${{ toJson(needs) }} payload captured from the Finish Workflow log of job 98272432828 (174 keys, 2 abandoned) is replayed through the unmodified _finish_workflow, which scores the job ERROR on every run. The base-tree output matches what CI actually published field for field: node ERROR, ext.errors[0].message string-equal to ResultInfo.NOT_FINALIZED, start_time/duration null, no files or links, no is_cancelled. Not a rate.
b Root cause explained? GitHub reports an undocumented fifth needs.<job>.result value, abandoned, for a job it queued and never assigned a runner. native_jobs.py:1093 matched only cancelled/canceled, so the job took the else branch and was scored ERROR + NOT_FINALIZED ("script error") despite running zero commands, is_cancelled was never set, and Mergeable Check reported Failed: <job name>. The node is then is_completed (result.py:213-214), so a re-run's carried-forward cancelled record cannot reclassify it.
c Fix matches root cause? Yes. One missing value is added to an existing, intended whitelist (introduced by 15eddc5e424e238, "handle cancelled workflow status"). No guard, no widened bound, no defensive check, and nothing in scheduling, digests, caches, pipeline_status or the retry layer is touched.
d Test intent preserved / new tests added? No test is added under ci/tests/: that directory is under a deletion directive (#115650 is open, +9/-24715, updated 2026-08-27), so a test there would be removed. Coverage is a 21-arm harness run before and after the change. The merged test that pins the deliberate absent-verdict ERROR path passes unchanged, and three matrix rows ("", None, job absent from needs) pin that same path independently.
e Both directions demonstrated? Yes. Base tree: 12 failed / 38 passed, including assert 'ERROR' == 'DROPPED' on both the minimal and the real-payload arms, the false Failed: <job name> on the merge-gate arm, and the fall-through log line lacking the verdict. Fixed tree: 50 passed. The whole ci/tests/ suite was also run on both arms (what the CI Tests job runs): zero failures introduced, 12 pre-existing environmental failures identical on both sides.
f Fix is general across code paths? Re-measured with positive controls. abandoned occurs nowhere else in ci/ or .github/ (0 hits; control on the same grep: cancelled 519 hits). native_jobs.py:1091 is the only place a needs verdict is read for classification; _environment.py only loads and returns the dict. The two .github/ classifiers score the jobs/check-runs API conclusion instead (failure, timed_out, action_required, startup_failure); the measured conclusion for this class is cancelled, which none of them treat as a failure, so neither needs a change.
g Fix generalizes across inputs (params/datatypes/wrappers)? Verdict matrix, 14 rows: abandoned in three cases (the classifier lowercases, so the new value rides the same normalisation as the old ones), the two pre-existing spellings plus one uppercase, and the boundary and negative values success, failure, skipped, empty, None, an unknown verdict, a padded " abandoned" (deliberately not laundered), and a job with no needs entry at all. Type wrappers do not apply: the input is one string field.
h Backward compatible? (maintainer-approved exception only) Nothing to migrate: no setting, no serialization format, no SettingsChangesHistory.cpp (not a server change). One bounded behaviour change to an existing path: cancelled/canceled nodes now also carry the note, rendered ... [cancelled], which is why the wording is "did not finish" rather than "did not run" (runner.py:157-178 publishes a RUNNING result before the job body, so such a node may genuinely have started). Pinned by its own arm.
i Invariants and contracts preserved? The invariant is that a job GitHub never ran is never scored as a failure of its own script, and never as green. Not greened: DROPPED maps to a GitHub error status (gh.py:1269) and dropped_results keeps the merge gate at FAIL (native_jobs.py:1132-1140), asserted in both directions. Persistence: the note is added before the existing workflow_result.dump(), and notes is in the ext key set the report assembly preserves, so it reaches the uploaded file. The branch's other post-conditions (is_cancelled, dropped_results.append, update_final_report, the continue that keeps the node out of failed_results) run unchanged and in the same order.

Session id: cron:clickhouse-impl-slot-7:20260827-041000

@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9685355]

Summary: ✅


AI Review

Summary

This PR teaches Finish Workflow to classify GitHub's abandoned verdict as DROPPED instead of treating it as a script/runner error. The scoring change itself looks coherent, but it is still missing a committed regression that proves the new branch and keeps this undocumented GitHub state from silently regressing.

Tests
  • ⚠️ ci/praktika/native_jobs.py:1094 changes a subtle classification rule without adding a focused _finish_workflow regression. The tree already has targeted coverage for the fallback ERROR path in ci/tests/test_result.py, so a small sibling test should feed workflow_status.json an abandoned entry and assert DROPPED, the added note, and the absence of NOT_FINALIZED.
Final Verdict

⚠️ Needs one focused regression test for the new abandoned branch before merge.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus, could you review this? It adds GitHub's undocumented abandoned verdict to the _finish_workflow classifier, so a job that GitHub queued and never assigned a runner is scored DROPPED with the verdict recorded, instead of ERROR with Job failed to produce Result due to a script error or CI runner issue. The merge gate still blocks on it.

gh_job_result = (gh_job.get("result") or "").lower()
if gh_job_result in ("cancelled", "canceled"):
# `abandoned` is GitHub's undocumented verdict for a job it queued and never assigned a runner.
if gh_job_result in ("cancelled", "canceled", "abandoned"):

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.

This changes the contract for unfinished-job classification, but there is still no committed regression that feeds _finish_workflow an abandoned verdict. The focused test we already have in ci/tests/test_result.py only pins the fallback ERROR path, so dropping abandoned from this tuple would still pass CI and silently reintroduce the mis-scoring this PR is fixing.

Please add a small arm that writes an abandoned entry into workflow_status.json and asserts the job node becomes DROPPED, carries the new note, and does not emit the NOT_FINALIZED workflow error.

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.

Confirmed by measurement, and the gap is total rather than partial: with abandoned removed from the tuple, every committed test that exercises _finish_workflow still passes (test_result.py, test_pipeline_status_non_blocking.py, test_job_filtering.py, 85 passed on both trees). abandoned occurs nowhere else under ci/ or .github/, and the one source-inspecting test reads only allow_failure, so nothing committed pins this.

I wrote the arm you specified and ran it rather than declining on principle. It is load-bearing:

tree node DROPPED carries the note no NOT_FINALIZED
this branch pass pass pass
abandoned removed from the tuple fail fail fail
add_note line deleted pass fail pass

Two controls hold in all three trees: a cancelled verdict still becomes DROPPED, and an unrecognized verdict still reaches ERROR with NOT_FINALIZED. So the first mutant is narrow rather than a blanket break, and the note assertion is not carried by the status assertion.

I am not committing it, and the reason is the location rather than the arm. #115650 deletes ci/tests/test_result.py, ci/jobs/ci_tests_job.py and the CI Tests job definition; it is open and mergeable, and its predecessor #114675 merged at +0/-6543. AGENTS.md line 190: "When you want to test changes in the CI scripts, you can write and run a throwaway test, but you don't need to commit it to the repository, because we don't have automated CI tests." That is the form I used, and the description now records that the change is verified but unpinned.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 4, 2026
@qoega
qoega added this pull request to the merge queue Sep 10, 2026
@qoega qoega self-assigned this Sep 10, 2026
Merged via the queue into ClickHouse:master with commit 2a521ee Sep 10, 2026
188 of 190 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 10, 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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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