Skip to content

pr-validator: the arm gate cannot arm when a sibling job's status stays in_progress while its conclusion is success (settle loop reads status alone) #305

Open

Description

@aitrawog

What happens

pr-validator's validate / arm job could not arm auto-merge on a head whose every job had finished, because one sibling job's check-run record kept status: in_progress while its own conclusion: success and completed_at were already set. The settle loop counts a check as pending on .status != "completed" alone, so it waited its whole derived budget (3900 s), then classified the head as IN-FLIGHT (exit 2) — a class whose stated meaning is "the check is RUNNING", which was false.

Measured, opencharly/opencharly#995 (2026-11-12)

Head 30e1d3bd58efe621bbfcd79f3658ce209d44ee74, run 43225664821:

$ gh api "repos/opencharly/opencharly/commits/30e1d3bd58efe621bbfcd79f3658ce209d44ee74/check-runs?filter=all" \
    --jq '.check_runs[] | "\(.name)\tstatus=\(.status)\tconclusion=\(.conclusion)\tcompleted=\(.completed_at)"'
validate / arm       status=in_progress conclusion=null      completed=null
validate / validate  status=completed  conclusion=success   completed=2026-11-12T13:17:59Z
validate / lint      status=in_progress conclusion=success   completed=2026-11-12T13:16:17Z

The lint JOB was finished — every step, including its last, was completed/success:

$ gh api "repos/opencharly/opencharly/actions/runs/43225664821/jobs" --jq '.jobs[] | select(.name=="validate / lint") | .steps[] | "\(.number)\t\(.name)\t\(.status)/\(.conclusion)"' | tail -3
12  Post Run actions/checkout@...                  completed/success
13  Complete job                                  completed/success

and its job record carried the conclusion too:

status=in_progress conclusion=success started=2026-11-12T13:16:07Z completed=2026-11-12T13:16:17Z runner=charly-ci-4vcpu-9-1

The arm gate's own log is the record of the false wait (3900 s of it):

waiting on 1 in-flight check(s): validate / lint      (× many)
check runs on 30e1d3bd58efe621bbfcd79f3658ce209d44ee74 in opencharly/opencharly (this gate excluded):
validate / lint -> in_progress/success
validate / validate -> completed/success
##[error]still in flight after 3900s — validate / lint
##[error]NOT a finding about the change: the check is RUNNING, not failing. This is the workflow's own INCONCLUSIVE class.
##[error]Process completed with exit code 2.

Mechanism

  1. A job's check-run status is a separate field from its conclusion. A runner that reports the conclusion but whose job-level status update is lost leaves exactly this shape: status=in_progress, conclusion=success, completed_at=<set>. The job's own steps and completed_at prove it finished.
  2. The settle loop's snapshot classifies pending as .status != "completed" only. It never consults conclusion or completed_at, so a finished-but-unflipped sibling is indistinguishable from a running one.
  3. The budget expires, and the loop falls to the IN-FLIGHT class (exit 2), whose documented remedy is "re-run ONLY this job". Following that remedy alone cannot work: a re-run of arm re-reads the same stale record and waits another 3900 s.
  4. POST /repos/{o}/{r}/actions/jobs/{lint}/rerun while the run is still in progress is refused (403 The workflow run containing this job is already running), so the one action that repairs the record is unavailable until the arm job has ALREADY burned its 65 minutes and failed.

Missed control

The workflow has a class for "a check is running" and a class for "a check did not pass", but none for "a check's record is internally inconsistent" — a state that is neither. The head-settle self-test (scripts/head-settle_test.sh) mutates the classes it knows; it cannot produce this record shape, so the blind spot is invisible to the gate's own proof.

Blast radius

Any PR whose lint (or any sibling) job loses its status update: auto-merge cannot be armed for 65 minutes, the validate / arm check then lands RED on a head whose review PASSED and whose every job succeeded, and the org's stalled-auto-merge detector does not select it (that detector keys on ARMED+BEHIND / ARMED+DIRTY / a CANCELLED required check, not on an unarmed-but-green head). Measured cost here: ~70 minutes, one failed check-run on a clean head, and the manual repair below.

Repair used (capability-free, no new head, no re-review)

$ gh api -X POST repos/opencharly/opencharly/actions/jobs/131208051632/rerun   # the stale lint job
{}    # re-runs the job AND its dependents: a new lint attempt, a new validate attempt, a new arm attempt

$ gh api "repos/opencharly/opencharly/commits/30e1d3bd.../check-runs?filter=all" --jq '.check_runs[] | "\(.name)\tid=\(.id)\t\(.status)/\(.conclusion)"'
validate / lint      id=131246752382  completed/success
validate / validate  id=131246756175  completed/success
validate / arm       id=131246864726  completed/success

Auto-merge armed at 2026-11-12T14:25:22Z and the PR merged (squash) at 14:25:44Z. So the state was fully repairable — the defect is that the named remedy could not reach the repair.

Root fix (proposed)

In the settle loop's snapshot, treat a check as SETTLED when its conclusion is non-null or its completed_at is set, even if status still reads in_progress, and carry that shape as its own visible line (settled-by-conclusion) so the reading is not silent. A check whose status is stale but whose conclusion is a non-passing value must still land in bad, never in pending. The head-settle self-test gains the mutation: a fixture check-run with status=in_progress, conclusion=success, completed_at=<set> must reach the GREEN class, not the in-flight one.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Activity

  1. added
    category:governance
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:governancetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions