Repository navigation
feat(org): detect PRs whose auto-merge is armed but which can never land (#175) - #185
Conversation
#175 measured a silent stall: armed auto-merge + the org ruleset's strict required checks + a BEHIND head. GitHub's auto-merge does not update a head branch when the base moves, nothing re-dispatches the required check, and no check goes red — ~10 h with zero landings while seven PRs sat green or armed. The RCA ends with the line that makes the fix small: the state is one API field away, and nothing read it. - scripts/check-stalled-automerge.sh: one org-wide GraphQL read projecting exactly autoMergeRequest and mergeStateStatus; selects armed + BEHIND; prints each with its remedy and exits 1. A failed query exits 2 rather than reporting "nothing stalled". - .github/workflows/stalled-automerge-detector.yml: every 30 minutes, through the charly-auto-merge App token the landing chain already uses, so no new grant is introduced. The script carries its own scope limit: a CANCELLED required check (a superseded validator run leaving the PR BLOCKED and unarmed) is a different shape and is not covered. Tested: the self-test asserts an armed+BEHIND fixture IS selected, three near-misses are NOT, and that the filter does not select nothing — a selection rule that can never select is a green no-op. The live org scan returned a true negative; the repo harness (414 assertions) and org-ruleset_test pass unchanged. Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: CI/org tooling — one scheduled detector workflow ( Blocks
Security screenNo T1–T4 finding. The change is additive (a new reader + a scheduled alarm), touches no gate decision, weakens no guardrail, and introduces no new credential (reuses the existing Comment intakeThread is empty (0 comments) — nothing to disposition. Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review round 1, findings 1-3 (#185). - report_stalled is extracted from main so the stalled branch — the exit 1 plus the remedy loop that IS the detector's product — is driven by the self-test. It was previously exercised by nothing: the live org scan took the exit-0 branch, which proves nothing about the alarm. - the redundant "cannot select" third assertion is REMOVED, not reworded. A filter that selects nothing already fails assertion 1, so the third could not fail independently. - the cancelled-required-check shape is filed as #186 and listed under Filed issues, rather than parked with a phrase. The new assertion is proven able to fail: mutating the remedy line makes the self-test report "the stalled branch did not emit its remedy". Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS (T1–T4) — additive detector workflow + shell script; no gate/rulebook/validator-spec change, no new credential (reuses the existing Comment intake: Non-blocking note (no stated rulebook obligation, not a gate): the GraphQL query uses Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — additive org tooling; no gate/ruleset/validator modified, no new credential (reuses the existing Checklist: All applicable rules PASS or NA. Change class = CI/org tooling (one scheduled detector workflow + one shell script); no runtime/candy/docs surface. Tier Comment intake: 1 comment — prior BLOCK by @github-actions[bot] at head Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS (T1–T4) — additive detector workflow + shell script; no gate/ruleset/rulebook/validator-spec change, no new credential (reuses the existing Comment intake (3):
Non-blocking note (no stated rulebook obligation): the GraphQL query uses Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
#458) #433 reported `charly task sync` advancing 67 gitlinks on this umbrella. Measured today from `origin/main` @ dc05b67, it advances THREE: dotgithub, plugin-check, plugin-pipeline and all three are pins onto merged work from this triage session — the stalled-auto-merge detector (opencharly/.github#185), the check-run vocabulary (opencharly/plugin-check#98, #99) and the agent stage's skill references (opencharly/plugin-pipeline#39). The debt is paid; what remained was the pins catching up to it. Advanced with `charly task sync` — the sanctioned route — and this repo's own gate passes on the result: `node scripts/check-validator-rule-map.mjs` → rc=0, 5/5 PASS. Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)
…lf (#191) 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)
Summary
opencharly/.github#175's RCA is precise: native auto-merge armed + the org ruleset'sstrict: truerequired checks + aBEHINDhead = a silent stall, measured over ~10 h on 2026-10-07/08 with zero landings while at least seven PRs sat green or armed. The issue ends with the line that makes this fix small:So this adds the reader. Not a missing capability — a missing reader, which is why the change is one script and one thin workflow.
What it adds
scripts/check-stalled-automerge.sh— one org-wide GraphQL read (org:opencharly is:pr is:open) projecting exactlyautoMergeRequestandmergeStateStatus, then the selection rule the RCA names:autoMergeRequest != null AND mergeStateStatus == "BEHIND". It prints each stalled PR with the remedy and exits 1; nothing stalled exits 0; a failed query exits 2 rather than reporting "nothing stalled" — a detector that reads green off a failed read is worse than none..github/workflows/stalled-automerge-detector.yml— every 30 minutes plusworkflow_dispatch, through thecharly-auto-mergeApp token the landing chain already uses, so no new app grant is introduced. The alarm is a red run: visible in the Actions tab, and one scheduled job instead of a hook installed in ~400 repos.The scope limit, in the script rather than left to be discovered
This detects the shape the RCA measured and nothing else. A
CANCELLEDrequired check — a superseded validator run leavesvalidate / validatecancelled and the PRBLOCKEDwith auto-merge never armed — is a different shape with a different remedy, is not covered, and is not claimed to be. Not hypothetical: it is whatopencharly/charly#871showed earlier today. Naming the uncovered shape is the difference between a detector and one that gets trusted for more than it does.How tested
The self-test drives the STALLED branch, not only the filter.
report_stalledis extracted frommainso the alarm — theexit 1and the remedy loop that IS this change's product — is executed by a test. The first version exercised only the pure filter, and the live scan took the exit-0 branch: a true negative proves nothing about the alarm. The assertion is proven able to fail: mutating the remedy line makes the self-test reportthe stalled branch did not emit its remedy.And the earlier third assertion is REMOVED, not reworded. The reviewer was right that "the filter can never select nothing" cannot fail independently — a filter that selects nothing already fails the first assertion. A redundant check that cannot fail on its own is exactly what R7 calls invalid, so it is gone rather than dressed up.
The rest of the first version's evidence, which still holds:
The self-test is the R7 evidence, and it is built to be able to fail. It asserts an armed+
BEHINDfixture is selected; that three near-misses are not (armed butCLEAN;BEHINDbut unarmed; unarmedBLOCKED); and — the assertion that keeps the whole detector honest — that the filter does not select nothing, because a selection rule that can never select is a green no-op. For a detector, "it selects nothing and always passes" is the failure to guard against, so the guard is an assertion of its own.The live scan is a true negative — nothing is parked in that shape today — which is exactly why the fixtures, not the org, are what proves the rule.
Rulebook compliance
/charly-internals:repo-setup(this repo's own first instruction for dotgithub workflow config) and/charly-internals:git-workflowloaded before the git actions.scripts/or.github/read either field. The uncovered second shape is named rather than implied.git rev-parse --show-toplevelis the worktree;originisopencharly/.github), branched off freshorigin/main; no force-push, no bypass, no direct push tomain.workflow_dispatchafter merge. Stated rather than dressed up as a bed.Filed issues
opencharly/.github#186— aCANCELLEDrequired check is a second silent stall: auto-merge never arms,validate / validatestays cancelled, and the PR reads as queued. Filed rather than parked with a phrase. It is a different shape from this one (no armed request, no base movement, and a different remedy), and the issue records the part that genuinely needs measuring first: a re-run of a cancelled validator is a fresh review, not a neutral repair — oncharly#871it replaced aPASSwith aBLOCK.A reviewer note, rebutted with evidence
The security screen's only note was that
actions/checkout@v7is a floating tag "inconsistent with that pinning discipline". That is this repo's own convention, not an oversight:actions/checkout@v7appears 9 times across.github/workflows/, and the SHA pinning discipline it is being compared to applies to third-party actions (create-github-app-tokenis pinned, and so is it here). Matching the repo is the correct behaviour; pinning one of nine would be the inconsistency.Change classification
CI/org tooling — a detector for a measured, silent failure mode. No product surface changes. Tier:
analysed on a live system. Corrected downward after review, and the correction is the reviewer's: the changed artefact ran live against the real org (theexit 0branch), the alarm branch is now covered by a test proven able to fail, and this repo's own harness passes — butfully tested and validatedwould claim the change-class gate passed on the final tree, and the final tree's own workflow has not run yet. A tier is earned by what executed, not by what the diff makes likely.Agent:
org-triage-2026-10-09(issueopencharly/.github#175, claimed)Assisted-by: DSH DeepSeek deepseek-v4.1-flash (analysed on a live system)