fix(dispatch): route pull_request_target.labeled to review stage - #5015
Conversation
Bot-authored PRs (e.g. fullsend-ai-coder[bot]) fail the is_event_actor_authorized check on pull_request_target.opened because GitHub App accounts lack a collaborator role in the permission API. PR #2679 added a ready-for-review label in post-code.sh to use the label-based dispatch path, but pull_request_target.labeled was not handled in the dispatch routing — only issues.labeled was. Since GitHub does not fire issues.labeled for PRs, the label was silently ignored. Add a labeled) case under pull_request_target) in both dispatch files so ready-for-review triggers review dispatch. The label path needs no explicit auth gate because label application already requires write access. Also add Go test coverage for bot-opened PR detection (ActorBot + RoleNone) and document that the pre-CEL auth gate intentionally does not bypass write checks for bot-opened events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Hector Martinez <hemartin@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 1:57 PM UTC · Completed 2:11 PM UTC |
PR Summary by QodoFix dispatch routing for pull_request_target.labeled → review stage
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Code Review by Qodo
1. Bot PRs still fail auth
|
ReviewFindingsMedium
Low
|
Closes #2674
Summary
labeled)case underpull_request_target)in both dispatch files soready-for-reviewtriggers review dispatchActorBot+RoleNone)Problem
Bot-authored PRs (e.g.
fullsend-ai-coder[bot]) never get automated review. Theis_event_actor_authorizedcheck onpull_request_target.openedcallshas_write_permission, which queries the GitHub collaborator permission API. GitHub App bot accounts authenticate via installation tokens, not the collaborator model, so the API returns a non-write role and dispatch silently skips.PR #2679 tried to fix this by having
post-code.shapply aready-for-reviewlabel to use the ungated label dispatch path. But the shim subscribes topull_request_target: [opened, synchronize, ready_for_review, closed]withoutlabeled, andissues.labeleddoes not fire for PRs. The label was applied but never triggered dispatch.Fix
The shim template already includes
labeledinpull_request_target.types(it just hasn't been reconciled to all repos yet). This PR adds the missing routing: alabeled)case underpull_request_target)that dispatches toreviewwhenready-for-reviewis applied. No explicit auth gate is needed because label application itself requires write access.Test plan
go test ./internal/harnessdispatch/...passesSTAGE=reviewforpull_request_target.labeledevents withready-for-review🤖 Generated with Claude Code