Skip to content

Add automation to auto-close stale external contributor PRs#12102

Open
vkodithala wants to merge 2 commits into
masterfrom
varoon/stale-pr-cleanup
Open

Add automation to auto-close stale external contributor PRs#12102
vkodithala wants to merge 2 commits into
masterfrom
varoon/stale-pr-cleanup

Conversation

@vkodithala
Copy link
Copy Markdown
Contributor

@vkodithala vkodithala commented Jun 2, 2026

Description

Adds a scheduled GitHub Action (.github/workflows/stale_requested_changes_prs.yml) that follows up on external-contributor PRs which have an active requested-changes review and have gone inactive:

  • Reminders at 7, 14, and 26 days of author inactivity, then close at 30 days — but only after the day-26 final warning has been posted, so nothing is closed without a warning (this also keeps first-enablement safe for the existing backlog).
  • Author-driven inactivity: a head-branch commit or a comment/review by the PR author resets the timer; maintainer/third-party/bot activity does not.
  • Reminder progress is tracked via hidden marker comments, so no datastore is needed.
  • Eligibility: open, non-draft, external-contributor, not no-autoclose, decisive review state CHANGES_REQUESTED (Oz- or human-authored).
  • Comments and the close use the default GITHUB_TOKEN (authored by github-actions[bot]); least-privilege permissions.
  • workflow_dispatch mode input (dry-run / reminder-only / full); scheduled runs default to full.

Why: external PRs can receive requested-changes reviews (from Oz or a human) and then sit indefinitely without author follow-up, creating review backlog and leaving contributors with no clear closure expectation. More context in this related issue on our OSS management repo: warpdotdev/oz-for-oss#457.

How: a single pinned actions/github-script step mirroring the existing close_stale_fix_prs.yml pattern. Product and tech specs are checked in under specs/stale-pr-cleanup/. Authoring comments as the oz-for-oss bot was deliberately deferred as a non-functional follow-up (see the tech spec).

Linked Issue

Originating issue: warpdotdev/oz-for-oss#457 (tracked in the oz-for-oss repo, not this one). Specs are checked in under specs/stale-pr-cleanup/.

Testing

  • Validated the workflow YAML parses and the embedded github-script passes node --check.
  • actionlint is not installed locally; it runs in CI.
  • No Rust changed, so cargo fmt / cargo clippy are not applicable.
  • Recommended live validation after merge: workflow_dispatchdry-run (logs eligible PRs + intended actions, writes nothing), then reminder-only, before relying on scheduled full runs.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/d76db83c-921f-494e-ac33-ed2b9d868a9d

CHANGELOG-NONE

Co-Authored-By: Oz oz-agent@warp.dev

Scheduled GitHub Action that reminds external-contributor PR authors with an
active requested-changes review at 7/14/26 days of inactivity, then closes the
PR at 30 days (only after the day-26 final warning has been posted). Inactivity
is author-driven and reminder progress is tracked via marker comments, so no
datastore is needed. Includes the product and tech specs.

Originating issue: warpdotdev/oz-for-oss#457

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 2, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Jun 2, 2026

@vkodithala

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a scheduled/manual GitHub Actions workflow to remind and eventually close external-contributor PRs with unresolved requested-changes reviews, plus product and technical specs for the lifecycle.

Concerns

  • The inactivity clock uses Git commit author/committer dates as though they were push timestamps, which can fail to reset after a real head-branch update.
  • The workflow trusts hidden stage markers from any issue comment author, allowing marker spoofing to satisfy the final-warning guard without the workflow having posted that warning.

Security

  • Hidden marker comments are untrusted PR content; only workflow-authored marker comments should be accepted before using them to decide whether closure is allowed.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread .github/workflows/stale_requested_changes_prs.yml Outdated
Comment thread .github/workflows/stale_requested_changes_prs.yml
@vkodithala vkodithala changed the title Add stale requested-changes PR follow-up workflow Add automation to auto-close stale external contributor PRs Jun 2, 2026
- Use GitHub-recorded push times (GraphQL commit.pushedDate + force-push
  events) instead of contributor-controlled commit dates, so a backdated or
  force-pushed commit resets the inactivity timer.
- Only trust stage markers on github-actions[bot]-authored comments so a
  contributor can't spoof the final-warning marker and trigger a close.
- Drop the author-review activity signal (authors can't review their own PR;
  inline replies are already counted as author comments) and remove the
  spec-reference header comment.

Co-Authored-By: Oz <oz-agent@warp.dev>
@vkodithala vkodithala force-pushed the varoon/stale-pr-cleanup branch from 259de17 to cbee5ad Compare June 2, 2026 22:54
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

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

LGTM overall, a few small non-blocking questions. Approving to unblock.

9. **Comment authorship.** Reminders and the closing comment are posted by the workflow's GitHub Actions identity (`github-actions[bot]`, via the default `GITHUB_TOKEN`). Authoring them as the `oz-for-oss` bot — to match other Oz comments on the PR — is a non-functional nicety, explicitly deferred (see the Tech Spec follow-ups), and must not block this work.
10. **No duplicate or repeated actions.** At most one comment is posted per reminder stage per inactivity window; re-running the scan does not post duplicate reminders or re-close an already-closed PR. After a timer reset, stages become eligible again for the new window.
11. **Exemption.** A maintainer-applied `no-autoclose` label removes the PR from the lifecycle immediately; no reminders or closure occur while it is present.
12. **Drafts are skipped.** Converting a PR to draft removes it from the lifecycle until it is marked ready for review again.
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.

Is this meant to reset the clock? If so, it seems this could be a workaround to extend the clock before a PR gets closed.

- name: Follow up on stale requested-changes PRs
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
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.

Non-blocking: could we potentially put this in a standalone script? It would be easier to review + edit if it had its own source file instead of being embedded.

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