You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open PRs need a filterable indication of their next action so authors,
reviewers, AI agents and maintainers can hand work back and forth without
losing track of pending reviews or decisions.
Implements the workflow discussed in #3719 using ordinary GitHub Actions,
without a hosted AI triage service, shared personal AI token or per-PR command.
What is changed and the side effects?
Changed:
Define six next-action status labels in a portable review skill and document
them in CONTRIBUTING.md. Add an interactive agent entry point for the skill.
Synchronize lifecycle events, formal review notifications and author replies
using deterministic API checks. Maintainers retain semantic review decisions
and final merge readiness; the workflow never approves or merges a PR.
Receive fork review notifications through a read-only relay. Label writes use
default-branch code and do not execute PR code or consume workflow artifacts.
Track the head accepted as ready to merge and revoke stale readiness after a
head change or an unmet required merge condition.
Rotate through at most 20 PRs per batch. Skip PRs without workflow labels
after 90 days without updates, configurable through PR_WORKFLOW_IDLE_DAYS.
Existing workflow states, direct events and explicit PR requests bypass this
age filter.
Add 40 functional regression cases and a dedicated workflow to run them.
Side effects:
The status workflow needs the built-in token's pull-requests write permission
to manage labels and readiness bookkeeping comments. Semantic interpretation,
AI review scheduling and abandoned-review detection remain manual.
Performance effects: Adds event-driven Actions and a half-hourly bounded
reconciliation batch; no impact on the brpc runtime.
Breaking backward compatibility: None for brpc APIs or runtime behavior.
Check List:
Please make sure your changes are compilable.
When providing us with a new feature, it is best to add related tests.
Track the next PR action with ordinary GitHub events instead of hosted
AI triage and a shared personal token. Keep semantic review and merge
acceptance with reviewers and maintainers.
Use default-branch code for label writes, relay fork review notifications
without privileged PR execution, and invalidate readiness when the head
or required merge conditions change.
Default batch enrollment to PRs updated within 90 days, configurable via
PR_WORKFLOW_IDLE_DAYS. Keep existing workflow states under observation
and always process direct events and explicit PR requests.
Upgrade github-script to v8 to avoid the Node.js 20 deprecation warning
seen in the demo workflow. Keep the runtime update separate from PR
eligibility changes.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues can leave the ready-to-merge label in place despite outside or unauthorized feedback and can abort classification of non-collaborator reviews.
Adds an event-driven GitHub Actions workflow for tracking pull-request next actions through standardized status/* labels while keeping review interpretation and merge decisions with maintainers.
Changes:
Documents six workflow states, handoff rules, and triage guidance.
Adds trusted lifecycle, review-signal, readiness, and reconciliation workflows.
Implements deterministic synchronization with regression tests.
File
Description
CONTRIBUTING.md
Documents the six PR workflow labels and review handoff rules in English and Chinese.
.github/workflows/pr-workflow-checks.yml
Runs regression tests for the PR workflow implementation.
.github/workflows/pr-status-label.yml
Coordinates lifecycle, review, CI, scheduled, and manual synchronization using trusted default-branch code.
.github/workflows/pr-review-signal.yml
Relays pull-request review activity without privileged permissions or pull-request code execution.
.github/skills/pr-workflow/SKILL.md
Defines workflow states, review handoffs, and GitHub usage guidance.
.github/scripts/pr-status-label.test.cjs
Provides functional regression coverage for lifecycle, review, readiness, concurrency, batching, and security behavior.
Require write, maintain or admin permission before recording the head
accepted as ready to merge. A triage-only labeler must hand the decision
to a maintainer. Treat missing collaborators as untrusted and propagate
other permission lookup failures.
Return a ready PR to maintainer evaluation after a new COMMENT review
or outside changes request. Preserve readiness after optional positive
reviews; trusted unanswered changes requests still route to the author.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Fork-controlled relay titles can manipulate another PR’s handoff or readiness, while missing check/status read permissions can prevent reliable readiness verification.
Treat BEHIND as a reason to revoke merge readiness
.github/scripts/pr-status-label.cjs:204
When branch protection requires an up-to-date branch, a base-branch update can produce BEHIND while the current head's checks and approvals still pass. This condition preserves status/ready-to-merge despite that unmet merge requirement. Include BEHIND among the states that return the PR to awaiting-maintainer.
Preserve authorized readiness labels during label swaps
.github/scripts/pr-status-label.cjs:228
A label swap can run its unlabeled job before the readiness labeled job, so this missing-tracker branch removes a maintainer decision that has not been recorded yet. The same loss occurs when the readiness event first encounters conflicting labels at line 147. Recover the authorized label application and its accepted head before treating a missing tracker as stale, while still rejecting unauthorized or superseded readiness.
Ignore author replies that predate the active handoff
.github/scripts/pr-status-label.cjs:240
A queued author comment can run after a newer awaiting-author handoff and incorrectly clear its unanswered feedback; the review-signal path also reuses historical replies at line 298. Compare response timestamps with the active handoff or changes request before transitioning, rather than checking only author identity or whether any reply exists.
Requeue superseded review handoffs after a head update
.github/scripts/pr-status-label.cjs:256
If the current review finishes on the old head after a push, this return discards its completion, while the push handler and routine scans retain review-in-progress. The revised PR can then remain outside the review queue although that handoff has ended. Track the head covered by the active review and return only superseded handoffs to ready-for-review, preserving any newer accepted review.
Do not treat edits to old reviews as current review completion
.github/scripts/pr-status-label.cjs:263
The relay runs for edits as well as submissions, so workflow_run.created_at can make an old submitted review look newer than the current handoff. Editing that old COMMENT review can then end a newly accepted review by moving review-in-progress to awaiting-maintainer. Preserve and validate the review-event action, then distinguish edited feedback from completion of the current review while retaining dismissal handling.
Detect review-thread replies as author responses
.github/scripts/pr-status-label.cjs:284
Author review-thread replies are not returned by issues.listComments, so answered feedback stays in or returns to awaiting-author. Include those replies in response detection, and relay pull_request_review_comment through the read-only notification workflow (.github/workflows/pr-review-signal.yml:25) so the handoff runs when they arrive.
Validate review withdrawals against the active blocking request
.github/scripts/pr-status-label.cjs:290
An approval on a revised head leaves awaiting-author set because currentReviews omits that reviewer's previous changes request. Conversely, any dismissal is considered a withdrawal, so dismissing an unrelated approval clears a newer author handoff. Determine withdrawal from the prior formal opinion and the blocking request behind the current handoff, using dismissal history when needed.
Prevent concurrency from dropping unprocessed PR events
.github/workflows/pr-status-label.yml:85
cancel-in-progress: false still allows a newer job to replace an older pending job in this group. A CI completion can therefore discard a review, author-reply, or readiness-label event, while routine scans preserve explicit states and never recover its handoff. Keep per-PR writes serialized, but reconcile unprocessed activity from durable API history or use a queue that does not drop these events.
Allow pending per-PR jobs to queue rather than replacing one another.
Grant the sync token the check and status read permissions required by
its merge-readiness query.
Use GitHub-owned PR associations only to select work. Relay titles and
run times must not authenticate review activity or replay old feedback.
Reconcile reviews, dismissals and author replies against label history
so scheduled scans can recover missed notifications.
Record accepted review heads, preserve newer tasks and account for label
swap ordering without inventing a head accepted for merge. Keep author
self-reviews separate from independent reviews and enforce strict branch
update requirements only when branch protection or rulesets enable them.
Addressed the latest review in 2b740e3 and 5ccc570. The three inline findings have individual replies. For the eight additional findings in the review summary:
BEHIND: readiness is revoked when legacy branch protection or a ruleset requires an up-to-date branch. A loose policy does not block an otherwise ready PR solely because it is behind.
Label swaps: an authorized ready-label event records its exact head even during a transient label conflict. If the other swap job runs first, an authorized application gets up to ten minutes for that record; an unconfirmed application then returns to maintainer. A push cannot borrow this grace period, and required merge conditions are still checked while waiting.
Old author replies: replies must postdate the active author handoff. Edits to old replies do not make them new responses. Historical answers can still prevent unrelated later feedback from incorrectly reopening the same request.
Superseded review heads: accepted review labels record the exact head and label-event ID. A changed head requeues that recorded task; a newer acceptance is preserved. Existing labels without a trustworthy head record remain for human judgment rather than guessing their scope.
Edited reviews: the relay no longer subscribes to review edits. Reconciliation uses original submission timestamps and GitHub dismissal history, not workflow creation time, so old edits cannot complete a newer task.
Thread replies: the read-only relay now also wakes on new review-thread comments. Reconciliation reads thread comments and recognizes fresh author responses as requests for verification.
Withdrawals: cross-head approvals and dismissal history are checked against the prior trusted blocking opinion. Unrelated approval dismissals do not clear author work, remaining unanswered requests stay with the author, and manually assigned author questions are preserved.
Dropped pending jobs: per-PR concurrency uses queue: max. Periodic reconciliation also processes API activity newer than the current handoff, recovering missed notifications without replaying older activity.
All 57 functional tests pass locally, along with JavaScript syntax, workflow YAML and skill validation. The added branch-protection GraphQL fields and branch-rules endpoint were also checked read-only. These commits are pushed; live execution of the new privileged synchronization path has not yet been verified.
ASF disables pull_request_target, so manual label and close events were
not received by pr-status-label.yml. Split PR lifecycle notifications
into zero-permission pull_request signal workflows (PR label signal and
PR activity signal) that wake the default-branch workflow_run receiver,
and skip non-status label runs to avoid unnecessary runner usage.
Address PR apache#3786 review feedback and modularize pr-status-label.cjs:
- Resolve fork PRs on workflow_run via head branch/SHA across open and
closed PRs, and verify PR label signal definitions via 3-way merge-base
blob comparison so un-rebased PRs still confirm labels safely.
- Bind ready-to-merge confirmations to specific label event IDs, keep
delayed review-in-progress heads for requeueing (including triage
reviewers), and tolerate minor PR updated_at timestamp drift.
- Combine merge-readiness checks and review classification into a single
state decision, prefer populated test-merge check rollups, classify
existing current-head reviews before requeuing superseded heads, and
exclude dismissed-only reviews.
- Match thread replies to their owning review via in_reply_to_id, guard
null review/PR user identities, preserve concurrent manual handoffs on
post-write readback, and refactor sync() into focused helpers with
regression tests.
Update .github/skills/pr-workflow/SKILL.md to document the read-only
signal workflows, merge-base signal definition verification, fork PR
association lookup, label-event-bound readiness records, test-merge check
precedence, per-review thread replies, and post-write conflict rollback.
Fix two edge cases in pr-status-label.cjs:
- Verify the target base branch's pr-label-signal.yml blob before
accepting a matching head blob, so a modified non-default base branch
cannot supply an untrusted merge result.
- Keep current-head formal opinions from being overwritten by a later
approval or dismissal targeting an older commit, while preserving
cross-head withdrawals submitted on the current head.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved synchronization races and response-tracking errors can leave PR status labels incorrect, while unknown mergeability can incorrectly preserve ready-to-merge status.
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
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.
What problem does this PR solve?
Issue Number: N/A
Problem Summary:
Open PRs need a filterable indication of their next action so authors,
reviewers, AI agents and maintainers can hand work back and forth without
losing track of pending reviews or decisions.
Implements the workflow discussed in
#3719 using ordinary GitHub Actions,
without a hosted AI triage service, shared personal AI token or per-PR command.
What is changed and the side effects?
Changed:
them in CONTRIBUTING.md. Add an interactive agent entry point for the skill.
using deterministic API checks. Maintainers retain semantic review decisions
and final merge readiness; the workflow never approves or merges a PR.
default-branch code and do not execute PR code or consume workflow artifacts.
head change or an unmet required merge condition.
after 90 days without updates, configurable through PR_WORKFLOW_IDLE_DAYS.
Existing workflow states, direct events and explicit PR requests bypass this
age filter.
Side effects:
to manage labels and readiness bookkeeping comments. Semantic interpretation,
AI review scheduling and abandoned-review detection remain manual.
reconciliation batch; no impact on the brpc runtime.
Check List: