Repository navigation
Description
What happened (2026-10-22, ~16:21Z–20:03Z)
PR #5950 had shepherd:merge and edited .github/workflows/det-sweep.yml. AUTOMATION_PAT lacked the Workflows permission, so every gh pr merge --auto call failed:
#5950 auto-merge on: FAILED: GraphQL: Pull request refusing to allow a Personal Access Token to create or update workflow `.github/workflows/det-sweep.yml` without `workflow` scope (enablePullRequestAutoMerge)
shepherd_gh.py exited 1 on that failure, and the PR's shepherd:needs-fix label kept flipping on and off: each reconcile pass removed it, and it was then re-added. Every add or remove fired another shepherd-event.yml run, which failed the same way. Result: about 100 label flips on #5950, about 195 red shepherd runs (99 label-event, 95 reconcile on main) and about 950 runner-minutes, until the owner merged #5950 by hand.
Fix (shepherd only)
- In
apply(), recognise a permanent permission refusal (thewithout \workflow` scope` / "refusing to allow a Personal Access Token" GraphQL error, and similar 403 or permission errors) as distinct from a transient failure. - On that error, label the PR once with an owner-facing status (e.g.
shepherd:needs-owner, or reuse an existing one) and post one comment that says why ("this PR edits workflow files; the shepherd token can't enable auto-merge. Merge it by hand, or give AUTOMATION_PAT Workflows: read and write"). Don't exit non-zero for it. decide()must skip auto-merge attempts on a PR carrying that status, so neither reconcile nor the label event retries it every pass.- Stop the
needs-fixflapping: a pass must not remove a status label that the same or the next pass will put straight back. Add a regression test intests/tools/test_shepherd_gh.pythat replays the Det Sweep: Db2 shards restore the pinned Db2's first start instead of repeating it (Part of #5882) #5950 sequence (merge-ready + auto-merge refused) and asserts there is no label churn and the run does not fail.
Optional: decide() could pre-check whether a PR touches .github/workflows/ and go straight to the owner label, without trying auto-merge first.
Owner side
The owner has updated the token (2026-10-22, ~20:05Z); not yet confirmed on a live workflow-editing PR. The fix above should land regardless, because any future permission gap would cause the same storm.
Evidence: runs 39813308373 (first reconcile failure) … 39844551634 (last label-event failure); #5950 issue events.
Activity
squid-protocol commentedon Oct 22, 2026
Claimed by promoter-bot host
nyx, lease renewed 2026-10-23T19:20Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove theclaim:nyxlabel.CI shepherd: a permanent auto-merge refusal labels shepherd:needs-own…
squid-protocol commentedon Oct 23, 2026
Fixed by #6290: permanent auto-merge refusal now labels shepherd:needs-owner once, posts one comment, exits 0; decide() skips retries; needs-fix flapping suppressed; regression test replays the #5950 sequence. The optional workflow-path pre-check was not done and is not needed for acceptance.