auditor: route every workflow through commit-via-pr (no direct pushes to main) - #707
Merged
Conversation
… to main) Completes the phase-2 migration #299 opened but never landed. On main today only auditor-track.yml used commit-via-pr.sh; the other ~15 commit sites across 12 workflows still pushed directly to main. This routes all of them through the auto-merging bot-PR flow, so nothing pushes to main directly. The blocker #299 never solved: commit-via-pr.sh had no conflict handling, so two bot PRs touching the same append-only file (events.jsonl, repos.json) stalled — the exact pileup the stale track: PRs demonstrated. Fixed here: - commit-via-pr.sh: after enabling auto-merge, watch the PR briefly; on a CONFLICTING state rebase the bot branch onto latest main using the shared resolve-merge-conflicts.sh (same resolver git-push-with-retry.sh uses for direct pushes, so conflict-stage semantics match), force-push, re-assert auto-merge. Guards the empty-after-rebase case (commit already upstream → close the redundant PR, never leave a zero-commit stuck PR). Documents sequential-call chaining (converges via idempotent merges). - auditor-unstick-bot-prs.yml + unstick-bot-prs.sh: a 30-min janitor that reconciles any bot PR left DIRTY after its opening job exited (a sibling merging asynchronously) — the async safety net the in-run loop can't cover. - 20 commit sites migrated: git commit + (git-push-with-retry.sh | inline push-retry loop) → git add + commit-via-pr.sh. PAT_TOKEN added to each step's env; dead git config/remote set-url removed. Untouched by design: auditor-track.yml (already migrated); cite-exemplars (human-gated feature-branch PR); the refine-rules refinement PR (only its separate log-to-main push migrated). Supersedes #299. Verified: all workflow YAML valid; both scripts bash -n clean; no residual direct-to-main pushes in auditor workflows; unittest suite green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #299. Completes the "nothing pushes to main directly" migration #299 opened on 2026-06-05 but never landed — and fixes the reason a naive version would have made things worse.
Why #299 couldn't just be rebased
On
maintoday, onlyauditor-track.ymlusescommit-via-pr.sh; the other ~15 commit sites across 12 workflows still push directly to main. #299's June diff targeted the June versions of those files (all rewritten since), so it's unrebaseable — and because GitHub "mergeable" only means no textual conflict, merging it as-is would have migrated a few June-era push points and left the newer ones direct: a partial migration that silently fails the goal.The real blocker: the PR flow had no conflict handling
The repo already had two commit paths:
git-push-with-retry.sh— direct push to main, with rebase+resolve reconciliation (robust, no pileup).commit-via-pr.sh— bot-PR flow, no reconciliation.Moving everything to the PR flow without reconciliation recreates the exact pileup the stale
track:PRs demonstrated (two bot PRs touchingevents.jsonl/repos.jsonconflict; the second stalls). So this PR gives the PR flow the same reconciliation the direct path already had.What's here
commit-via-pr.sh— reconcile loop. After enabling auto-merge, watch the PR briefly; onDIRTY, rebase the bot branch onto latest main via the sharedresolve-merge-conflicts.sh(same resolver, same conflict-stage semantics asgit-push-with-retry.sh), force-push, re-assert auto-merge. Guards the empty-after-rebase case (commit already upstream → close the redundant PR rather than leave a zero-commit stuck PR). Fail-soft throughout — a stuck PR never fails the workflow that opened it.auditor-unstick-bot-prs.yml+unstick-bot-prs.sh— janitor. Every 30 min, reconciles any bot PR leftDIRTYafter its opening job exited (a sibling merging asynchronously) — the safety net the in-run loop structurally can't cover. Deterministic, no LLM.20 commit sites migrated across 12 workflows:
git commit+ (git-push-with-retry.sh| inline push-retry loop) →git add+commit-via-pr.sh.PAT_TOKENadded to each step's env; deadgit config/remote set-urlremoved.Untouched by design:
auditor-track.yml(already migrated);auditor-cite-exemplars.yml(human-gated feature-branch PR, not a main push); the refine-rules refinement PR (only its separate log-to-main push was migrated).One behavior to know: sequential calls
Jobs that commit twice (case-study always; audit when security-blocked) chain commits — the second PR contains the first's commit. This converges correctly (append-only logs union, registry 3-way merges, idempotent at merge regardless of order); the one hazard (rebase empties a branch) is handled by the empty-PR guard. Documented in the
commit-via-pr.shheader.Verification
bash -nclean.git-push-with-retry.shsurvives only in the out-of-scopenlpm-self-check.yml).PAT_TOKEN.Recommendation
Merge this, then close #299 as superseded. This is a large, pipeline-wide change with real blast radius — please review the reconcile loop and the janitor before merging. Nothing here is auto-merged.