Skip to content

Tighten PR sous-chef nudge heuristics: 4-per-run cap, deterministic prioritization, and safe review-thread resolution#44805

Merged
pelikhan merged 2 commits into
mainfrom
copilot/update-pr-sous-chef-heuristics
Jul 10, 2026
Merged

Tighten PR sous-chef nudge heuristics: 4-per-run cap, deterministic prioritization, and safe review-thread resolution#44805
pelikhan merged 2 commits into
mainfrom
copilot/update-pr-sous-chef-heuristics

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PR sous-chef could over-nudge and re-nudge low-signal targets, and it did not explicitly resolve review threads that already had responses. This update constrains nudge volume, prioritizes the highest-value PRs first, and adds safe-output-driven thread resolution before stale-review dismissal.

  • Nudge budget and ordering

    • Limit nudge comments to at most 4 per run.
    • Add deterministic prioritization:
      1. mergeStateStatus == CONFLICTING
      2. PRs with unresolved threads that already have author/@copilot follow-up replies
      3. Remaining PRs by updatedAt desc, then PR number asc for stable ties
    • Stop creating new nudges after the 4th nudge while still completing run bookkeeping.
  • Repeat-nudge suppression

    • Preserve and reinforce skip behavior when the latest actionable comment is a sous-chef nudge (marker + @copilot), with the existing conflict-state exception.
  • Safe-output review-thread resolution

    • Add resolve-pull-request-review-thread to workflow safe-outputs.
    • Require resolving unresolved threads that already have a follow-up response from PR author or @copilot.
    • Define explicit failure recording for thread-resolution errors in run-summary skipped entries.
  • Run-report accounting

    • Add resolved_review_threads to run summary counters.
    • Keep dismissal of stale github-actions[bot] blocking reviews contingent on all threads being resolved (including newly resolved ones).
  • Contract coverage updates

    • Extend pr_sous_chef_workflow_contract_test.go assertions for:
      • 4-per-run nudge cap
      • prioritization rules
      • review-thread resolution safe-output wiring
      • explicit failure tracking semantics
safe-outputs:
  add-comment:
    max: 4
  resolve-pull-request-review-thread:
    max: 40

Copilot AI and others added 2 commits July 10, 2026 17:04
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Update PR sous-chef heuristics for nudges and review-thread resolution Tighten PR sous-chef nudge heuristics: 4-per-run cap, deterministic prioritization, and safe review-thread resolution Jul 10, 2026
Copilot AI requested a review from pelikhan July 10, 2026 17:14
@github-actions

Copy link
Copy Markdown
Contributor

Hey @copilot-swe-agent 👋 — great work tightening the PR sous-chef nudge heuristics! The 4-per-run cap, deterministic prioritization, and safe-output-driven review-thread resolution are all well-scoped improvements that directly address over-nudging and thread management gaps.

The PR is focused, well-described, includes contract test coverage in pr_sous_chef_workflow_contract_test.go, and introduces no new dependencies. This looks ready for review.

Generated by ✅ Contribution Check · 98.6 AIC · ⌖ 13.6 AIC · ⊞ 6.2K ·

@pelikhan
pelikhan marked this pull request as ready for review July 10, 2026 18:15
Copilot AI review requested due to automatic review settings July 10, 2026 18:15
@pelikhan
pelikhan merged commit c724fc5 into main Jul 10, 2026
@pelikhan
pelikhan deleted the copilot/update-pr-sous-chef-heuristics branch July 10, 2026 18:15

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 bounded, prioritized PR nudging and automated review-thread resolution.

Changes:

  • Caps nudges at four and defines deterministic prioritization.
  • Adds safe-output thread resolution and reporting.
  • Extends workflow contract assertions and recompiles the workflow.
Show a summary per file
File Description
.github/workflows/pr-sous-chef.md Updates workflow behavior and safe outputs.
.github/workflows/pr-sous-chef.lock.yml Regenerates the compiled workflow.
pkg/cli/pr_sous_chef_workflow_contract_test.go Extends contract checks.

Review details

Tip

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

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

Comment on lines +272 to +276
5. Prioritize which PRs to nudge, in this order:
- `mergeStateStatus == "CONFLICTING"` first (explicit merge-conflict unblock request).
- PRs with unresolved review threads where at least one thread already has a follow-up response from the PR author or `@copilot` but remains unresolved.
- Remaining PRs by most-recent `updatedAt`.
If two PRs are still tied, prioritize the lower PR number first for deterministic behavior and stable reruns.
```bash
safeoutputs resolve_pull_request_review_thread --thread_id PRRT_kwDOABCD1234
```
- If resolving one thread fails, append `{pr_number: <N>, skip_reason: "resolve_review_thread_failed", thread_id: "<thread-id>"}` to the run-summary `skipped` array and continue with remaining thread IDs; do not fail the run solely because one resolution attempt failed.
4. **Dismiss stale `github-actions[bot]` blocking reviews when all PR review threads are resolved**
- **Slash-command guard**: If triggered via the `/souschef` slash command (`pull_request_comment` event), skip this dismissal step entirely — slash-command runs are acknowledgment nudges and must not perform automated review cleanup.
- 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.
- 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 (including threads resolved in step 3); leave reviews untouched if any thread remains unresolved.
assert.Contains(t, text, "Process all eligible PRs per run.", "Workflow should require processing all eligible PRs")
assert.Contains(t, text, "Process at most 4 nudges per run.", "Workflow should cap nudges per run")
assert.Contains(t, text, "add-comment:\n max: 4", "Workflow should hard-cap add_comment safe-output calls to 4 per run")
assert.Contains(t, text, "Prioritize which PRs to nudge, in this order:", "Workflow should define deterministic PR prioritization for nudges")
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.8

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