Repository navigation
[Fix] Fork PR review-state labels stay stale until the hourly sweep - #2049
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
e394ec4 to
98b6d89
Compare
98b6d89 to
a04e027
Compare
…he label workflow (Zoo-Code-Org#2088) * fix(ci): move fork review follow-up out of label-pr-review-state so GitHub accepts the workflow GitHub rejects a workflow that lists its own name in workflow_run.workflows, so no schedule, pull_request_target, issue_comment, or workflow_run runs of 'Label PR review state' started since PR Zoo-Code-Org#2049 merged. - Remove 'Label PR review state' from its own workflow_run.workflows list. - Remove the workflow_run.name loop-guard clause from the resolve and reconcile job if conditions and from the resolve script. - Move the privileged fork pull_request_review follow-up (issue Zoo-Code-Org#2046) into a new workflow, label-pr-review-state-fork-review-followup.yml, which listens for completed 'Label PR review state' runs, keeps the one-hop loop guard on workflow_run.event == 'pull_request_review', resolves fork PRs by exact head owner, branch, and SHA, and dispatches the reconciliation workflow's existing workflow_dispatch entrypoint. - Add workflow-self-listen.test.ts, which fails when any workflow lists its own name in workflow_run.workflows (actionlint does not catch this), and wire it plus the new follow-up workflow tests into the test:workflow suite. Closes Zoo-Code-Org#2086 * fix(ci): handle dispatch failures and widen follow-up tests --------- Co-authored-by: Roomote <roomote@roomote.dev> Co-authored-by: Elliott de Launay <edelauna@gmail.com>
Related GitHub Issue
Closes #2046
Description
A review on a fork PR runs with a read-only
GITHUB_TOKEN. The workflow computes the right label but skips the write, so labels stay stale until the hourly sweep or another trusted event.This PR implements the fix proposed in the issue:
workflow_run.workflows. A forkpull_request_reviewrun's completion then re-triggers the workflow with a privileged token that writes the computed labels.resolvejob accepts aworkflow_runof this workflow only whengithub.event.workflow_run.event == 'pull_request_review'. This is the loop guard. A run triggered byworkflow_runhas eventworkflow_run, so the next level is filtered out and the chain stops after one hop. The guard sits in both jobs'ifconditions and in the resolve script, matching the existingissue_commentdefense-in-depth pattern.workflow_run.pull_requestsempty, and the workflow already resolves those by exact head owner, branch, and SHA.Reviewers should check with care: the guard keys on
workflow_run.name == 'Label PR review state'. A workflow rename must update the guard expressions, the script check, and theworkflow_run.workflowslist together.Test Procedure
New tests in
src/services/__tests__/pr-review-state-workflow.test.ts(describe blockfork review self-follow-up (#2046)):workflow_runfollow-up resolves the PR by exact head and writes the label.workflow_runtriggered by a non-review run (schedule,push,workflow_dispatch,pull_request_target) is ignored.workflow_runwith eventworkflow_runis ignored, so the chain stops after one hop.The test harness now models
workflow_run.nameandworkflow_run.eventin the event payload. Existingworkflow_runtests default to a listed CI workflow and stay outside the guard.Checks run: the targeted Vitest suite (204 tests) passes. ESLint with
--prune-suppressions --max-warnings=0andtsc --noEmitpass on the changed files. The fullpnpm testat the repository root passes (13/13 turbo tasks).Reviewers can repeat this with:
pnpm --dir src exec vitest run services/__tests__/pr-review-state-workflow.test.ts.Pre-Submission Checklist
Visual Snapshots
Not applicable. This PR changes CI workflow behavior only; there is no rendered UI state to snapshot.
Videos (interaction / animation only)
Not applicable. No interaction or animation changed.
Documentation Updates
Additional Notes
The alternative from the issue (shortening the sweep interval to 15 minutes) is not implemented. It costs 4 times the API calls against a shared rate-limit pool.
Get in Touch
0x7777777_ on Discord