Skip to content

ci: schedule contribution gate sweeps (CLI-3160) - #7694

Merged
mdonnalley merged 12 commits into
developfrom
mdonnalley/schedule-contribution-gate
Nov 18, 2026
Merged

mdonnalley merged 12 commits into
developfrom
mdonnalley/schedule-contribution-gate

Conversation

@mdonnalley

@mdonnalley mdonnalley commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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.

@mdonnalley
mdonnalley requested review from a team and supabase-oss as code owners November 18, 2026 19:31
@mdonnalley
mdonnalley requested a review from avallete November 18, 2026 19:31

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

Comment thread .github/workflows/contribution-gate.yml Resolved
Comment thread .github/workflows/contribution-gate.yml Resolved
Comment thread .github/workflows/contribution-gate.yml Resolved
Comment thread .github/workflows/contribution-gate.yml Resolved
@mdonnalley mdonnalley changed the title ci: schedule contribution gate sweeps ci: schedule contribution gate sweeps (CLI-3160) Nov 18, 2026
Comment thread .github/workflows/contribution-gate.yml Resolved
…e-contribution-gate

# Conflicts:
#	.github/MAINTAINERS.md
#	.github/scripts/contribution-gate.ts
#	.github/workflows/contribution-gate.yml
#	CONTRIBUTING.md
@mdonnalley

Copy link
Copy Markdown
Contributor Author

Addressed the review: scheduled events are explicitly allowed, manual sweeps remain restricted to the default branch, and pending sweeps use queue: max. Per-PR failures no longer stop later evaluations, and the run still fails with the affected PR numbers. Retries reuse an existing Actions-bot comment only when its explanation matches; changed reasons get a new explanation. Exempt authors skip linked-issue queries, and permission results are cached per sweep. The inline setup-bun annotation was already restored. Also resolved conflicts with develop after #7693 merged. Targeted regression tests, TypeScript, formatting, and workflow lint pass.

@kanadgupta
kanadgupta self-requested a review November 18, 2026 20:21

@kanadgupta kanadgupta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! sharing a li'l claude analysis below:

Approve. Safe replacement for the removed pull_request_target gate. 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 test on both contribution-gate test files passes locally; formatting clean.

Not verified

  • That a real schedule run passes the job if. 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.

Comment thread .github/workflows/contribution-gate.yml Resolved

@kanadgupta kanadgupta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops

@mdonnalley
mdonnalley enabled auto-merge November 18, 2026 20:50
@mdonnalley
mdonnalley added this pull request to the merge queue Nov 18, 2026
Merged via the queue into develop with commit b77f761 Nov 18, 2026
80 of 81 checks passed
@mdonnalley
mdonnalley deleted the mdonnalley/schedule-contribution-gate branch November 18, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants