Repository navigation
Description
Is there an existing issue for this?
I searched open and closed issues and PRs for the merge gate, its polling step and the log text below. #124 and #160 changed what the gate requires; neither concerns how it waits.
Current behaviour
The Required Merge Gate job waits for other checks on the same commit with a shell polling loop (wait_for_checks in required-merge-gate.yml). Two properties of that loop turn infrastructure noise into a red required check:
- One transient API failure fails the gate. Each poll assigns
result="$(gh api ...)"with no retry. When the call fails, the step exits non-zero immediately. The gate reports failure even though nothing it was waiting for had failed. - The wait budget equals the job timeout.
max_attempts=720withsleep_seconds=30is 360 minutes of sleeping alone, and the job hastimeout-minutes: 360. The loop's own "timed out" error can therefore never be reached: the runner cancels the job first, and aFull Validation Gatethat is queued or slow for about six hours leaves the required check cancelled even if validation then succeeds.
Observed on 2026-09-16/17:
| PR | Gate job | Outcome | Full Validation Gate on the same commit |
|---|---|---|---|
| #165 | 104848436130 | failed 20:49:58Z, log ends unexpected end of JSON input |
success 20:49:22Z |
| #159 | 104947590339 | failed 20:49:56Z, same log line, while still waiting for the check to appear | success 00:27:34Z (next day) |
| #162 | 104961179013 | cancelled 02:18:28Z at the six-hour cap | success 02:31:04Z |
The two failures happened within two seconds of each other on unrelated commits, which points at one API blip rather than at either change. In all three cases Core Checks Gate and Full Validation Gate are green and the required check is red, so the PRs are blocked until someone re-runs the gate by hand.
Expected behaviour
- A transient failure of the check-runs query is retried a bounded number of times and logged; it does not fail the gate on its own.
- A persistent query failure still fails closed, with an error that says the API could not be read, distinct from "a required check failed".
- An API error, an empty body or malformed output is never treated as success and never as "check not found yet" indefinitely.
- The wait budget and the job timeout are reconciled so that the loop's own timeout message is reachable and states which checks were still pending.
- The behaviour is covered by an executable test that runs the real polling logic against a stubbed
gh, in the style ofci/checks/test_classifier_ci_contract.py, and that test runs in required CI.
Steps to reproduce
- Read
wait_for_checksat the link above: the command substitution has no error handling, and the step runs under the defaultbash -eshell. - Compare
max_attemptsxsleep_secondswith the job'stimeout-minutes. - Open the three job logs above and compare their end times with the
Full Validation Gatecheck run on the same commits.
Relevant log output
Core Checks Gate: status=completed conclusion=success
Full Validation Gate: status=queued conclusion=pending
Core Checks Gate: status=completed conclusion=success
unexpected end of JSON input
##[error]Process completed with exit code 1.
Notes
CI only; no consensus, wallet or network behaviour is involved. The gate must remain fail-closed: the fix is to stop reporting noise as failure, not to make the gate easier to pass.
Activity
kiwidream commentedon Sep 18, 2026
Addressed by #171, open against
1.x.x.The waiting loop now separates reading the check runs from judging them.
backoff, each attempt logged with its reason, so the single API blip that
failed ci: validate maintained source in scheduled heavy workflows #165 and ci: forward IBD workflow timeout inputs to the harness flags #159 two seconds apart no longer fails the gate.
Required Merge Gate could not read check runs, which is a different errorfrom
Required Merge Gate failed(a check concluded badly). An API error, anempty body, a truncated body, a page without a
check_runsarray or a runwithout a usable status are all query failures — never success, and never an
endless "not found yet". "Query succeeded, no run with that name" is reported
and treated separately, as pending.
is the maximum a GitHub-hosted job can be given, so the budget had to go
under it rather than the cap going up; the deadline is wall-clock, so time
spent inside the API calls is charged to it and not only the sleeps. The
loop's own
Required Merge Gate timed outmessage is therefore reachable,and it names the checks that were still pending. A validation slower than
330 minutes now ends with that message instead of the silent cancellation
that hit script: cache successful P2MR PQC signature checks #162.
--paginatewas added:per_page=100alone couldhide a required check beyond the first hundred check runs on a commit.
Selection is unchanged — the newest run by
started_at, falling back tocreated_at.ci/checks/test_merge_gate_poller.pyruns the gate step's realrun:scriptout of the workflow against a stubbed
gh, with the waiting tunablesoverridden so it finishes in about 35 seconds, and runs in
classify-changes— a job the gate depends on. Seven mutations were applied to the workflow to
confirm the suite fails on each: removing the retry, a failed query counted as
"not found yet", a failed query counted as success, a
failureconclusiontreated as pending, a budget above the job timeout, selecting the first check
run instead of the last, and a deadline that counts only sleeps.
Not addressed here, and unchanged: which checks each profile requires, and
whether the hosted check is attached to a branch ruleset.
#171 targets
1.x.x, which does not auto-close issues, so this stays open for amaintainer to close once it merges.
ci: harden the Required Merge Gate check-run poller (#171)
kiwidream commentedon Sep 23, 2026
Fixed on
1.x.xby #171 (mergeae722219be). Merges into a non-default branch do not fire closing keywords, so closing by hand. Mapping the expected behaviour to the merged workflow and its test ata6442d28f9:query_check_runin.github/workflows/required-merge-gate.ymlretries the check-runs query up toGATE_QUERY_MAX_ATTEMPTS(6) times with capped backoff and logs each attempt.Required Merge Gate could not read check runs, distinct fromRequired Merge Gate failed.check_runsis a query failure, neverabsent;absentis reported only when the query succeeded. The query now paginates instead of stopping at 100 check runs.GATE_WAIT_TIMEOUT_SECONDS, 19800 s against the 360-minute job cap), soRequired Merge Gate timed outis reachable and names the checks still pending.ci/checks/test_merge_gate_poller.pyruns the gate step's realrun:script against a stubbedgh, and runs in theclassify-changesjob the gate depends on; the gate run for787504bdfeloggedRan 17 tests ... OK.All three gates were green on the merge commit. Closing.
ci: harden the Required Merge Gate check-run poller (#171)