fix: request Actions capability for auto-pilot create-pr dispatches - #2870
Conversation
The Create PR step issues four createWorkflowDispatch calls but its token client requested only issues:write and contents:read, so the load balancer could hand it GITHUB_TOKEN, which advertises no workflow-dispatch capability at all. Mirrors the monitor-pr fix in #2869.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
📝 WalkthroughWalkthroughThe create-PR retry configuration now requests ChangesWorkflow permissions
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Automated Status SummaryHead SHA: b232bb1
Coverage Overview
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
There was a problem hiding this comment.
Pull request overview
This PR fixes auto-pilot “create PR” dispatch reliability by ensuring the token selection logic can choose a client that is actually allowed to call createWorkflowDispatch (i.e., has workflow-dispatch capability via actions:write).
Changes:
- Add
actions:writeto thecapabilitieslist for the “Execute step - Create PR” token-aware client. - Mirror the same change in the consumer template workflow to prevent template drift.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/agents-auto-pilot.yml |
Requests actions:write for the create-pr task so dispatch calls won’t be routed to a token lacking workflow-dispatch capability. |
templates/consumer-repo/.github/workflows/agents-auto-pilot.yml |
Keeps the consumer template byte-aligned with the source workflow by applying the same capability change. |
Closer verifier disposition — terminal
|
Summary
Bounded follow-up to #2869 (merged
81e5821). That PR addedactions:writeto theauto-pilot-monitor-prtoken client so the stall handoff could dispatch a keepalive workflow. Verifying it surfaced the same defect, still unfixed, on a busier path.The
Execute step - Create PRclient declarescapabilities: ['issues:write', 'contents:read']but issues fourcreateWorkflowDispatchcalls (belt-dispatcher and belt-worker-dispatch). Those capabilities normalize towrite-repo/comments/labels/read-repo(token_load_balancer.js:130-144), all of whichGITHUB_TOKENadvertises (:68), whileGITHUB_TOKENcarries noworkflow-dispatchcapability at all (:69-70show onlyPATandAPPdo). The load balancer could therefore select a token that definitively cannot dispatch, andwithRetrydoes not rotate on permission errors, so the dispatch returns 403.This adds
actions:writeto that one capability array, matching the shape already used byauto-pilot-capability-check,auto-pilot-redispatch, and nowauto-pilot-monitor-pr.Why this is safe
createTokenAwareRetryinitializescurrentGithubto the default Actions client and replaces it only whengetOptimalTokenreturns a token (github-api-with-retry.js:572-589). If noworkflow-dispatch-capable token is configured — the typical consumer-repo case — selection returnsnulland the step keeps the default client, which is exactly the pre-change behavior. The change can only narrow selection toward tokens that can actually dispatch; it cannot strand a repo.Not addressed here, deliberately
Choosing
ACTIONS_BOT_PAToverSERVICE_BOT_PATwithin the workflow-dispatch-capable set is a separate, repo-widetoken_load_balancer.jsdesign property:TOKEN_CAPABILITIES.PATblanket-advertisesworkflow-dispatchfor every PAT (:69), and none of the four dispatching auto-pilot tasks appear in anyTOKEN_SPECIALIZATIONS[*].primaryTasks(:95-128), sotaskBonusstays0(:805-808) and selection falls back to remaining quota. Fixing that means either routing dispatch calls through aworkflow-dispatchspecialization or recording real per-PAT scopes — both larger than this change. See the discussion on #2869.Validation
Both files are byte-identical after the edit (they produced the same git blob
b8ffd84), so template drift stays clean.Summary by CodeRabbit