Skip to content

feat: dismiss pr reviews when all threads are resolved in pr-sous-chef#43457

Merged
pelikhan merged 3 commits into
copilot/lint-monster-targeted-cleanup-againfrom
copilot/improve-dismiss-pr-review
Jul 5, 2026
Merged

feat: dismiss pr reviews when all threads are resolved in pr-sous-chef#43457
pelikhan merged 3 commits into
copilot/lint-monster-targeted-cleanup-againfrom
copilot/improve-dismiss-pr-review

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

The old dismiss logic had two problems: it was gated behind a scheduled-only actor guard (incorrectly assuming workflow_dispatch can't dismiss github-actions[bot] reviews), and it checked per-review related threads rather than whether the PR is globally clear of unresolved feedback.

Changes

Dismiss condition

  • Before: per-review check — dismiss only if threads related to that specific review are addressed
  • After: global check — dismiss github-actions[bot] CHANGES_REQUESTED reviews only when all review threads on the PR are resolved

Actor guard removed for workflow_dispatch

  • dismiss_pull_request_review always uses GITHUB_TOKEN (authenticated as github-actions[bot]), so it can dismiss bot reviews on any trigger
  • Slash-command (/souschef) runs still skip dismissal — they are acknowledgment nudges, not cleanup passes

Sub-agent (pr-processor) extended

  • Now returns dismiss_reviews: [] — list of review IDs to dismiss (empty unless all threads resolved), so the main agent doesn't re-inspect independently

Run summary

  • Added dismissed_reviews counter to the noop payload

Contract test

  • Replaced old actor-guard assertions with assertions for the new condition, slash-command guard, and dismissed_reviews counter

Copilot AI and others added 2 commits July 5, 2026 04:19
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Remove overly strict actor guard: allow workflow_dispatch runs to
  call dismiss_pull_request_review (GITHUB_TOKEN is always
  github-actions[bot] regardless of trigger)
- Only skip dismissal for slash-command runs (acknowledgment nudges
  should not perform automated cleanup)
- Change dismissal condition from per-review related-threads check
  to global "all PR review threads resolved" check
- Update sub-agent (pr-processor) to return dismiss_reviews list
- Add dismissed_reviews counter to noop run summary
- Update contract test assertions to match new behavior

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

pelikhan commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot determine why action pins changes.json was not properly serialized with 2 spaces per tab. Fix build script or api to avoid the current changes that use 4 spaces

…ync-action-pins

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot determine why action pins changes.json was not properly serialized with 2 spaces per tab. Fix build script or api to avoid the current changes that use 4 spaces

Root cause: commit 910d010d92 ("[ca] CLI Version Updates") wrote .github/aw/actions-lock.json with 4-space indentation via a non-Go code path (the cloud agent used a tool like Node.js JSON.stringify instead of going through ActionCache.Save()). The Go marshalSorted() function correctly produces 2-space output, but sync-action-pins blindly cp-ed the file — propagating the wrong format whenever make recompile ran.

Two fixes in commit fix: normalize actions-lock.json indentation to 2 spaces and update sync-action-pins:

  1. actions-lock.json: reformatted from 4-space to 2-space using jq --indent 2
  2. Makefile sync-action-pins target: replaced cp with jq --indent 2 . so indentation is normalized at sync time regardless of how the source file was written

@pelikhan
pelikhan marked this pull request as ready for review July 5, 2026 04:48
Copilot AI review requested due to automatic review settings July 5, 2026 04:48
@pelikhan
pelikhan merged commit 569d069 into copilot/lint-monster-targeted-cleanup-again Jul 5, 2026
@pelikhan
pelikhan deleted the copilot/improve-dismiss-pr-review branch July 5, 2026 04:48

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 PR Sous Chef workflow guidance and contract test to dismiss stale github-actions[bot] CHANGES_REQUESTED reviews only when the PR has no unresolved review threads, and adjusts action-pins syncing to produce consistently formatted JSON.

Changes:

  • Shift review-dismissal condition from per-review “related threads” to a global “all PR review threads resolved” gate and document the new slash-command skip behavior.
  • Extend the pr-processor sub-agent contract to return dismiss_reviews: [] and add dismissed_reviews to the noop summary expectations.
  • Reformat synced action pins JSON via jq --indent 2 instead of byte-for-byte copying.
Show a summary per file
File Description
pkg/cli/pr_sous_chef_workflow_contract_test.go Updates contract assertions for the new dismissal condition + noop payload field.
Makefile Changes sync-action-pins to pretty-print JSON when syncing action pins.
.github/workflows/pr-sous-chef.md Updates workflow guidance/spec for dismissal logic, slash-command guard, and summary counters.
.github/workflows/pr-sous-chef.lock.yml Regenerated lock metadata to reflect the updated workflow source content.
.github/aw/actions-lock.json Reformats JSON output (indentation/pretty-printing) to match new sync behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/5 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines +293 to +294
- For `schedule` and `workflow_dispatch` runs, use the `dismiss_reviews` list returned by the `pr-processor` sub-agent. The sub-agent populates this list only when ALL review threads on the PR are resolved; leave reviews untouched if any thread remains unresolved.
- `dismiss_pull_request_review` uses the `GITHUB_TOKEN`, which is always authenticated as `github-actions[bot]` regardless of the workflow trigger. It can therefore dismiss `github-actions[bot]`-authored reviews on any non-slash-command run.
Comment on lines 36 to +40
assert.Contains(t, text, "dismiss-pull-request-review", "Workflow should configure the native safe-output path for dismissing stale github-actions reviews")
assert.Contains(t, text, "safeoutputs dismiss_pull_request_review", "Workflow should call the native dismiss_pull_request_review safe-output tool")
assert.Contains(t, text, "dismiss_pull_request_review` is actor-bound", "Workflow must document that dismiss_pull_request_review is actor-bound")
assert.Contains(t, text, "human-triggered runs cannot dismiss bot-authored reviews", "Workflow must require human-triggered runs to skip dismissal")
assert.Contains(t, text, "all review threads on the PR are resolved", "Workflow must dismiss reviews only when all PR review threads are resolved")
assert.Contains(t, text, "slash-command runs are acknowledgment nudges and must not perform automated review cleanup", "Workflow must require slash-command runs to skip dismissal")
assert.Contains(t, text, "dismissed_reviews", "Noop summary must include dismissed_reviews counter")
Comment thread Makefile
Comment on lines +956 to +957
jq --indent 2 . .github/aw/actions-lock.json > pkg/actionpins/data/action_pins.json; \
jq --indent 2 . .github/aw/actions-lock.json > pkg/workflow/data/action_pins.json; \
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.3

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