Skip to content

ci(pr-review): trigger OpenAB PR Review on PR events, not just cron#1218

Merged
thepagent merged 1 commit into
mainfrom
ci/pr-review-on-pr-events
Jun 27, 2026
Merged

ci(pr-review): trigger OpenAB PR Review on PR events, not just cron#1218
thepagent merged 1 commit into
mainfrom
ci/pr-review-on-pr-events

Conversation

@chaodu-agent

Copy link
Copy Markdown
Collaborator

What problem does this solve?

OpenAB PR Review is a required status posted only by the */5 cron poller in pr-bot-review.yml. GitHub throttles scheduled workflows (observed: actual runs hours apart, not every 5 min), so after a push or rebase the new head SHA sits in "Expected — Waiting for status to be reported" for a long time, blocking the PR.

Change

Add a pull_request trigger so the review runs promptly on every head change:

on:
  pull_request:
    types: [opened, synchronize, reopened]
  schedule:
    - cron: '*/5 * * * *'   # kept as safety net
  workflow_dispatch: {}

Why this is safe (no other changes)

  • Per-SHA dedup: the job already skips PRs whose current head SHA was already reviewed, so event-driven runs only review the PR that actually changed.
  • Cron kept as a backstop (catches fork PRs where the event-triggered GITHUB_TOKEN is read-only and can't write statuses, plus anything missed).
  • Concurrency left as-is (pr-review-poller, cancel-in-progress): for this repo (same-repo branches, low PR velocity) cross-PR cancellation effectively never happens; and cancelling a superseded same-PR review is the desired behavior (review the latest SHA).

Effect

A rebase/push now posts OpenAB PR Review within a minute or two instead of waiting on the throttled cron.

Note

For fork PRs, pull_request runs with a read-only token and can't write the status — those continue to be handled by the cron poller (which runs with full permissions). Same-repo PRs (the common case) post promptly.

…min cron

The 'OpenAB PR Review' required status is posted only by the */5 cron poller.
GitHub throttles scheduled runs, so after a push/rebase the new head SHA can
sit in 'Expected — Waiting for status to be reported' for a long time.

Add a pull_request trigger (opened/synchronize/reopened) so the review runs
promptly on every head change. The cron stays as a safety net, and the
existing per-SHA dedup avoids redundant reviews. Concurrency is left as-is
(same-repo, low-velocity; superseded same-PR reviews cancelling is desirable).
@chaodu-agent
chaodu-agent requested a review from thepagent as a code owner June 27, 2026 02:17
@thepagent
thepagent enabled auto-merge (squash) June 27, 2026 02:17
@chaodu-agent

Copy link
Copy Markdown
Collaborator Author

LGTM ✅ — Minimal, safe trigger addition that eliminates cron-throttle latency for same-repo PRs.

What This PR Does

Adds a pull_request event trigger (opened, synchronize, reopened) to the cron-only review workflow so that OpenAB PR Review status is posted within minutes of a push/rebase instead of waiting on GitHub's throttled */5 cron schedule.

How It Works

Two-line addition to the on: block. The existing per-SHA dedup logic ensures no double-reviews, and the cron is kept as a safety net for fork PRs (where pull_request tokens are read-only).

Findings

# Severity Finding Location
1 🟢 Clean minimal change — only touches the trigger, no logic changes .github/workflows/pr-bot-review.yml
2 🟢 PR body clearly explains fork-PR limitation and concurrency tradeoff
3 🟢 Dedup via status check remains intact — no risk of redundant reviews
Finding Details

🟢 F1: Minimal, safe change

Only adds 2 lines to the on: block. No behavioral changes to the poll/review logic itself.

🟢 F2: Well-documented tradeoffs

The PR body explicitly covers fork-PR read-only token limitation and the global concurrency group behavior. Both are acceptable for this repo's usage pattern.

🟢 F3: Dedup preserved

The poll step already checks commit status state before triggering — a pull_request-initiated review that posts success/failure will be correctly skipped by subsequent cron runs.

Baseline Check
  • PR opened: 2026-06-27
  • Main already has: pr-bot-review.yml with schedule + workflow_dispatch triggers
  • Net-new value: pull_request trigger eliminates multi-hour wait for status on push/rebase
What's Good (🟢)
  • Smallest possible diff for maximum impact on developer experience
  • Retains cron as backstop — no regression for fork PRs
  • Clear, honest PR description with known limitations documented

@thepagent
thepagent disabled auto-merge June 27, 2026 02:18
@thepagent
thepagent merged commit b5c2a11 into main Jun 27, 2026
4 checks passed
thepagent pushed a commit that referenced this pull request Jun 27, 2026
…403) (#1219)

#1218 added a pull_request trigger, but fork PRs run with a read-only
GITHUB_TOKEN, so creating the 'OpenAB PR Review' status 403s and the run
fails (observed on fork PR #1190). Guard the job to run on pull_request
events only for same-repo PRs; forks continue to be handled by the cron
poller (which runs with full permissions). schedule/workflow_dispatch
always run.

Fixes the failing runs introduced by #1218.

Co-authored-by: chaodu-agent <chaodu-agent@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants