Skip to content

fix(detector): read the non-resolving required check and the DIRTY half - #191

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/stall-detector-nonresolving-checks
Oct 12, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/stall-detector-nonresolving-checks

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The org's stalled-mergeability reader covered one measured shape and said so in its own scope note: auto-merge armed + a BEHIND head (opencharly/.github#175). Three shapes are measured now, each on a live stall:

  1. ARMED + BEHIND (RCA: auto-merge armed + strict required checks + a BEHIND branch = a silent, undetected stall (measured: ~10 h, 0 landings) #175) — unchanged.
  2. ARMED + DIRTY (RCA: auto-merge armed + strict required checks + a BEHIND branch = a silent, undetected stall (measured: ~10 h, 0 landings) #175 comment 6084457430) — strictly worse and needing its own handling: gh pr update-branch CANNOT resolve a conflict, so an armed conflicted PR waits forever with no signal at all (measured on charly#432, ~30 h).
  3. THE REQUIRED CHECK NEVER RESOLVED (a CANCELLED required check is a second silent stall: auto-merge never arms, validate/validate stays cancelled, and the PR reads as queued #186) — a superseded validator run leaves validate / validate CANCELLED. Arming happens inside the validator run — the run that was cancelled — so the PR sits BLOCKED with autoMergeRequest == null and reads as queued: nothing re-dispatches it and no check ever concludes. Measured on this repo's own #185 (armed = Y and the required check CANCELLED).

Three properties of the third class are deliberate:

  • It reads every run of the required context on the head, not only the newest. A branch protection rule requires every same-name run to pass, so an older CANCELLED beside a newer SUCCESS keeps a PR blocked forever (the POISON pair); a newest-only filter would miss exactly that.
  • FAILURE is excluded. A red required check is a verdict, and a red PR gets read; this alarm exists for the quiet ones.
  • Armed or unarmed does not matter here, because the filing instance sat unarmed — that is the whole point of the shape.

report_stalled now prints the remedy per class, and for the third class it carries the caveat the issue itself measured: the REST re-run is a fresh review that replaces the verdict (charly#871: a re-run turned a PASS into a BLOCK carrying a finding the first run had not raised). The alarm line reads "Never re-dispatch a head you have not read and fixed."

Scope, stated so nobody over-trusts it (the sentence declaring the cancelled shape out of coverage is deleted): an unarmed BEHIND/DIRTY head, and a head carrying no run of the required context at all — the fork case, #179, where no org gate applies — are not selected. Deciding those needs the ruleset scope derivation in scripts/lib-org.sh discover_excludes, which this reader deliberately does not read. Under-reporting is the honest failure mode: a detector that cries wolf on ~16 forks is switched off, and then it detects nothing.

scripts/governance-claims.tsv gains the stall_shapes claim (4 rows): the canonical phrase REQUIRED CHECK NEVER RESOLVED must be present in both the rule's carrier (the script) and its alarm surface (the workflow), and the retired wording (not covered) must not return to either — that sentence is how shape 3 stayed invisible.

This change does not touch the org gate, the ruleset, or the PR template; it strengthens the observer of the landing contract, relaxing nothing.

Closes #186.

How tested

Committed head f52aba40413b7f288152b932796c3e7a4a2c4f46 (git rev-parse HEAD, nothing else pushed from it).

# head f52aba40413b7f288152b932796c3e7a4a2c4f46 (git rev-parse HEAD)
$ git diff --stat origin/main...HEAD
 .github/workflows/stalled-automerge-detector.yml |  42 +++--
 scripts/check-stalled-automerge.sh               | 216 ++++++++++++++++-------
 scripts/governance-claims.tsv                    |  10 ++
 3 files changed, 193 insertions(+), 75 deletions(-)
$ git diff --check origin/main...HEAD; echo "exit=$?"
exit=0

The changed selection rule, driven by its own fixtures (one per class + the POISON pair + six near-misses):

# head f52aba40413b7f288152b932796c3e7a4a2c4f46
$ bash scripts/check-stalled-automerge.sh --self-test
check-stalled-automerge: self-test ok
exit=0

Coverage fails without the change — the old filter (origin/main's select_stalled, extracted at a817054/7582234) driven with the new fixtures selects none of the three new classes:

# old filter from git show HEAD~... :scripts/check-stalled-automerge.sh, new fixtures
OLD armed+DIRTY        -> []  (new expects opencharly/charly#432	DIRTY	DIRTY)
OLD unarmed+CANCELLED -> []  (new expects opencharly/charly#871	CHECK	validate / validate: CANCELLED)
OLD armed+CANCELLED   -> []  (new expects opencharly/.github#185	CHECK	validate / validate: CANCELLED)
OLD armed+BEHIND      -> [opencharly/sdk#356	BEHIND]  (new emits three fields, with the class)

The changed path executed live against the real org (read-only GraphQL over all open PRs):

# head f52aba40413b7f288152b932796c3e7a4a2c4f46
$ bash scripts/check-stalled-automerge.sh
check-stalled-automerge: no armed+BEHIND, armed+DIRTY or non-resolving required-check PRs in opencharly — nothing is silently parked
exit=0

That quiet result is correct and checkable: of the 15 open PRs, none is armed, two are DIRTY (charly#828, marketplace#447 — unarmed, therefore out of class), and the single head with no run of the required context is the fork openclaw-enterprise#1 (#179's by-design case). The fixtures, not the live scan, are the proof that each class fires; the live scan is the proof that the alarm stays quiet when nothing is parked.

The repo's own offline battery (the change-class gate for this repo) on the committed tree:

# head f52aba40413b7f288152b932796c3e7a4a2c4f46
$ python3 scripts/check-action-runtimes.py                 -> OK (12 workflow files; 5 audited pins; node24)   exit=0
$ python3 scripts/check-action-runtimes.py --self-test      -> OK (Node 20 pins fail)                         exit=0
$ bash scripts/org-ruleset_test.sh                          -> all assertions passed (apply/verify/abort)      exit=0
$ bash scripts/retire-per-repo-dispatchers_test.sh          -> all assertions passed                         exit=0
$ bash scripts/retire-per-repo-candy-gates_test.sh          -> all assertions passed                         exit=0
$ bash scripts/strip-config-version_test.sh                 -> all assertions passed                         exit=0
$ bash scripts/bootstrap-repo-main_test.sh                  -> all assertions passed                         exit=0
$ bash scripts/governance-reconcile.sh --self-test          -> all assertions passed                         exit=0
$ bash scripts/governance-reconcile.sh --root "$PWD"        -> checked=26 skipped=53 fail=0                  exit=0
  ok  stall_shapes: required phrase present in the script and the workflow;
  ok  stall_shapes: forbidden phrase absent from both

The changed workflow itself, executed live on this branch ref with the App token:

# head f52aba40413b7f288152b932796c3e7a4a2c4f46
$ gh workflow run stalled-automerge-detector.yml --repo opencharly/.github --ref feat/stall-detector-nonresolving-checks
https://github.com/opencharly/.github/actions/runs/38311384599
$ gh run view 38311384599 --repo opencharly/.github --json conclusion,event,headBranch,jobs
{"conclusion":"success","event":"workflow_dispatch","headBranch":"feat/stall-detector-nonresolving-checks","jobs":[{"conclusion":"success","name":"detect"}]}
$ gh run view 38311384599 --repo opencharly/.github --log | grep -E 'check-stalled-automerge'
check-stalled-automerge: self-test ok
check-stalled-automerge: no armed+BEHIND, armed+DIRTY or non-resolving required-check PRs in opencharly — nothing is silently parked
exit=0

A branch-ref run is the only way to execute a changed workflow: the org-required caller resolves its own definition from main, so the scheduled alarm on main would still be running the pre-change script. This run is also what confirms the widened read resolves under the App's declared pull_requests: read grant — the query now carries statusCheckRollup/CheckRun nodes, and the job finished green with the App token instead of failing closed (exit 2). The fixtures, not this run, are the proof that each class fires; this run is the proof that the changed file executes end to end on real data.

This is not a claim that every rejection branch of the workflow was exercised.

Rulebook compliance

  • R0 — git-workflow, agents, repo-setup, strict-policy and root-cause-analyzer loaded before the first tool call of this lane, plus this repo's own AGENTS.md (which the worktree injected): .github is PR-only and its gate/ruleset/template are self-modifying-security surfaces.
  • R1 — the two anomalies are the issue threads themselves; both are fixed here, not filed. The detector's own scope note was a false claim on the changed surface (a CANCELLED required check … is not covered), so the claim-keyed sweep corrected it in the same change and the retirement is now protected by a forbid row. No finding is parked.
  • R2 — one reader, one rule: the required context is named once (REQUIRED_CHECK), the non-resolving vocabulary once (NON_RESOLVING), and the canonical phrase is stated once per surface and asserted by the governance manifest. No second copy of the stall rule is introduced.
  • R3 — no sleep, no retry, no re-dispatch automation. The alarm REPORTS the remedy and refuses to perform it; exit 2 (not 0) whenever the org query fails, so a failed read can never report "nothing stalled".
  • R4 — the rule changed before any prose that describes it: the script, its alarm surface, and the manifest rows move together.
  • R5 — the retired scope sentence is deleted from both files and a forbid row makes its return a gate failure; grep -rn 'not covered' scripts/check-stalled-automerge.sh .github/workflows/stalled-automerge-detector.yml → no matches (exit 1, expected).
  • R6 — git status clean before and after the commit; session worktree .worktrees/dsh-opencharly/dotgithub on feat/stall-detector-nonresolving-checks off fresh origin/main (7582234); no force-push, no direct push to main, no hook bypass.
  • R7 — the coverage fails without the change (pasted above), the changed path executed live against the real org, and the emitted artifact of this repo's class (the alarm's own output) is driven by fixtures that fail when the rule regresses.
  • R8 — the real GitHub GraphQL API is read; nothing is mocked. The offline script tests are the repo's own established pattern (mock gh) for policy scripts and are not offered as evidence of the detector's live behaviour.
  • R9/R10 — no charly runtime source changes; the change class here is workflow/script, whose gate is this repo's CI (workflow-checks.yml) plus the branch-ref execution of the changed workflow.

Change classification

Hook/workflow infrastructure (an alerting reader); no charly runtime, deploy target or candy change. Gate: workflow-checks.yml (offline policy scripts + action-runtime pins) and the org-required charly/pr-validator, with the changed workflow executed live on the branch ref. Attribution: analysed on a live system — the detector ran live against the org and the fixtures drive every class, without claiming that every rejection branch of the workflow was exercised.

Filed issues

  • None filed from this round: the two shapes are the fixed subject of this change, and the one sibling surfaced was already filed — opencharly/marketplace#442 (pr_state_watch.sh reads a CANCELLED check run as PASS), which is the same class in the marketplace watcher and remains open under its own claim.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

The org's stalled-mergeability reader covered ONE measured shape (auto-merge
armed + a BEHIND head, #175) and said so in its scope note.
It now covers three, each measured on a live stall:

- ARMED + DIRTY (#175 comment 6084457430): gh pr update-branch cannot resolve a
  conflict, so an armed conflicted PR waits forever with no signal (charly#432, ~30h);
- THE REQUIRED CHECK NEVER RESOLVED (#186): a superseded
  validator run leaves validate / validate CANCELLED - arming lives INSIDE the
  cancelled run, so the PR sits BLOCKED with autoMergeRequest == null and reads
  as queued. Measured on this repo's own #185 (armed = Y, and cancelled).

The third class reads EVERY run of the required context on the head, not only the
newest: a branch protection rule requires all same-name runs to pass, so an older
CANCELLED beside a newer SUCCESS keeps a PR blocked forever (POISON). FAILURE is
deliberately excluded - a red required check is a verdict, and a red PR gets read.
An unarmed BEHIND/DIRTY head and a head with no run of the required context at all
(the fork case, #179) stay out of scope; under-reporting is the honest failure mode.

report_stalled now emits the remedy per class, including the measured caveat that a
REST re-run is a FRESH REVIEW replacing the verdict (charly#871 turned a PASS into a
BLOCK). The self-test drives one fixture per class, the POISON pair, and six
near-misses; driven with the same fixtures the old filter selects none of the three.
scripts/governance-claims.tsv protects both the new claim and the retirement of the
sentence that declared the cancelled shape out of coverage.

Self-test and the repo's offline battery pass on this tree; the changed detector ran
live against the org (exit 0, nothing silently parked).

Closes #186.

Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS — the changed workflow executed live on this head with the App token.

$ gh workflow run stalled-automerge-detector.yml --repo opencharly/.github --ref feat/stall-detector-nonresolving-checks
https://github.com/opencharly/.github/actions/runs/38311384599
$ gh run view 38311384599 --repo opencharly/.github --json conclusion,event,headBranch,jobs
{"conclusion":"success","event":"workflow_dispatch","headBranch":"feat/stall-detector-nonresolving-checks","jobs":[{"conclusion":"success","name":"detect"}]}
$ gh run view 38311384599 --repo opencharly/.github --log | grep -E 'check-stalled-automerge'
check-stalled-automerge: self-test ok
check-stalled-automerge: no armed+BEHIND, armed+DIRTY or non-resolving required-check PRs in opencharly — nothing is silently parked

A branch-ref run is the only way to execute a changed workflow: the org-required caller resolves its own definition from main, so the scheduled alarm on main would still be running the pre-change script. This run is the changed file as pushed — self-test green, then one live org-wide GraphQL read with the App token, returning the quiet verdict (correct today: no open PR is armed, the two DIRTY ones are unarmed, and the only head with no run of the required context is the fork openclaw-enterprise#1, out of scope by the rule stated in the body).

This is the live half of How tested. The static half — the fixtures that prove each class fires, the old filter failing on the same fixtures, and the repo's offline battery — is pasted in the body against head f52aba40413b7f288152b932796c3e7a4a2c4f46.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: f52aba40413b7f288152b932796c3e7a4a2c4f46 (branch: feat/stall-detector-nonresolving-checks)
Change class: hook/workflow infrastructure (.github workflow + governance script + claims manifest).

Blocks

  1. A1 — the "How tested" block defers required evidence to a comment that does not exist. The body states the changed workflow was executed live on the branch ref (gh workflow run stalled-automerge-detector.yml --ref feat/stall-detector-nonresolving-checks) and that "its run URL and output are posted as the round's comment." The comment thread for this PR is empty (0 comments). So the one piece of evidence specific to this change class (executing the changed workflow) is a pointer to an absent artifact, not pasted output. A1 requires pasted output, not a promise — and the body itself frames the branch-ref run as the necessary proof ("a branch-ref run is the only way to execute a changed workflow"), so it cannot be waved off as optional. Because that run is the only thing that would confirm the new statusCheckRollup/CheckRun read actually resolves under the App's declared pull_requests: read grant (the unchanged "REQUIRED APP PERMISSION" comment in .github/workflows/stalled-automerge-detector.yml), the missing output leaves a real, unverified gap, not just a cosmetic one. Fix: paste the run URL and its console output into the body (or post the round's comment before requesting review); the self-test, git diff --stat, and offline-battery outputs you did paste are internally consistent and are not the issue.

Comment intake

No comments to disposition (thread is empty).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS — round 1 BLOCK addressed: the branch-ref run's output is now pasted in the body, not pointed at, and the body is re-keyed to the same head f52aba40413b7f288152b932796c3e7a4a2c4f46 (no new commit; the head is unchanged, so the diff the review read is the diff that stands).

The finding, and its RCA

A1 — "How tested defers required evidence to a comment that does not exist." The remedy is right and is applied: the changed workflow's live output is now inside the body's ## How tested, in a fence with the head named.

One correction to the finding's premise, because the record has to be right: the comment was not absent. Comment 6133027472 was posted at 21:34:07Z carrying the run URL and its output; the review posted the BLOCK at 21:35:42Z, ninety-five seconds later. The intake line "the comment thread for this PR is empty (0 comments)" does not match the live thread, and "Comment intake: No comments to disposition (thread is empty)" repeats it. I am not using that as an excuse for the finding — see the RCA below — but a re-review that reads the thread will see this comment, and the next reader should not conclude that the evidence was ever missing.

RCA (fresh, per R1).

  • Mechanism. My body made a required evidence class (the changed workflow executing live) exist only as a post-push artifact in a comment. The body's own prose therefore carried a pointer where A1 requires pasted output.
  • Missed control. My pre-push self-audit checked "does every section exist and does every claim have evidence?" but not the sharper question this change class forces: is any evidence class in this body only obtainable after the push? For a workflow change, the branch-ref run cannot exist before the push — so the body must either paste it in a later round (as now), or the pre-push body must not present it as the body's evidence at all. My self-audit had no line for "evidence that cannot exist at body-write time", and that is the gap.
  • Blast radius. Every future PR in this lane whose proof is a branch-ref workflow run, plus the three #175/#186-class rows queued behind it — all of them have the same shape.
  • Root fix. The body now pastes the run; and the rule I am applying from here: no body names a post-push artifact as its evidence — the artifact is pasted in the round's update, and the body is re-keyed after it exists. The pre-push self-audit gains that line (the ledger's §7 records it).
  • Not a workaround. The re-run being requested is the REST re-run of this run on the same head SHA (gh api -X POST repos/opencharly/.github/actions/runs/38311380080/rerun), which is a new attempt whose newer check run supersedes the failure — not a re-dispatch that would mint a second run on the same head.

Nothing else in the verdict stands unfixed, and the verdict raised nothing about the diff.

Evidence, from the head this re-run will review (f52aba40413b7f288152b932796c3e7a4a2c4f46):

$ gh run view 38311384599 --repo opencharly/.github --json conclusion,event,headBranch
{"conclusion":"success","event":"workflow_dispatch","headBranch":"feat/stall-detector-nonresolving-checks"}
$ gh run view 38311384599 --repo opencharly/.github --log | grep -E 'check-stalled-automerge'
check-stalled-automerge: self-test ok
check-stalled-automerge: no armed+BEHIND, armed+DIRTY or non-resolving required-check PRs in opencharly — nothing is silently parked
$ gh pr view 191 --repo opencharly/.github --json body --jq .body > /tmp/live.md
$ grep -c 38311384599 /tmp/live.md                 # the run pasted into How tested
3
$ tail -1 /tmp/live.md                             # the footer is the last line
*Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)*

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: f52aba40413b7f288152b932796c3e7a4a2c4f46 (branch: feat/stall-detector-nonresolving-checks)

Security screen: PASS — observer-only detector change; strengthens detection, weakens no gate; no secrets/egress/new deps; author is a maintainer-set account (@aitrawog).

Checklist: All applicable rules PASS or NA. (A1 body accounts for all 3 files and pastes the branch-ref run output in-body; A2/A3 gate+analysed on a live system tier match the workflow/script class; R0–R10 satisfied — R1 no surviving warning, R5 retired not covered sentence deleted with a forbid row, R7/R10 self-test fixtures fail without the change; PIL/ADE/SDD NA, no candy/schema/cue; ARCH NA, not a charly core/sdk/candy change; DISP NA, no destroy/rebuild; QUAL NA, no Go. Diff git diff --stat counts (193/75) reconcile with the per-file ±counts.)

Comment intake:

  • 6133027472 @aitrawog — verified-non-blocking (live run output, now also pasted in body; consistent).
  • 6133049906 @github-actions[bot] — stale-superseded (its A1 premise "thread is empty" is contradicted by 6133027472 posted 95s earlier, and its core finding — body points at a non-pasted artifact — is resolved: the current body pastes the run URL + output directly).
  • 6133113631 @aitrawog — verified-non-blocking (round-1 finding fixed in-body; fresh RCA naming the missed control supplied).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 12, 2026 21:41
@github-actions
github-actions Bot merged commit 8bb135f into main Oct 12, 2026
3 of 4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a CANCELLED required check is a second silent stall: auto-merge never arms, validate/validate stays cancelled, and the PR reads as queued

1 participant