Add autofix review loop for Copilot PRs#8181
Conversation
Three new gh-aw workflows that automate the review-fix cycle: - address-review.agent.md: auto-triggered on any non-approval review for Copilot PRs (or PRs labeled copilot-autofix). Reads all review comments, classifies them (blocking/suggestion/informational), applies fixes or explains why a suggestion was skipped, builds, and pushes. - autofix.agent.md: same behavior via /autofix slash command for maintainers to trigger on any PR. - review-after-autofix.agent.md: re-runs expert review on synchronize (push) for Copilot PRs, closing the loop. Circuit breaker: max 3 iterations tracked via HTML comment markers. Shared body in shared/address-review-shared.md.
There was a problem hiding this comment.
Pull request overview
Adds a four-piece agentic workflow loop that automatically addresses expert-reviewer feedback on Copilot-authored PRs and re-reviews the result, capped at 3 iterations. New .agent.md files (plus their auto-generated .lock.yml counterparts) share a single fix-logic body via shared/address-review-shared.md and reuse the existing review-shared.md for re-reviews.
Changes:
- New shared fix-loop body (
shared/address-review-shared.md) that classifies review comments, applies fixes, builds, and posts a summary with a<!-- autofix-iteration -->circuit-breaker marker. - Two trigger workflows:
address-review.agent.md(auto-fires on non-approvalpull_request_reviewfor Copilot PRs) andautofix.agent.md(manual/autofixslash command). review-after-autofix.agent.mdre-runs the expert-reviewer on eachsynchronizeto close the loop.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/shared/address-review-shared.md |
Shared address-review body: classify comments, apply fixes, build, push, summarize with circuit-breaker marker. |
.github/workflows/address-review.agent.md |
Auto-trigger on pull_request_review for Copilot-authored / copilot-autofix PRs (non-approval, same-repo). |
.github/workflows/autofix.agent.md |
Manual /autofix slash command (admin/maintainer/write roles) sharing the same fix logic. |
.github/workflows/review-after-autofix.agent.md |
Re-runs expert reviewer on synchronize events; imports review-shared.md; checkout: false. |
.github/workflows/*.lock.yml (4 files) |
Auto-generated lock files from gh aw compile; not hand-reviewed. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 3
| ## Step 5 — Commit and Push | ||
|
|
||
| 1. Stage all changed files. | ||
| 2. Commit with a message in this format: | ||
|
|
||
| ``` | ||
| Address review feedback | ||
|
|
||
| Applied fixes for N review comments from the expert-reviewer. | ||
| ``` | ||
|
|
||
| 3. Push to the PR branch. |
| 3. **If the count is 3 or more**, post the following comment and then **stop immediately** — do not edit any files: | ||
|
|
||
| > ⚠️ **Autofix loop limit reached** (3 iterations). This PR needs human attention. | ||
| > <!-- autofix-iteration --> |
| if: >- | ||
| github.event.review.state != 'approved' | ||
| && github.event.pull_request.head.repo.id == github.repository_id | ||
| && ( | ||
| github.event.pull_request.user.login == 'copilot-swe-agent[bot]' | ||
| || contains(github.event.pull_request.labels.*.name, 'copilot-autofix') | ||
| ) |
|
@copilot address review comments |
- Fix circuit breaker: use distinct <!-- autofix-limit-reached --> marker in the limit-reached comment so it isn't counted as an iteration - Fix Step 5: instruct agent to use push_to_pull_request_branch safe output instead of direct git commands (credentials not available to agent) - Narrow address-review trigger from != 'approved' to == 'changes_requested' so human COMMENT reviews don't spin up the full agent pipeline Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Addressed all three review comments in commit
|
Summary
Automates the review-fix cycle for Copilot-created PRs so maintainers only need to look at the final green PR.
The loop
New files
shared/address-review-shared.mdaddress-review.agent.mdpull_request_reviewfor Copilot PRs or PRs labeledcopilot-autofixautofix.agent.md/autofixslash command for maintainers to trigger on any PRreview-after-autofix.agent.mdsynchronize(push) for Copilot PRs, imports existingreview-shared.mdKey design decisions
<!-- autofix-iteration -->markers in PR comments, stops after 3 iterationscopilot-swe-agent[bot]or labeledcopilot-autofixreview-after-autofixusespull_request(notpull_request_target) since Copilot PRs are same-repo only;checkout: falsefor review workflowsreview-shared.md(same expert-reviewer), fix workflows importrepo-build-setup.md