Repository navigation
ci: schedule contribution gate sweeps (CLI-3160) - #7694
Conversation
…schedule-contribution-gate # Conflicts: # .github/scripts/contribution-gate.ts
…arget' into mdonnalley/remove-pull-request-target
…schedule-contribution-gate
There was a problem hiding this comment.
🤖 AI Review
CLI reference prose guidance: not applicable (no reference sources changed).
The PR replaces per-PR enforcement with scheduled and manual sweeps. A persistent failure on one PR can stop every sweep before later PRs are evaluated and can trigger repeated comments if posting succeeds but closing fails. The shared concurrency group can cancel a queued manual dry run. The code confirms that each sweep repeats API calls across the full backlog, while actual rate-limit pressure depends on backlog size and other usage. The scheduled job's guard depends on a payload field whose presence could not be verified from the available artifacts. The PR changes no CLI reference prose.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | .github/workflows/contribution-gate.yml:32 |
ci-correctness |
claude | If GitHub omits repository.default_branch from the schedule event payload, the job guard skips every cron run, leaving manual dispatch as the only enforcement path. |
| 🟠 MAJOR | .github/scripts/contribution-gate.ts:193 |
error-handling |
claude | A persistent error while processing one PR stops each recurring sweep before it reaches later PRs. If the comment succeeds and the close fails, each retry can post another copy of the comment. |
| 🟡 MINOR | .github/workflows/contribution-gate.yml:5 |
performance |
claude | The four hourly sweeps repeat a linked-issue query for every open PR and a permission lookup for each PR whose author needs one, increasing repository API usage in proportion to the backlog. |
| 🟡 MINOR | .github/workflows/contribution-gate.yml:20 |
workflow-concurrency |
codex | A newer workflow run can cancel a pending manual sweep, causing a maintainer's requested dry run to produce no results. |
| ⚪ NIT | .github/workflows/contribution-gate.yml:40 |
style |
claude | The setup-bun version annotation moved above its SHA pin, breaking the inline annotation convention used by the neighboring checkout step and other setup-bun pins. |
Findings outside the diff
- 🟠 MAJOR
.github/scripts/contribution-gate.ts:193— A persistent error while processing one PR stops each recurring sweep before it reaches later PRs. If the comment succeeds and the close fails, each retry can post another copy of the comment.
Stats
Claude findings: 4 · Codex findings: 1 · Confirmed: 4 · Refuted: 0 · Uncertain: 1
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
…schedule-contribution-gate
…e-contribution-gate # Conflicts: # .github/MAINTAINERS.md # .github/scripts/contribution-gate.ts # .github/workflows/contribution-gate.yml # CONTRIBUTING.md
|
Addressed the review: scheduled events are explicitly allowed, manual sweeps remain restricted to the default branch, and pending sweeps use |
kanadgupta
left a comment
There was a problem hiding this comment.
LGTM! sharing a li'l claude analysis below:
Approve. Safe replacement for the removed
pull_request_targetgate. No blocking findings.Verified (code read at
57dd305+ tests)
- Security: only default-branch code runs with the write token; manual runs are limited to the default branch. PR titles, bodies and logins never reach a shell or an expression. Token scope is unchanged.
- Failure isolation: a failing PR is recorded, later PRs still run, and the run fails naming the PR numbers.
- Repeat sweeps: if the comment posts but the close fails, the next sweep reuses the comment and retries the close. Only
github-actions[bot]comments match.- Dry run: returns before any write.
- API usage: exempt authors skip the linked-issue query; permission lookups are cached per sweep, failures are not cached. The current open-PR backlog is small, so the 15-minute timeout is not a concern.
- All 5 earlier bot threads are fixed at head.
- CI green;
bun teston both contribution-gate test files passes locally; formatting clean.Not verified
- That a real
schedulerun passes the jobif. Only provable on the default branch after merge; worth checking the first cron run.- A locked PR, where the comment may be refused. The sweep would then fail every run until someone handles that PR.
Restore automated contribution-gate enforcement after #7693 removed the per-PR trigger. Sweep every 15 minutes, with manual sweeps and dry-run support retained.
Run only trusted default-branch code and treat PR metadata as API data. Keep scoped token permissions, disable the Bun executable cache, and bound each run to 15 minutes. Serialize sweeps and queue pending runs so a scheduled run does not replace a pending manual sweep.
Continue processing later PRs after an individual failure, then fail the run with the affected PR numbers. Reuse existing bot-authored comments when the explanation is unchanged, skip linked-issue queries for exempt authors, and cache permission results within each sweep.
Update contribution documentation to describe scheduled enforcement, possible scheduling delays, and re-evaluation after issue-label changes or PR reopening.