Repository navigation
feat(ci)!: replace the blocked rerun-listener distributor with a capability-free org-wide sweep - #122
Conversation
…ree org-wide sweep
The per-repo listener distributor (dotgithub#121) is BLOCKED: installing a
workflow file org-wide needs a GitHub App with `workflows: write`, which
`charly-auto-merge` does not have (and an App's permission set is UI-only —
there is no API to grant it).
Replace it with a design that needs NO per-repo file and NO `workflows: write`:
- `.github/workflows/rerun.yml` (schedule + dispatch) — does both halves
org-wide from the ONE owner repo:
- `ensure-rerun-label` (scripts/ensure-rerun-label.sh) creates the `rerun`
label in every repo (`issues: write`; the REST add is auto-create, so the
label is present wherever an operator needs it).
- `sweep-rerun` (scripts/sweep-rerun.sh) searches the org for open
`rerun`-labeled PRs, re-runs each one's FAILED `charly/pr-validator` run
(`actions: write`; same GITHUB_SHA, SAME check run in place — no duplicate,
clears POISON), then removes the label (idempotent).
- Both permissions are already granted to the charly-auto-merge App
(issues/actions/pull_requests write) — no capability escalation.
Removed (R5): the distributor files (org-wide-rerun-listener.yml,
scripts/distribute-rerun-listener{,_test}.sh, distribute-rerun-listener.yml).
README section rewritten; both new tests wired into validator-harness.yml.
Gate: validator-gate-harness.py + org-ruleset_test + retire-per-repo-
dispatchers_test + bootstrap-repo-main_test + sweep-rerun_test +
ensure-rerun-label_test, all pass.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
… sole channel (R5) The README named a nonexistent workflow file (sweep-rerun.yml; the added file is rerun.yml), and sweep-rerun.sh's header described the deleted per-repo distributor as live. Both are documentation-vs-reality divergences (R1/R5); fixed to name rerun.yml and describe the sweep as the sole rerun channel.
Review — BLOCKHead SHA: Change class: org CI config + shell scripts (no charly runtime; no candy/CUE/Go code). Blocks
Notes (non-blocking, but reconcile before re-review)
Security screen: no secrets, no egress, no obfuscation, no weakening of this validator's spec or Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS Comment dispositions: #5848680446 (github-actions[bot], head Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
Replace the blocked per-repo rerun-listener distributor (dotgithub#121) with
a capability-free org-wide sweep that needs no per-repo file and no
workflows: write.The diff:
.github/workflows/rerun.yml(new; schedule + dispatch) — the ONE org-wideowner that does both halves:
ensure-label— creates thererunlabel in every repo (issues: write).sweep— finds openrerun-labeled PRs org-wide and re-runs each one'sfailed validator run, then removes the label (
actions: write+pull-requests: write).scripts/ensure-rerun-label.sh(+_test.sh) — idempotent label ensure.scripts/sweep-rerun.sh(+_test.sh) — the sweep.(
org-wide-rerun-listener.yml,scripts/distribute-rerun-listener{,_test}.sh,.github/workflows/distribute-rerun-listener.yml).README.mdsection +validator-harness.ymlwiring updated.RCA (8-step, R1) — MEASURED
Unexpected. dotgithub#121's distributor aborted on dispatch:
Mechanism. Installing
.github/workflows/rerun-listener.ymlorg-wide needs aGitHub App with
workflows: write. Thecharly-auto-mergeApp's permissionsare
actions, contents, deployments, issues, merge_queues, metadata, packages, pages, pull_requests, repository_custom_properties— noworkflows. Per theGitHub docs a GitHub App's permission set can only be changed in its settings
UI — there is no API to grant it; and a direct workflow-file PUT with the
org-owner token returns
409 Required workflow … is not satisfied(only the Appis a ruleset bypass actor).
Fix — remove the dependency entirely
The App does have
issues: write,actions: write,pull-requests: write.The channel is rebuilt from those: a label (created org-wide via the issues
API) is the operator's signal; a scheduled sweep in
.githubfinds labeledPRs and re-runs each one's failed validator run. No per-repo file, no
workflows: write, no capability escalation.How tested
The repo gate (offline, all green) — pasted output
sweep-rerun_test.shcovers: a failed run → rerun + label removed; no failed run→ label removed, no rerun; a head-lookup failure → counted failed; empty search →
clean no-op.
ensure-rerun-label_test.shcovers create vsalready_exists.Live primitives — pasted raw output
The org-wide label search (the sweep's discovery primitive):
The REST add-label auto-creates a missing label (so
ensure-rerun-labelissufficient wherever an operator adds it):
The re-run primitive (measured earlier on sdk#301):
gh run rerunon a failedcharly/pr-validatorrun kept exactly ONEvalidate / validatecheck-run on thehead before and after (no duplicate).
Rulebook compliance
workflows: write) is removed, notbypassed.
stale README/script references are corrected.
ghtests.Change classification
analysed on a live system— the discovery/auto-createprimitives ran live against GitHub; the scheduled sweep's org-wide effect is
operator-observable (its full cross-repo run has not executed).
Supersedes dotgithub#121 (blocked distributor).
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)