Skip to content

Discourage review agent from approving PRs#13512

Merged
JanKrivanek merged 2 commits into
dotnet:mainfrom
JanKrivanek:dev/jankrivanek/no-approve-reviews
Apr 9, 2026
Merged

Discourage review agent from approving PRs#13512
JanKrivanek merged 2 commits into
dotnet:mainfrom
JanKrivanek:dev/jankrivanek/no-approve-reviews

Conversation

@JanKrivanek

Copy link
Copy Markdown
Member

Context

Thanks @JanProvaznik for pointing that the expert-reviewer could approve the PR.

Notes

To completely prevent the reviewing workflow from approving we'd need to remove the submit-pull-request-review from safe-outputs:

submit-pull-request-review:

(untill github/gh-aw#25439 is fixed and deployed)

But even better - we should tune the repo ruleset for PR approvals to either accept it only from CODEOWNERS (though we'd nee to maintain that), or to exclude 'github-actions'

@JanKrivanek JanKrivanek requested a review from a team as a code owner April 9, 2026 10:19
Copilot AI review requested due to automatic review settings April 9, 2026 10:19
@JanKrivanek JanKrivanek enabled auto-merge April 9, 2026 10:20

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

Updates the expert review workflow prompts to prevent automated review agents from ever submitting an APPROVE review, ensuring the workflow doesn’t count toward PR approval requirements.

Changes:

  • Restrict final review submissions to COMMENT or REQUEST_CHANGES (explicitly forbidding APPROVE) in the shared review workflow instructions.
  • Update the expert-reviewer agent guidance so all-clear reviews result in COMMENT rather than APPROVE.
Show a summary per file
File Description
.github/workflows/shared/review-shared.md Adjusts shared workflow instructions to forbid APPROVE and require COMMENT for clean reviews.
.github/agents/expert-reviewer.md Updates the agent’s final verdict mapping to never emit APPROVE.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread .github/workflows/shared/review-shared.md Outdated
Comment thread .github/agents/expert-reviewer.md Outdated

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

Expert Review — PR #13512: Prevent agent from using APPROVE verdict

# Dimension Verdict
1 Backwards Compatibility ✅ LGTM
5 Test Coverage N/A (no code)
12 Code Simplification ✅ LGTM
13 Concurrency N/A
18 Correctness ✅ LGTM
  • Backwards Compat — no behavioral change to builds
  • Correctness — both instruction files updated consistently; no stale APPROVE-as-event references remain in expert-reviewer.md
  • Completeness — all instruction-level references to APPROVE as a review verdict are updated

Summary

Clean, well-scoped change. Both files (expert-reviewer.md and review-shared.md) are updated consistently to replace APPROVE with COMMENT for clean reviews, and add an explicit "Never use APPROVE" directive. The rationale (AI agent reviews should not satisfy branch protection approval requirements) is sound.

One observation (NIT, no action required): The .agent.lock.yml files (review-on-open.agent.lock.yml and review.agent.lock.yml) still list "APPROVE" in the event enum schema for submit_pull_request_review. This is expected since those are auto-generated API schema definitions (what the tool can accept), not behavioral instructions. The instruction-level constraint is the correct layer for this policy. However, if the lock file schema supports restricting allowed values, removing APPROVE from the enum would provide defense-in-depth — worth considering as a follow-up.

No blocking or major issues found. LGTM.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #13512 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Expert Code Review (on open) for issue #13512 · ● 2.5M

@JanKrivanek JanKrivanek merged commit 288cc6e into dotnet:main Apr 9, 2026
10 checks passed
@JanProvaznik

Copy link
Copy Markdown
Member

@JanKrivanek please merge with squash next time

JanKrivanek added a commit that referenced this pull request Apr 16, 2026
Follow up of #13512

### Context
PR review agent is now prevented from approving PR reviews
This was referenced Jun 11, 2026
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.

4 participants