Skip to content

Commit 19d59cd

Browse files
Copilotpelikhan
andauthored
Update pr-sous-chef: process all PRs, ignore informational comments in prefilter (#43492)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 1bf2846 commit 19d59cd

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

.github/workflows/pr-sous-chef.lock.yml

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/pr-sous-chef.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ steps:
6666
gh pr list --repo "$EXPR_GITHUB_REPOSITORY" \
6767
--state open \
6868
--search "is:pr is:open -is:draft sort:updated-desc" \
69-
--limit 30 \
69+
--limit 100 \
7070
--json number,title,url,headRefOid,headRefName,updatedAt,author,mergeStateStatus,statusCheckRollup \
7171
> "$candidate_file"
7272
@@ -105,10 +105,12 @@ steps:
105105
)"
106106
107107
# Skip if the very last comment was posted by pr-sous-chef (never add two in a row).
108+
# Only treat a sous-chef comment as actionable (and thus skip-worthy) if it also
109+
# contains "@copilot"; comments without "@copilot" are purely informational.
108110
last_comment_is_sous_chef="$(
109111
jq -r --arg marker "$sous_chef_nudge_marker" '
110112
if length == 0 then "false"
111-
elif (.[0].body // "" | contains($marker)) then "true"
113+
elif (.[0].body // "" | (contains($marker) and contains("@copilot"))) then "true"
112114
else "false"
113115
end
114116
' <<<"$recent_comments_json"
@@ -122,9 +124,11 @@ steps:
122124
fi
123125
124126
# Skip if pr-sous-chef commented within the last 30 minutes (cooldown period).
127+
# Only actionable sous-chef comments (those containing "@copilot") count toward cooldown;
128+
# informational comments without "@copilot" are ignored.
125129
last_sous_chef_comment_at="$(
126130
jq -r --arg marker "$sous_chef_nudge_marker" '
127-
[.[] | select(.body // "" | contains($marker))] | .[0].created_at // ""
131+
[.[] | select(.body // "" | (contains($marker) and contains("@copilot")))] | .[0].created_at // ""
128132
' <<<"$recent_comments_json"
129133
)"
130134
if [ -n "$last_sous_chef_comment_at" ]; then
@@ -232,7 +236,7 @@ When this workflow is triggered by the `/souschef` slash command on a PR comment
232236
1. Read `/tmp/gh-aw/agent/pr-sous-chef-candidates-compact.json` first.
233237
2. If `prs` is empty, call `noop` with `"No open non-draft PRs to process"` and stop.
234238
3. Process PRs in `updatedAt` descending order.
235-
4. Process at most **5 PRs** per run. Remaining eligible PRs will be handled in the next scheduled run.
239+
4. Process all eligible PRs per run.
236240
5. Use the `pr-processor` sub-agent for each PR; pass only the PR number and compact context.
237241
6. If a `pr-processor` call returns non-JSON or an error, record `{pr_number: <N>, skip_reason: "sub_agent_error"}` in the `skipped` array of the run-summary noop payload and move to the next PR without retrying.
238242
7. Do not fetch full PR diffs or large file lists unless absolutely required for a skip decision.
@@ -250,15 +254,15 @@ Before any nudge for a PR:
250254
- When calling `gh aw checks` directly, pass `--head-sha <headRefOid>` to avoid a redundant PR-detail fetch (the `headRefOid` is available in the compact JSON).
251255

252256
2. **Skip when the latest PR comment is from pr-sous-chef itself (unless the PR is in a merge-conflict state)**
253-
- Candidate prefilter already removes PRs when the latest issue comment body includes the hidden marker `<!-- gh-aw-pr-sous-chef-nudge -->`, **except** when `mergeStateStatus` is `CONFLICTING`.
257+
- Candidate prefilter already removes PRs when the latest issue comment body includes the hidden marker `<!-- gh-aw-pr-sous-chef-nudge -->` **and** `@copilot`, **except** when `mergeStateStatus` is `CONFLICTING`.
254258
- Inspect PR comments ordered by recency.
255-
- Treat a comment as from pr-sous-chef only when the latest comment body contains `<!-- gh-aw-pr-sous-chef-nudge -->`.
259+
- Treat a comment as an actionable sous-chef comment only when the latest comment body contains both `<!-- gh-aw-pr-sous-chef-nudge -->` **and** `@copilot`. Comments with the marker but without `@copilot` are purely informational and do **not** count as a sous-chef nudge for the purpose of this skip rule.
256260
- If true **and** `mergeStateStatus` is **not** `CONFLICTING`, skip to avoid back-to-back nudges.
257261
- If true **and** `mergeStateStatus` is `CONFLICTING`, do **not** skip — sous-chef must ask Copilot to resolve the merge conflicts even if the previous comment was its own.
258262

259263
3. **Skip during the 30-minute cooldown after a pr-sous-chef comment**
260-
- Candidate prefilter already removes PRs where the most recent sous-chef comment was posted within the last 30 minutes.
261-
- If any recent comment contains `<!-- gh-aw-pr-sous-chef-nudge -->` and was created less than 30 minutes ago, skip this PR.
264+
- Candidate prefilter already removes PRs where the most recent sous-chef comment (containing both the marker and `@copilot`) was posted within the last 30 minutes.
265+
- If any recent comment contains both `<!-- gh-aw-pr-sous-chef-nudge -->` and `@copilot` and was created less than 30 minutes ago, skip this PR. Comments with the marker but without `@copilot` are informational and do **not** trigger the cooldown.
262266

263267
## Required nudges for eligible PRs
264268

@@ -354,8 +358,8 @@ Given one PR number and compact metadata:
354358
355359
1. Check skip conditions in this order:
356360
- checks/actions running — note: the candidate prefilter already excluded PRs with pending checks via `statusCheckRollup`; only re-verify if you have reason to believe state changed since the prefilter ran
357-
- latest comment contains `<!-- gh-aw-pr-sous-chef-nudge -->` **and** `mergeStateStatus` is **not** `CONFLICTING` (when the branch has merge conflicts, do NOT skip even if the last comment is from sous-chef — it must nudge Copilot to resolve them)
358-
- any recent comment contains `<!-- gh-aw-pr-sous-chef-nudge -->` and was posted within the last 30 minutes
361+
- latest comment contains both `<!-- gh-aw-pr-sous-chef-nudge -->` **and** `@copilot`, **and** `mergeStateStatus` is **not** `CONFLICTING` (when the branch has merge conflicts, do NOT skip even if the last actionable comment is from sous-chef — it must nudge Copilot to resolve them; also, comments with the marker but without `@copilot` are purely informational and do NOT count as a sous-chef nudge for this check)
362+
- any recent comment contains both `<!-- gh-aw-pr-sous-chef-nudge -->` and `@copilot` and was posted within the last 30 minutes (informational comments without `@copilot` do not count toward cooldown)
359363
2. If skipped, return `skip_reason` only.
360364
3. If not skipped, return:
361365
- `conflicting`: true if `mergeStateStatus` is `CONFLICTING` (indicates the branch has merge conflicts)

0 commit comments

Comments
 (0)