Skip to content

feat(pr): auto-dismiss stale bot CHANGES_REQUESTED on push (#617) - #1233

Merged
don-petry merged 18 commits into
mainfrom
feat/dismiss-stale-bot-reviews-617
Jul 15, 2026
Merged

don-petry merged 18 commits into
mainfrom
feat/dismiss-stale-bot-reviews-617

Conversation

@don-petry

@don-petry don-petry commented Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Why

GitHub's dismiss_stale_reviews_on_push (on the pr-quality ruleset) only dismisses stale approvals — a bot's CHANGES_REQUESTED is left in place, so a stale CodeRabbit review persists on a superseded commit and blocks reviewDecision even with 0 unresolved threads, until CodeRabbit re-APPROVEs or someone dismisses it by hand. That's #617 blocker 3, a recurring agent-PR merge stall.

What

On pull_request: synchronize, dismiss an allow-listed bot's CHANGES_REQUESTED review when it sits on a non-head (superseded) commit.

Safe by construction:

  • Allow-list scoped (coderabbitai today) — never touches human reviews.
  • Stale-commit-only — a review on the current head is left alone.
  • The bots re-review the new head automatically, so a still-valid concern returns as a fresh CHANGES_REQUESTED on the new SHA — this only clears a block the new commit already superseded.
  • Same-repo PRs only (fork tokens are read-only); pull-requests: write via GITHUB_TOKEN.

Rollout

Ring-0 (.github-private) first per the Safe Release strategy; promotable to the fleet standard later. Implements your chosen direction for #617 (keep donpetry-bot + auto-dismiss on push).

Validation

YAML parses; extracted run-script bash -n + shellcheck clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Juznz5V6su81ffSND8fg7s

Summary by CodeRabbit

  • New Features

    • Automatically dismisses stale bot “Changes requested” pull request reviews when newer commits are pushed.
    • Dismissals apply only to reviews tied to superseded (non-current) commits.
  • Documentation

    • Updated repo guidance to describe the workflow’s triggers, supported bot allow-list, and same-repository limitation (fork PRs are not processed).

GitHub's dismiss_stale_reviews_on_push only dismisses stale *approvals*, so a
bot's CHANGES_REQUESTED (e.g. CodeRabbit) persists on a superseded commit and
blocks reviewDecision even with 0 unresolved threads — a recurring agent-PR merge
blocker (#617, blocker 3). On pull_request:synchronize, dismiss an allow-listed
bot's CHANGES_REQUESTED review when it sits on a non-head (superseded) commit.
Safe: allow-list scoped, stale-commit-only, and the bots re-review the new head
automatically so a still-valid concern returns as a fresh review. Same-repo PRs
only (fork tokens are read-only). Ring-0 (.github-private) first per the release
strategy; promotable to the fleet later.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Juznz5V6su81ffSND8fg7s
Copilot AI review requested due to automatic review settings July 14, 2026 20:37
@don-petry
don-petry requested a review from a team as a code owner July 14, 2026 20:37
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b28a1140-6e10-4f34-b6f7-5cc38037f3f4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that dismisses superseded allow-listed bot CHANGES_REQUESTED reviews on same-repository pull requests, with pagination, failure handling, concurrency control, and repository documentation.

Changes

Stale Bot Review Dismissal

Layer / File(s) Summary
Workflow triggers and execution scope
.github/workflows/dismiss-stale-bot-reviews.yml, AGENTS.md
Defines pull request synchronization and review-submission triggers, permissions, per-PR concurrency, same-repository gating, workflow environment variables, and the documented exception.
Review filtering and dismissal
.github/workflows/dismiss-stale-bot-reviews.yml
Enumerates reviews, filters allow-listed bot CHANGES_REQUESTED reviews on superseded commits, dismisses matches through the GitHub API, reports failures, and counts dismissals.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: initiative

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant GitHubActions
  participant GitHubAPI
  PullRequest->>GitHubActions: synchronize or review submission event
  GitHubActions->>GitHubActions: verify same-repository pull request
  GitHubActions->>GitHubAPI: enumerate pull request reviews
  GitHubAPI-->>GitHubActions: paginated review records
  GitHubActions->>GitHubAPI: dismiss qualifying superseded reviews
  GitHubAPI-->>GitHubActions: dismissal results
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: auto-dismissing stale bot CHANGES_REQUESTED reviews when new commits land.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dismiss-stale-bot-reviews-617

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

Pull request overview

Adds a GitHub Actions workflow to reduce agent-PR merge friction by automatically dismissing allow-listed bot CHANGES_REQUESTED reviews when they are attached to a superseded (non-head) commit on pull_request: synchronize.

Changes:

  • Introduces a new dismiss-stale-bot-reviews.yml workflow triggered on PR pushes (synchronize).
  • Uses gh api to enumerate PR reviews and dismiss allow-listed bot CHANGES_REQUESTED reviews that are not on the current head SHA.

Comment thread .github/workflows/dismiss-stale-bot-reviews.yml Outdated
Comment thread .github/workflows/dismiss-stale-bot-reviews.yml
Comment thread .github/workflows/dismiss-stale-bot-reviews.yml Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) July 14, 2026 20:42
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
@don-petry
don-petry disabled auto-merge July 14, 2026 20:42
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f33f0cbfbf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/dismiss-stale-bot-reviews.yml Outdated
Comment thread .github/workflows/dismiss-stale-bot-reviews.yml
Comment thread .github/workflows/dismiss-stale-bot-reviews.yml
Comment thread .github/workflows/dismiss-stale-bot-reviews.yml Outdated
@don-petry
don-petry disabled auto-merge July 14, 2026 20:46
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@don-petry
don-petry disabled auto-merge July 14, 2026 20:52
@don-petry
don-petry enabled auto-merge (squash) July 14, 2026 20:56
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
@don-petry
don-petry disabled auto-merge July 14, 2026 20:57
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality gate passed with no actionable issues found
Files changed: none
Skipped (informational): 0
```
There are zero Tier 1 blockers and no actionable issues in the bot comment. The PR is healthy — all code quality, security, and CI checks are passing. No changes needed.

@don-petry
don-petry enabled auto-merge (squash) July 14, 2026 20:57
@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 03:38
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@donpetry-bot
donpetry-bot dismissed coderabbitai[bot]’s stale review July 15, 2026 03:38

Auto-dismissed (#617): coderabbitai[bot] CHANGES_REQUESTED on a superseded commit. The bot re-reviews the new head automatically — a valid concern will return as a fresh review.

@don-petry
don-petry disabled auto-merge July 15, 2026 03:38
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1233
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-07-15T04:10:35Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-07-15T04:10:35Z

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 03:40
@don-petry don-petry removed the needs-human-review Flagged by automated PR review agent label Jul 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@don-petry
don-petry disabled auto-merge July 15, 2026 15:47
@sonarqubecloud

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1233
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-07-15T16:19:21Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-07-15T16:19:21Z

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 15:49
@don-petry

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@don-petry
don-petry disabled auto-merge July 15, 2026 15:51
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 0 threads:
(none — open threads array was empty)
Test verification: pass — all CI checks report success; no local changes introduced;
  bats unavailable locally but CI bats/shellcheck/unit-tests all green per status JSON.
Files changed: (none)
```

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 15:53
@don-petry
don-petry disabled auto-merge July 15, 2026 15:53
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
  - Codex: `COMMENTED` (informational only)
  - No `CHANGES_REQUESTED` reviews
**Tier 1 blockers:** None detected (no failed checks, no blocking reviews)
---
## Summary
**Bot:** CodeRabbit  
**Issues addressed:** 0  
**Tier 1 blockers:** None  
The PR is clean. The bot comment contains no actionable findings — it's purely a notification that a review command was invoked. All CI checks pass and the pull request has received an approval from CodeRabbit with no blocking feedback.
No changes needed.

@don-petry
don-petry enabled auto-merge (squash) July 15, 2026 15:54

@donpetry-bot donpetry-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.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 8df0ad4952c2347fe7c4ad4c700231576406d8ef
Review mode: triage-approved (single reviewer)

Summary

Adds a new workflow (dismiss-stale-bot-reviews.yml, 78 lines) that auto-dismisses allow-listed bot (coderabbitai) CHANGES_REQUESTED reviews attached to superseded (non-head) commits, plus a documented AGENTS.md template-drift exception. Fixes #617 blocker 3: GitHub's dismiss_stale_reviews_on_push only clears stale approvals, so a stale bot CHANGES_REQUESTED blocks reviewDecision indefinitely. The implementation is defensively written: same-repo PRs only, Dependabot events skipped, allow-list scoped, stale-commit-only, all dynamic values passed via env: (no shell injection surface), enumeration and dismissal failures surface as errors.

Linked issue analysis

Issue #617 (agent-PR merge friction), blocker 3 — CodeRabbit CHANGES_REQUESTED stickiness — is substantively addressed. The PR implements the "auto-dismiss stale bot CHANGES_REQUESTED reviews on push" direction explicitly listed in the issue. Other blockers (1, 2, 4, 5) are out of scope and tracked separately; the PR does not claim to close the issue (no closing reference), which is correct.

Findings

  • Risk note (triage adjustment): Triage classified this LOW; I classify it MEDIUM — it is a new automation path consuming privileged bot PATs (DON_PETRY_BOT_GH_PAT_CLASSIC fallback chain) and it modifies review-gate behavior. Still auto-approvable: blast radius is tightly bounded (allow-listed bots only, superseded commits only, bots re-review the new head, human reviews never touched, fork PRs excluded).
  • Workflow security: pull_request/pull_request_review triggers (not pull_request_target), no untrusted checkout, env-var-mediated inputs, $user interpolated only after allow-list match with safely-quoted case pattern. No injection vectors found. No new secrets introduced.
  • Prior bot findings all resolved (10/10 threads): invalid event API param removed, enumeration/dismissal error handling added, AGENTS.md exception documented per repo standard, Dependabot skip added, dismissal-capable classic PAT used for protected branches, pull_request_review: submitted trigger handles late-submitted stale reviews. CodeRabbit APPROVED the final head.
  • Minor (non-blocking): AGENTS.md says the allow-list is "currently coderabbitai" while the workflow lists coderabbitai coderabbitai[bot] — same bot, two login forms; not worth a cycle.
  • Secret scan: run_secret_scanning MCP tool not available in this session; gitleaks CI check passed and the diff contains no secret material (only secrets.* context references).

CI status

All required and optional checks green at 8df0ad49: actionlint, ShellCheck, shellcheck, CodeQL (actions + python), agent-shield, Agent Security Scan, gitleaks, SonarCloud, template-drift, caller-stub-freeze, validate-caller-inputs, holdout-guard, unit-tests, bats, CodeRabbit — SUCCESS. Skipped checks are conditional ecosystem audits (npm/pnpm/cargo/pip/go) not applicable to this diff.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@don-petry
don-petry merged commit 5b43f0d into main Jul 15, 2026
40 checks passed
@don-petry
don-petry deleted the feat/dismiss-stale-bot-reviews-617 branch July 15, 2026 15:56
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.

3 participants